pub fn apply_resolution_with_plan(
plan: Option<&ResolutionPlan>,
energies: &[f64],
spectrum: &[f64],
resolution: &ResolutionFunction,
) -> Result<Vec<f64>, ResolutionError>Expand description
Apply resolution broadening, optionally via a pre-built
ResolutionPlan.
When plan is Some(p) and resolution is a tabulated kernel,
p.apply(spectrum) runs the cached per-target broadening inner
loop — the expensive TOF / kernel-interpolation / bracket work
was already captured at plan build time.
When plan is None, or when resolution is Gaussian, the call
forwards to apply_resolution and is byte-identical to the
un-planned path.
§Errors
- Returns the same errors as
apply_resolutionon the non-plan path. - Returns
ResolutionError::LengthMismatchif the plan was built for a different-length grid thanenergies, or ifenergies.len() != spectrum.len(). - Returns
ResolutionError::PlanGridMismatchif the plan was built for a different grid of the same length — the cached(lo_idx, frac, weight)entries encode brackets into the old grid and would silently produce a wrong broadened spectrum if applied.