Skip to main content

NormalizedTransmissionModel

Struct NormalizedTransmissionModel 

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

Source

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

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>

Source§

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§

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

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

impl<M: FitModel> ForwardModel for NormalizedTransmissionModel<M>

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