Skip to main content

broadened_cross_sections

Function broadened_cross_sections 

Source
pub fn broadened_cross_sections(
    energies: &[f64],
    resonance_data: &[ResonanceData],
    temperature_k: f64,
    instrument: Option<&InstrumentParams>,
    cancel: Option<&AtomicBool>,
) -> Result<Vec<Vec<f64>>, TransmissionError>
Expand description

Compute Doppler-broadened cross-sections for each isotope.

Returns Doppler-only cross-sections. Resolution broadening is NOT applied here because it must be applied after Beer-Lambert on the total transmission for physically correct results (issue #442).

When instrument is Some, the auxiliary extended grid is still constructed for Doppler boundary accuracy, but the resolution convolution is not performed.

This is the expensive physics step; cache the result once before fitting many pixels on the same isotopes and energy grid.

§Arguments

  • energies — Energy grid in eV (sorted ascending).
  • resonance_data — Resonance parameters for each isotope.
  • temperature_k — Sample temperature for Doppler broadening.
  • instrument — Optional instrument resolution parameters. Used only for auxiliary grid construction (Doppler boundary accuracy). Resolution broadening is NOT applied.
  • cancel — Optional cancellation token. Cancellation is checked at the start of each isotope’s parallel task; in-flight tasks run to completion (consistent with the rayon pattern in spatial.rs).

§Returns

One cross-section vector per isotope on success.

§Errors