Module truing

Module truing 

Source
Expand description

Velocity / BC truing core (MBA-1343 Phase A).

The multi-observation joint MV+BC calibration (MBA-1316) extracted from the CLI binary so non-CLI front ends (e.g. the WASM terminal) can reuse the exact compute path. All rendering (table / JSON / CSV) stays with the front ends; this module goes as far as building a MultiTruingReport. The module is silent: it never writes to stdout/stderr, so progress reporting is the caller’s job (see validate_truing_observations for how the CLI sequences its progress line without double-reporting validation errors).

Structs§

MultiTruingReport
Final report produced by a multi-observation truing fit.
TrueVelocityLocalResult
Result of the classic single-observation velocity truing (calculate_true_velocity_local).
TruingModelInputsV1
Complete scalar-BC forward-model input used by the truing design and uncertainty APIs added in MBA-1346/MBA-1353.
TruingObservation
A single observed impact used for truing: range (internal yards) and the measured drop below line of sight expressed in the caller’s drop unit.

Enums§

DragModelArg
Drag-model selector for the truing commands, in the shape the CLI exposes (a plain G1/G7 choice, lowercase-parsed by clap/the WASM terminal). It maps onto the engine’s DragModel inside the solvers; unlike DragModel it deliberately offers only the two standard models the truing forward model supports.
DropUnit
Unit in which observed drops are supplied to (and residuals reported from) true-velocity’s multi-observation joint calibration (MBA-1316). The historical single-observation path is always MIL, so mil is the default and leaves that path byte-identical.

Functions§

calculate_true_velocity_local
Calculate the effective muzzle velocity that reproduces measured_drop_mil at range_yd, via binary search over the real trajectory solver (the classic single-observation true-velocity path).
dsf_window_start
The downrange distance (m) at which the DSF (drag-scale-factor) window starts: 90% of the downward Mach 0.9 crossing distance. None when the trajectory never crosses Mach 0.9 — mirrors TrajectoryResult::mach_0_9_distance_m’s own None case, MBA-1405. pub: consumed by the native CLI’s dsf verb (MBA-1405 Task 2).
fallback_bullet_length_m
Resolve a bullet length (meters) for a bullet whose length the shooter did not supply (MBA-1135).
mv_calibration_window
The MV (muzzle-velocity) calibration validity window: (start_m, end_m), where end_m is the downward Mach 1.2 crossing distance and start_m is 90% of it. None when the trajectory never crosses Mach 1.2 (nothing to bound the window with) — mirrors TrajectoryResult::mach_1_2_distance_m’s own None case, MBA-1405. pub (not pub(crate)): consumed by the native CLI (main.rs) and the WASM terminal (wasm.rs), both separate crates from this lib (MBA-1405 Task 2).
parse_truing_observation
Parse an --observed RANGE:DROP token. RANGE is in the caller’s distance units (yards imperial / meters metric) and is normalized to internal yards; DROP stays in the caller’s drop unit. Returns a user-facing error string on malformed input so the CLI can report cleanly instead of panicking.
run_multi_observation_truing_core
Orchestrate the multi-observation joint MV+BC calibration and build the final MultiTruingReport (MBA-1343: the compute half only — rendering stays with the caller).
validate_truing_observations
Validate a truing observation set: every range finite and positive, every drop finite and non-zero, and no two observations at (numerically) the same range. run_multi_observation_truing_core runs this itself, so callers don’t have to — it is public so a front end can pre-validate when it wants to sequence its own progress output strictly after validation (the native CLI prints its “Fitting N observations…” progress line only for sets that will actually be fitted). Error strings are the stable user-facing ones.