calamari.fitting.breakpoint.BreakpointResult#
- class calamari.fitting.breakpoint.BreakpointResult(segmented, linear, x_break, x_break_err, slope_below, slope_below_err, slope_above, slope_above_err, slope_change, slope_change_err, delta_aic, delta_bic, rss_linear, rss_segmented, profile, profile_threshold, profile_interval, n_points, n_below, n_above, identified, warnings, params, model='segmented_linear', bent_cable=None, gamma=nan, gamma_err=nan, rss_bent_cable=nan, delta_aic_vs_segmented=nan, delta_bic_vs_segmented=nan)#
Bases:
objectThe outcome of
fit_breakpoint(): a corner, and whether the data want one.Read
identified(anddelta_bic) beforex_break. A corner fitted to data with no break still has a value and a small HESSE error; neither means anything unless the comparison favours the break.The corner model is
model. Every field describes that model’s fit, exceptsegmentedandrss_segmented, which always describe the sharp corner. The fields frombent_cableonwards are filled only formodel="bent_cable", and keep their defaults (Noneor NaN) for the default"segmented_linear".- segmented#
The
segmented_linearfit, the sharp corner. Draw it withcalamari.plot.plot_fit(), as any other fit. Withmodel="bent_cable"it is the sharp-corner comparison.
- linear#
The
linearfit to the same points, the no-break alternative.
- x_break, x_break_err
The fitted corner and its HESSE error, the canonical uncertainty (FT-1). For the bent cable, the centre of the bend, where its two arms meet when extended. NaN if the fit of
modelfailed.- Type:
- slope_below, slope_below_err
Slope below the corner, with its HESSE error.
- Type:
- slope_above, slope_above_err
Slope above the corner,
slope_below + slope_change. Its error is propagated through the covariance byderive(), so the correlation between the two fitted slopes counts.- Type:
- slope_change, slope_change_err
The change of slope across the corner, with its HESSE error.
- Type:
- delta_aic, delta_bic
Information criterion of the straight line minus that of the broken one (the
modelfitted), from ordinary least squares (seefit_breakpoint()). Positive means the break is preferred. Descriptive, not a test.- Type:
- rss_linear, rss_segmented
The ordinary (unweighted) least-squares residual sums of squares the criteria are computed from, of the line and of the sharp corner.
rss_segmentedis minimised exactly over the corner within the limits, not only on the sample grid.- Type:
- profile#
Columns
x_breakandrss: the unweighted residual sum of squares with the corner held at each sample position inside the limits (the grid the model’s guess searches), the other parameters solved exactly. For display: plotrssagainstx_breakwithprofile_thresholdas a horizontal line. For the bent cable, the half-width is profiled too (minimised at each corner, not held), and a third columngammaholds where that minimum fell.- Type:
- profile_threshold#
The RSS level that defines
profile_interval,rss * exp(1 / n_points), whererssis the minimum formodel(rss_segmentedorrss_bent_cable).- Type:
- profile_interval#
(lower, upper): the smallest interval holding every corner whose profiled RSS is at or underprofile_threshold, found exactly between sample positions. An end that does not come back above the threshold inside the limits is-infor+inf: the data do not bound the corner on that side. Display-only, with the status MINOS has under FT-1: it is not a calibrated confidence interval (seefit_breakpoint()), andx_break_errstays canonical.
- n_points, n_below, n_above
Points fitted, and how many lie strictly below and strictly above the fitted corner (zero each if the segmented fit failed).
- Type:
- identified#
Trueonly when the fit ofmodeland the line both converged,delta_bic > 0, and the corner is clear of its limits by more than its HESSE error. For the bent cable, also only when each straight arm keeps at least three points outside the bend. WhenFalse,warningssays why. A bend whose width is not resolved (seegamma) warns but does not unset it: the corner is still located, and the sharp one describes it as well.- Type:
- warnings#
The messages of the warnings
fit_breakpoint()raised, in order.
- params#
The recipe:
'model','limits'(the(lower, upper)bounds used on the corner),'limits_given'(whether the caller set them),'yerr'('none','scalar'or'array'),'information_criteria'and'profile_interval'(text naming the construction of each) and'calamari_version'. For the bent cable, also'gamma_limits', the bounds used on the half-width.- Type:
- bent_cable#
The
bent_cablefit;Noneunless it was the model. Draw it withcalamari.plot.plot_fit()besidesegmented.- Type:
- gamma, gamma_err
The half-width of the bend and its HESSE error, in the units of
x. It is bounded below at half the median spacing ofx, the narrowest bend the sampling resolves (seeBENT_CABLE_GAMMA_FLOOR_SPACINGS), and a value within its error of that bound means the corner is sharp at this resolution. NaN unless the bent cable was fitted and converged.- Type:
- rss_bent_cable#
The bent cable’s unweighted least-squares residual sum of squares, the smaller of the profiled minimum and the fitted curve’s own RSS.
- Type:
- delta_aic_vs_segmented, delta_bic_vs_segmented
Information criterion of the sharp corner minus that of the bent cable, on the same points, as for
delta_bic. Positive means the rounded corner is preferred to the sharp one. Descriptive, not a test; NaN unless the bent cable was fitted.- Type: