Skip to main content

EnergyScaleTransmissionModel

Struct EnergyScaleTransmissionModel 

Source
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:

  1. Convert nominal energy → TOF: t = TOF_FACTOR * L / √E_nom
  2. Apply calibration: t_corr = t - t₀, E_corr = (TOF_FACTOR * L * L_scale / t_corr)²
  3. Evaluate σ(E_corr) directly via reich_moore + Doppler on a working grid built from E_corr (auxiliary extended grid under Gaussian resolution; E_corr itself for tabulated / no resolution) — NOT interpolation of a fixed σ grid, which clamps at the auxiliary boundary and drops resonance fine-structure.
  4. 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

Source

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 via reich_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.
Source

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.

Trait Implementations§

Source§

impl FitModel for EnergyScaleTransmissionModel

Source§

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§

fn evaluate(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>

Evaluate the model for the given parameters. Read more
Source§

impl ForwardModel for EnergyScaleTransmissionModel

Source§

fn predict(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>

Predict model output for the given parameter vector. Read more
Source§

fn jacobian( &self, params: &[f64], free_param_indices: &[usize], y_current: &[f64], ) -> Option<Vec<Vec<f64>>>

Analytical Jacobian (column-major layout). Read more
Source§

fn n_data(&self) -> usize

Number of data points in the model output.
Source§

fn n_params(&self) -> usize

Number of parameters (total, including fixed).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more