Skip to main content

fit_with_calibrant

Function fit_with_calibrant 

Source
pub fn fit_with_calibrant(
    sample: &SampleSpectrum,
    calibrant: &CalibrantSpectrum,
    flight_path_m: f64,
    delta_t_init: f64,
    delta_l_init: f64,
) -> Result<JointFitResult, PipelineError>
Expand description

Fit transmission and the calibrant against one shared Gaussian resolution.

initial_densities seeds the sample’s densities and temperature_k its temperature; fit_temperature decides whether that temperature is free. delta_t_init / delta_l_init seed the shared resolution — the values a standalone calibration returned are the natural starting point.

§Errors

PipelineError::ShapeMismatch when a spectrum’s arrays disagree in length, PipelineError::InvalidParameter when a grid is empty, an uncertainty is not positive, a density on either arm is not finite and positive, or a temperature or width seed falls outside the box every fit path shares, and PipelineError::Fitting when the optimizer cannot run.