pub struct NormalizedTransmissionModel<M: FitModel> { /* private fields */ }Expand description
Wraps a transmission model with SAMMY-style normalization and background.
T_out(E) = Anorm × T_inner(E) + BackA + BackB / √E + BackC × √E + BackD × exp(−BackF / √E)
The normalization and background parameters are additional entries in the parameter vector, appended after the density (and optional temperature) parameters of the inner model.
The exponential tail (BackD, BackF) is optional. When
back_d_index and back_f_index are None, the model reduces to
the 4-parameter form.
§SAMMY Reference
SAMMY manual Sec III.E.2 — NORMAlization and BACKGround cards. SAMMY fits up to 6 background terms; we implement all 6: Anorm, constant BackA, 1/√E term BackB, √E term BackC, exponential amplitude BackD, exponential decay BackF.
Implementations§
Source§impl<M: FitModel> NormalizedTransmissionModel<M>
impl<M: FitModel> NormalizedTransmissionModel<M>
Sourcepub fn new(
inner: M,
energies: &[f64],
anorm_index: usize,
back_a_index: usize,
back_b_index: usize,
back_c_index: usize,
) -> Self
pub fn new( inner: M, energies: &[f64], anorm_index: usize, back_a_index: usize, back_b_index: usize, back_c_index: usize, ) -> Self
Create a new normalized transmission model (4-parameter, no exponential tail).
§Arguments
inner— The inner transmission model (Beer-Lambert).energies— Energy grid in eV (must be positive).anorm_index— Index of Anorm in the parameter vector.back_a_index— Index of BackA in the parameter vector.back_b_index— Index of BackB in the parameter vector.back_c_index— Index of BackC in the parameter vector.
Sourcepub fn new_with_exponential(
inner: M,
energies: &[f64],
anorm_index: usize,
back_a_index: usize,
back_b_index: usize,
back_c_index: usize,
back_d_index: usize,
back_f_index: usize,
) -> Self
pub fn new_with_exponential( inner: M, energies: &[f64], anorm_index: usize, back_a_index: usize, back_b_index: usize, back_c_index: usize, back_d_index: usize, back_f_index: usize, ) -> Self
Create a normalized transmission model with the SAMMY exponential tail.
Adds BackD × exp(−BackF / √E) to the 4-parameter background model.
§Arguments
back_d_index— Index of BackD (exponential amplitude) in the parameter vector.back_f_index— Index of BackF (exponential decay constant) in the parameter vector.
Trait Implementations§
Source§impl<M: FitModel> FitModel for NormalizedTransmissionModel<M>
impl<M: FitModel> FitModel for NormalizedTransmissionModel<M>
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>
Analytical Jacobian for the normalized transmission model.
For each free parameter:
- If it belongs to the inner model (density or temperature): ∂T_out/∂p = Anorm × ∂T_inner/∂p (inner Jacobian scaled by Anorm)
- ∂T_out/∂Anorm = T_inner(E)
- ∂T_out/∂BackA = 1
- ∂T_out/∂BackB = 1/√E
- ∂T_out/∂BackC = √E
- ∂T_out/∂BackD = exp(−BackF / √E)
- ∂T_out/∂BackF = −BackD × exp(−BackF / √E) / √E
Source§impl<M: FitModel> ForwardModel for NormalizedTransmissionModel<M>
impl<M: FitModel> ForwardModel for NormalizedTransmissionModel<M>
Source§fn predict(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
fn predict(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
Auto Trait Implementations§
impl<M> Freeze for NormalizedTransmissionModel<M>where
M: Freeze,
impl<M> RefUnwindSafe for NormalizedTransmissionModel<M>where
M: RefUnwindSafe,
impl<M> Send for NormalizedTransmissionModel<M>where
M: Send,
impl<M> Sync for NormalizedTransmissionModel<M>where
M: Sync,
impl<M> Unpin for NormalizedTransmissionModel<M>where
M: Unpin,
impl<M> UnsafeUnpin for NormalizedTransmissionModel<M>where
M: UnsafeUnpin,
impl<M> UnwindSafe for NormalizedTransmissionModel<M>where
M: UnwindSafe,
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