calibrate_energy

Function calibrate_energy 

Source
pub fn calibrate_energy(
    energies_nominal: &[f64],
    transmission: &[f64],
    uncertainty: &[f64],
    isotopes: &[ResonanceData],
    abundances: &[f64],
    assumed_flight_path_m: f64,
    temperature_k: f64,
    resolution: Option<&InstrumentParams>,
) -> Result<CalibrationResult, PipelineError>
Expand description

Calibrate the energy axis of a TOF neutron measurement.

Given a measured 1D transmission spectrum and known sample composition (e.g. natural Hf), finds the (L, t₀) that minimize chi² by aligning the ENDF resonance positions with the measured dips.

§Arguments

  • energies_nominal — Energy grid computed with assumed L (ascending, eV)
  • transmission — Measured transmission values (same length)
  • uncertainty — Per-bin uncertainty (same length)
  • isotopes — ENDF resonance data for each isotope
  • abundances — Natural abundance fractions (same length as isotopes, sum ≤ 1)
  • assumed_flight_path_m — The L used to compute energies_nominal
  • temperature_k — Sample temperature for Doppler broadening
  • resolution — Optional instrument resolution function. When provided, the forward model includes Doppler + resolution broadening, producing more accurate (L, t₀) fits. Without resolution, fitted parameters absorb the missing broadening and may be biased.

§Returns

CalibrationResult with the fitted (L, t₀, n_total) and corrected energies.