Diagnostics API
Public API for environment diagnostics.
- pstrain.api.diagnostics.fp_contract_policy()[source]
Return the floating-point contraction policy declared by the native build.
- Return type:
- pstrain.api.diagnostics.learning_curves(project_dir, config='default')[source]
Return Baum-Welch pass records for the project’s trained stages.
configis the model config-directory name below each stage inshared/models, not a request to resolve a profile. Stages without a telemetry file are skipped, so a project with no trained models returns an empty list. A telemetry file that exists but is unreadable or invalid raises the same contextual error asload_bw_telemetry().Results are in canonical acoustic-ladder order from the pipeline’s target declarations. This is not a record of historical execution order: stale or independently trained stages retain their canonical position. Recovering actual execution order would require run or stage order to be recorded in project provenance. Filesystem modification times are deliberately ignored.
- pstrain.api.diagnostics.load_bw_telemetry(model_dir)[source]
Load a Baum-Welch telemetry document from
model_dir.Supported schema versions 1 and 2 contain the same core
passesfields used here. Each pass reports its number, total and per-frame likelihoods, frame count, signed convergence delta, and stop decision; performance, accounting, and shard details are optional. The returned dictionary is newly decoded on every call.- Raises:
FileNotFoundError – If
model_dir/bw_telemetry.jsondoes not exist.ValueError – If the file cannot be decoded, uses an unsupported schema, or lacks the required pass fields.
- Parameters:
model_dir (Path)
- Return type:
- pstrain.api.diagnostics.native_library_available()[source]
Return whether the native pstrain library can be loaded.
- Return type:
- pstrain.api.diagnostics.resolve_binary(name, bin_dir=None)[source]
Resolve a program exactly as
CommandBuilderwill execute it.
- pstrain.api.diagnostics.PSTRAIN_BINARIES
Names of the native pstrain command-line programs.