pub struct TransmissionKLBackgroundModel<'a> {
pub inner: &'a dyn FitModel,
pub inv_sqrt_energies: Vec<f64>,
pub b0_index: usize,
pub b1_index: usize,
pub n_params: usize,
}Expand description
KL-compatible background model for transmission data.
Given a transmission model T_inner(θ), predicts:
T_out(E) = T_inner(E) + b₀ + b₁/√E
where b₀ and b₁ are the additive background parameters at indices
b0_index and b1_index in the parameter vector.
Unlike NormalizedTransmissionModel (which uses Anorm * T + BackA + BackB/√E + BackC√E with 4 free parameters), this model:
- Has only 2 background parameters (b₀, b₁), reducing overfitting risk
- Constrains b₀, b₁ ≥ 0 via parameter bounds (physical: background adds counts, never subtracts), ensuring T_out > 0 for valid Poisson NLL
- Does NOT multiply T_inner by a normalization factor — normalization is handled separately (nuisance estimation for counts, or pre-processing for transmission data)
§Gradient
- ∂T_out/∂nₖ = ∂T_inner/∂nₖ = -σₖ(E)·T_inner(E) (same as bare model)
- ∂T_out/∂b₀ = 1
- ∂T_out/∂b₁ = 1/√E
Fields§
§inner: &'a dyn FitModelUnderlying transmission model (density parameters only).
inv_sqrt_energies: Vec<f64>Precomputed 1/√E for each energy bin.
b0_index: usizeIndex of b₀ (constant background) in the parameter vector.
b1_index: usizeIndex of b₁ (1/√E background) in the parameter vector.
n_params: usizeTotal parameter count in the wrapped model.
Trait Implementations§
Source§impl<'a> FitModel for TransmissionKLBackgroundModel<'a>
impl<'a> FitModel for TransmissionKLBackgroundModel<'a>
Source§fn evaluate(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
fn evaluate(&self, params: &[f64]) -> Result<Vec<f64>, FittingError>
Evaluate the model for the given parameters. Read more
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>
Optionally provide an analytical Jacobian. Read more
Source§impl<'a> ForwardModel for TransmissionKLBackgroundModel<'a>
impl<'a> ForwardModel for TransmissionKLBackgroundModel<'a>
Auto Trait Implementations§
impl<'a> Freeze for TransmissionKLBackgroundModel<'a>
impl<'a> !RefUnwindSafe for TransmissionKLBackgroundModel<'a>
impl<'a> !Send for TransmissionKLBackgroundModel<'a>
impl<'a> !Sync for TransmissionKLBackgroundModel<'a>
impl<'a> Unpin for TransmissionKLBackgroundModel<'a>
impl<'a> !UnwindSafe for TransmissionKLBackgroundModel<'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