Skip to main content

corrected_energy_grid

Function corrected_energy_grid 

Source
pub fn corrected_energy_grid(
    energies: &[f64],
    t0_us: f64,
    l_scale: f64,
    flight_path_m: f64,
) -> Result<Vec<f64>, FittingError>
Expand description

Map an energy grid through the SAMMY energy-scale (t0, L_scale), using the SAME convention as EnergyScaleTransmissionModel::corrected_energies: with nominal tof(E) = TOF_FACTOR·L/√E, the corrected energy is E' = (TOF_FACTOR·L·L_scale / (tof − t0))². Identity at (t0, L_scale) = (0, 1).

Note the −t0 sign (a positive t0 is subtracted from the measured TOF, so it raises the corrected energy) — this is the shipped energy-scale convention, opposite to the +t0 form used by the retired position nuisance. Errors if any corrected TOF tof − t0 ≤ 0 (a t0 past the shortest flight time).

SAMMY reference for the −t0 sign convention: dat/mdat0.f90:189 (etzero = ee*(Elzero/(1−Tzero·√ee/Tttzzz))²) — the measured TOF has TZERO subtracted before the energy conversion, so a positive t0 raises the corrected energy. This is the canonical NEREIDS implementation of the formula; the runtime EnergyScaleTransmissionModel::corrected_energies is pinned bit-for-bit to it by corrected_energy_grid_matches_energy_scale_model, and SpectrumFitResult::corrected_energies (issue #634) reuses it so callers never re-derive the transform (a +t0 slip caused a silent +400 K bias).