calamari.fitting.breakpoint#

Fit a sharp or rounded change of slope and compare it with a straight line.

fit_breakpoint() fits segmented_linear or bent_cable within a caller-specified range. It reports model comparisons, HESSE errors and a profile of the breakpoint location. The straight-line comparison helps assess whether the data support a break; information-criterion differences are not p-values.

A sharp-corner fit can depend on the chosen range when the feature is rounded. The bent-cable model allows symmetric rounding, but its inferred centre can still depend on model mismatch or asymmetric rounding. Compare results over physically justified ranges with fit_windows(). The function reports unresolved rounding rather than selecting a model for you.

Module attributes

MIN_POINTS

The fewest points fit_breakpoint() accepts: MIN_POINTS_PER_SEGMENT strictly on each side of a corner that is itself a sample, so the profile over sample positions has at least one candidate.

Functions

fit_breakpoint

Fit two lines meeting at a corner, and compare them with one straight line.

Classes

BreakpointResult

The outcome of fit_breakpoint(): a corner, and whether the data want one.