calamari.boundary.BoundaryFit#

class calamari.boundary.BoundaryFit(fit, estimates, sweeps, band, jackknife, comparison, chi_squared_quantile, scatter_below_errors, warnings, params, total=None, model=None)#

Bases: object

One stated model fitted to one criterion’s points, one per sweep, with its diagnostics.

Read sweeps and scatter_below_errors before the parameters: the first says which sweeps the curve rests on and which it does not, and the second whether the error bars describe the scatter at all. The curve is a model of candidate locations under the caller’s assumed form, nothing more.

fit#

The fit (iminuit MIGRAD + HESSE, FT-1), of the location against the held coordinate, weighted by each used point’s error. A failure is fit.success == False, never an exception.

Type:

calamari.fitting.engine.FitResult

estimates#

One row per model parameter: value, hesse_err (canonical), fixed, jackknife_se (the leave-one-sweep-out standard error; NaN unless every refit succeeded), max_abs_shift_sigma and most_influential_sweep_id (from jackknife), and criterion.

Type:

pandas.DataFrame

sweeps#

One row per sweep of the family (SWEEP_COLUMNS), sorted by sweep_id. status is 'used', 'excluded by caller', 'no candidate in window', 'no candidate detected', 'no point given' or 'skipped: <reason>'. The location and its errors are filled only where the sweep gave a point; nothing is imputed. predicted_* is the model at every known held coordinate, including the sweeps without a point, in its own column. residual_* is location minus prediction and pull is that over the fit’s weight (*_err_fit_*). An excluded point’s residual is from the fit made without it.

Type:

pandas.DataFrame

band#

The model with its 1-sigma band on BAND_POINTS values of the held coordinate spanning the used points (no extrapolation): the held column, model_*, model_err_*, lower_*, upper_* (unit suffixes as the location’s), and criterion. It is a band on the MODEL, under its assumptions: the form is right and the errors are right. It is not a band on where the points will fall, and it does not include the form’s own uncertainty. See band_at() for other values.

Type:

pandas.DataFrame

jackknife#

One row per used sweep: that sweep left out and the model refitted (seeded at the full fit). refit is 'ok', 'failed' or 'underdetermined: dof N'; for each free parameter p, its refitted value p and p_shift_sigma, the shift from the full fit in units of the full fit’s HESSE error. A failed refit is kept, with NaN values.

Type:

pandas.DataFrame

comparison#

The stated model and each compare= model fitted to the same points with the same errors: model, role, success, n_free, dof, chi_squared, reduced_chi_squared, aic, bic, delta_aic, delta_bic (compared minus stated: positive favours the stated model), criterion.

Type:

pandas.DataFrame

chi_squared_quantile#

P(chi2_dof <= chi_squared) for this fit’s dof: where the fit’s chi-squared sits in the distribution it would follow if the form and the errors were right. NaN when the fit failed.

Type:

float

scatter_below_errors#

chi_squared_quantile < LOW_CHI2_TAIL: the points scatter about the curve far less than their errors allow. The errors are then overstated – typically a location error floored at the scan’s grid spacing – and the HESSE errors, the band and the information criteria all inherit that (see fit_boundary()).

Type:

bool

warnings#

The messages of the warnings raised for this fit, in order.

Type:

tuple of str

params#

The recipe: model, model_description, criterion, signal (a TransitionResult’s), swept_axis, location, held, source, select (the result’s record for that axis), other_axis_sweep_ids, exclude, errors ('stat' or 'stat+sys'), yerr_sys (whether one was given, its source and its per-sweep values), compare, initial, limits, fixed, band_points, low_chi2_tail, information_criteria, weighting and calamari_version.

Type:

dict

total#

The same fit weighted by the statistical and systematic errors in quadrature, with its own diagnostics, when yerr_sys (or a systematic column) was given; None otherwise. Its own total is None.

Type:

BoundaryFit or None

model#

The fitted model’s definition, for band_at().

Type:

calamari.fitting.models.ModelDefinition

band_at(values)#

The model and its 1-sigma band at chosen values of the held coordinate.

band stops at the used points’ range, deliberately. Beyond it nothing in the points constrains the curve, and the value and band there are the assumed form speaking: two forms that agree across the points can part company quickly outside them. Ask for those values here, where the call says so.

Parameters:

values (ArrayLike) – Values of the held coordinate, in its own unit: H_T (Tesla) for a T-swept fit, T_K (Kelvin) for an H-swept one.

Return type:

DataFrame

Returns:

pandas.DataFrame – Columns as band. All NaN when the fit failed.