pub struct CountsModel<'a> {
pub transmission_model: &'a dyn FitModel,
pub flux: &'a [f64],
pub background: &'a [f64],
pub n_params: usize,
}Expand description
Convert transmission model + counts to a counts-based forward model.
Given: Y_model = flux × T_model(θ) + background
This wraps a transmission model to predict observed counts.
The flux and background slices must have the same length as the
transmission vector returned by the inner model. In debug builds,
evaluate() asserts this invariant.
Fields§
§transmission_model: &'a dyn FitModelUnderlying transmission model.
flux: &'a [f64]Incident flux (counts per bin in open beam, after normalization).
background: &'a [f64]Background counts per bin.
n_params: usizeTotal parameter count in the wrapped model.
Trait Implementations§
Source§impl<'a> FitModel for CountsModel<'a>
impl<'a> FitModel for CountsModel<'a>
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: ∂Y/∂θ = flux · ∂T_inner/∂θ.
Background is constant w.r.t. θ and drops out.
Source§impl<'a> ForwardModel for CountsModel<'a>
impl<'a> ForwardModel for CountsModel<'a>
Auto Trait Implementations§
impl<'a> Freeze for CountsModel<'a>
impl<'a> !RefUnwindSafe for CountsModel<'a>
impl<'a> !Send for CountsModel<'a>
impl<'a> !Sync for CountsModel<'a>
impl<'a> Unpin for CountsModel<'a>
impl<'a> !UnwindSafe for CountsModel<'a>
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
Mutably borrows from an owned value. Read more
§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>
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 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>
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