pub fn levenberg_marquardt_with_mask(
model: &dyn FitModel,
y_obs: &[f64],
sigma: &[f64],
params: &mut ParameterSet,
config: &LmConfig,
active_mask: Option<&[bool]>,
) -> Result<LmResult, FittingError>Expand description
Run the Levenberg-Marquardt optimizer with an optional per-bin active mask (SAMMY EMIN/EMAX-equivalent fit-energy-range restriction).
When active_mask is Some(m):
- bins where
m[i]isfalseare excluded from χ² and the normal equations (weight zeroed before assembly), so they contribute nothing to the gradient or Hessian; - the model is still evaluated on the full grid so resolution broadening at the boundaries of the active region is correct;
dof = n_active − n_freewheren_activeis the count of active bins.
When active_mask is None, behaviour is identical to
levenberg_marquardt (all bins active).