Skip to main content

forward_model_from_base_xs

Function forward_model_from_base_xs 

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

Compute a transmission spectrum from precomputed unbroadened cross-sections.

Applies Doppler broadening and Beer-Lambert using cached base XS, then resolution broadening on the total transmission. This skips the expensive resonance calculation when temperature varies.

The full pipeline runs on the auxiliary extended grid (boundary extension + resonance fine-structure points) so that Doppler AND resolution broadening have adequate quadrature support and correct boundary handling; the data-grid points are extracted LAST. This mirrors the non-cached forward_model and broadened_cross_sections_for_transmission exactly resolution broadening, degrading the convolution near the grid edges and around narrow resonances.

Pipeline:

  1. Per isotope: build σ on the extended grid (cached data-grid values + freshly-evaluated auxiliary points), Doppler-broaden on the extended grid
  2. Accumulate total attenuation on the extended grid: Σᵢ nᵢ·σ_{D,i}
  3. Beer-Lambert: T = exp(−attenuation) on the extended grid
  4. Resolution: T_broad = R ⊗ T on the extended grid (when instrument present)
  5. Extract the data-grid points