pub struct CountsModel<'a> {
pub transmission_model: &'a dyn FitModel,
pub flux: &'a [f64],
pub background: &'a [f64],
pub n_params: usize,
}Expand description
Fixed-flux counts-domain forward model: Y_model = flux × T_model(θ) + background.
Retained for the research Fisher helper, not for production fitting.
The production counts-KL dispatch (SolverConfig::PoissonKL on
InputData::Counts / InputData::CountsWithNuisance) goes through
the joint-Poisson conditional-binomial-deviance path in
crate::joint_poisson. CountsModel and
CountsBackgroundScaleModel below are consumed only by
nereids_pipeline::pipeline::evaluate_jacobian_and_fisher (the
Fisher-info research helper used by the spatial-regularization
epic #394) and by this module’s #[cfg(test)] tests. They assume
the caller has pre-computed flux = c · O (i.e. c is baked into
flux — a convention that proved error-prone for
end users, which is precisely why the production path no longer
uses this struct).
§Physical count-response contract
This low-level wrapper cannot inspect transmission_model to determine how
instrument resolution was applied. Its output must already be the
physically valid effective sample/open count response. With response
operator R and incident spectrum Φ, the required ratio is
T_eff = R[Φ · T] / R[Φ].A post-hoc broadened transmission R[T] is not a valid substitute and
must never be wrapped here as though it were. In particular, do not
directly wrap a resolution-bearing
TransmissionFitModel,
because that model returns R[T]. An ordinary transmission is valid when
resolution is disabled, and a custom inner model that already returns the
exact effective ratio is also valid. Otherwise, model the open and sample
response arms separately or call the guarded pipeline, which rejects
unsupported counts-plus-resolution combinations. When resolution is
active, flux must be the matching resolved open-arm response R[Φ].
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 effective count-ratio model.
See the struct-level physical count-response contract. In particular,
this must not be a post-hoc broadened transmission R[T].
flux: &'a [f64]Open-arm flux response (counts per bin, 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> UnsafeUnpin 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
§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