pub struct EnergyScaleTransmissionModel { /* private fields */ }Expand description
Transmission model with energy-scale calibration parameters (t₀, L_scale).
Carries per-isotope resonance data (NOT a precomputed σ grid) and rebuilds
the TRUE cross-section at the corrected energies on each evaluation
(issue #608), matching forward_model:
- Convert nominal energy → TOF:
t = TOF_FACTOR * L / √E_nom - Apply calibration:
t_corr = t - t₀,E_corr = (TOF_FACTOR * L * L_scale / t_corr)² - Evaluate σ(E_corr) via
reich_moore+ Doppler on the working grid built fromE_corr. - Beer-Lambert + resolution on the working grid, then extract the data points last.
This is equivalent to SAMMY’s TZERO parameters.
The Jacobian for t₀ and L_scale defaults to partial-GAL since
issue #489: central FD on t0 only (2 evals) plus an inline rank-1
derivation of the L_scale column. The previous central-FD-on-both
(4-eval) behaviour is reachable via with_jacobian_method,
NEREIDS_TZERO_JACOBIAN=fd2, or tzero_jacobian="fd2" Python kwarg.
See EnergyScaleJacobianMethod for full method documentation.
Implementations§
Source§impl EnergyScaleTransmissionModel
impl EnergyScaleTransmissionModel
Sourcepub fn new(
resonance_data: Arc<Vec<ResonanceData>>,
density_indices: Arc<Vec<usize>>,
density_ratios: Arc<Vec<f64>>,
temperature_k: f64,
nominal_energies: Vec<f64>,
flight_path_m: f64,
t0_index: usize,
l_scale_index: usize,
instrument: Option<Arc<InstrumentParams>>,
) -> Self
pub fn new( resonance_data: Arc<Vec<ResonanceData>>, density_indices: Arc<Vec<usize>>, density_ratios: Arc<Vec<f64>>, temperature_k: f64, nominal_energies: Vec<f64>, flight_path_m: f64, t0_index: usize, l_scale_index: usize, instrument: Option<Arc<InstrumentParams>>, ) -> Self
Create a new energy-scale transmission model.
§Arguments
resonance_data— Resonance parameters per isotope; σ is evaluated at the corrected energies viareich_moore+ Doppler (issue #608).density_indices— Maps isotope index → density parameter index.density_ratios— Fractional ratio per isotope (1.0 when ungrouped).temperature_k— Sample temperature (K) for Doppler broadening.nominal_energies— Energy grid in eV (ascending).flight_path_m— Nominal flight path in meters.t0_index— Index of t₀ parameter.l_scale_index— Index of L_scale parameter.instrument— Optional resolution function.
Sourcepub fn with_jacobian_method(self, method: EnergyScaleJacobianMethod) -> Self
pub fn with_jacobian_method(self, method: EnergyScaleJacobianMethod) -> Self
Override the t0 / L_scale Jacobian method for this model instance.
Bypasses the NEREIDS_TZERO_JACOBIAN env var.
Sourcepub fn with_temperature_index(
self,
temperature_index: Option<usize>,
) -> Result<Self, FittingError>
pub fn with_temperature_index( self, temperature_index: Option<usize>, ) -> Result<Self, FittingError>
Fit the sample temperature jointly with the energy scale (issue #634).
Some(idx) makes params[idx] the free temperature (K); None keeps
temperature fixed at the constructor’s temperature_k.
§Errors
FittingError::InvalidConfig if Some(idx) collides with t0_index,
l_scale_index, or any density index — a mis-wired index would
otherwise Doppler-broaden at a nonsense “temperature” (e.g. the t0
value) with no error. Mirrors TransmissionFitModel::new’s
density-overlap rejection (issue #634 review, sibling-parity class).
Sourcepub fn effective_jacobian_method(&self) -> EnergyScaleJacobianMethod
pub fn effective_jacobian_method(&self) -> EnergyScaleJacobianMethod
The Jacobian method that will actually be used for the t0 and
L_scale columns.
The rank-1 identity J[:, L_scale] = ((tof - t0)/L_scale)·J[:, t0]
holds only when L_scale reaches the prediction through the corrected
energy grid and nowhere else. With a resolution kernel it reaches it
twice: the kernel is read against L·L_scale, so its width moves with
the same parameter. That second route is absent from the identity, so
deriving the column understates it.
The distinction is physical rather than a special case — it is whether
an instrument response exists at all. Without one the identity is exact
to f64 roundoff (partial_gal_no_resolution_matches_fd2).
Trait Implementations§
Source§impl FitModel for EnergyScaleTransmissionModel
impl FitModel for EnergyScaleTransmissionModel
Source§fn analytical_jacobian(
&self,
params: &[f64],
free_param_indices: &[usize],
_y_current: &[f64],
) -> Option<FlatMatrix>
fn analytical_jacobian( &self, params: &[f64], free_param_indices: &[usize], _y_current: &[f64], ) -> Option<FlatMatrix>
Jacobian: analytical for density parameters, finite-difference for t₀ and L_scale.
Source§impl ForwardModel for EnergyScaleTransmissionModel
impl ForwardModel for EnergyScaleTransmissionModel
Source§fn predict(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
fn predict(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
Auto Trait Implementations§
impl !Freeze for EnergyScaleTransmissionModel
impl !RefUnwindSafe for EnergyScaleTransmissionModel
impl !Send for EnergyScaleTransmissionModel
impl !Sync for EnergyScaleTransmissionModel
impl Unpin for EnergyScaleTransmissionModel
impl UnsafeUnpin for EnergyScaleTransmissionModel
impl UnwindSafe for EnergyScaleTransmissionModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more