pub fn baseline_reference_energy_active(
energies: &[f64],
active: Option<&[bool]>,
) -> f64Expand description
Reference energy for the baseline log basis, computed over the active fit window only (issue #648).
The full grid extends far beyond the resonances of interest (a VENUS Ta
grid spans 4.5 eV–2.3 MeV while the fit window is 8–45 eV). Centering
the ln(E/E_ref) basis at the full-grid midpoint (≈3211 eV) instead of
the active-window midpoint (≈19 eV) pushes every active bin to a large
negative z, so the 1, z, z² columns stop being near-orthogonal and
the baseline silently absorbs Doppler broadening — the fitted
temperature runs away with warnings = []. Restricting the midpoint to
the bins that actually enter the cost (the active mask) restores it.
active is the per-bin mask from
crate::active_mask::build_active_mask; None (no fit_energy_range)
is identical to baseline_reference_energy over the whole grid. A
mask selecting no bins falls back to the full grid rather than returning
NaN (the pipeline’s active-bin-count gate rejects an empty window
upstream, so this branch is defensive only).