calamari.transitions.find_transitions#
- calamari.transitions.find_transitions(x, y, *, methods, x_name='x', x_unit='', y_err=None, smooth_window=None, polyorder=3, prominence_fraction=0.05, criterion=None, label='find_transitions', noise='auto')#
Detect transition candidates in one 1-D sweep given as arrays.
The array-level core under
detect_transitions(); use that forMeasurementinputs (it resolves the swept axis, the fixed coordinate, units, channels and refusals). This level exists for arbitrary(x, y)pairs.- Parameters:
x (
Sequence[float]) – The swept variable and the signal. The sweep must be monotonic inxup to setpoint jitter – a hysteresis loop is refused by name (take a branch first).y (
Sequence[float]) – The swept variable and the signal. The sweep must be monotonic inxup to setpoint jitter – a hysteresis loop is refused by name (take a branch first).methods (
str|Sequence[str]) –Which detectors to run:
'peak','derivative','kink','onset','fisher'(see the module docstring andMETHODS). No default here: the scan-kind defaults live indetect_transitions(), which knows what the data is. Each method has its ownsignvocabulary in the output –'max'/'min'for a peak,'rise'/'fall'for a derivative extremum,'up'/'down'for a kink (the slope increasing or decreasing through it),'max'/'min'of d(yT)/dT for'fisher'– because a shared one would imply that a maximum and a rising slope are the same statement about the curve. Which hits are then merged into one candidate is exact geometry, described in full in_group_detections(): a cusp keeps its derivative flanks and the curvature extrema those flanks bound, a rounded step keeps the two curvature shoulders either side of its midpoint, and a slope change with neither is reported once, on its own.'onset'searched WITHOUT'derivative'reports the onsets alone: they are built from derivative extrema, but those parent rows are not in the output, so each onset is its own candidate.'fisher'is Fisher’s criterion: extrema of d(yT)/dT, which for a simple antiferromagnet tracks the magnetic specific heat (Fisher, Philos. Mag. 7, 1731 (1962)). It formsz = x*yon the prepared points, resamples and differentiateszwith the same Savitzky-Golay window as everything else, and searchesdz/dxexactly as'derivative'searches dy/dx. It needs absolute temperature, so it requiresx_unit='K'and everyx > 0, and raises otherwise. Its hits are never grouped with the other methods: each is its own candidate withn_methods = 1, listed after the grouped candidates, in order of location. That is deliberate. The d(yT)/dT maximum sits systematically below the chi cusp, by an amount that depends on the material and on the smoothing (a smoothed, lopsided peak and the vertex fit that locates it both lean away from a steep drop at T_N), so merging the two underCRITERION_PRIORITYwould hide that offset, or report one criterion’s temperature under the other’s name – the failure the priority exists to prevent. It is a different criterion, not a more sensitive one: nothing here claims it finds a boundary the cusp misses. Its noise is resolved separately, forz(seenoise), and recorded inparams['fisher_noise']; itssweep_range_over_noiseisz’s range over that sigma, and itsraw_strength_unitisy·K/K(the prominence of d(yT)/dT, iny’s own unit once the Kelvins cancel).x_name (
str) – Name the output’s location columns (e.g.x_name='T',x_unit='K'givesT_K/T_K_err): DM-2’s the-unit-is-in- the-name rule applied to a caller-defined axis.x_unit (
str) – Name the output’s location columns (e.g.x_name='T',x_unit='K'givesT_K/T_K_err): DM-2’s the-unit-is-in- the-name rule applied to a caller-defined axis.y_err (
Sequence[float] |None) – Per-point 1-sigma errors ony(the instrument’s, where the file carries them). Absent, the noise level falls back to a second-difference estimate; either wayparams['noise_source']records which was used – seenoise=for how that choice is made and overridden.smooth_window (
float|None) – Savitzky-Golay window in x-units (not points). Default: 11 grid points, recorded as the resolved physical width inparams.polyorder (
int) – Savitzky-Golay polynomial order (default 3).prominence_fraction (
float) – Detection floor – seeDEFAULT_PROMINENCE_FRACTION.criterion (
str|None) – Method whose member reports a grouped feature’s coordinate, promoted to the front ofCRITERION_PRIORITY.criterion='kink'reports a group’s own slope change: a lone kink, or a cusp’s central curvature extremum ('down'under a maximum,'up'over a minimum, between its derivative flanks). It never reports a cusp’s flank companions or a rounded step’s shoulders, which are curvature extrema too but sit off the feature, and on a cusp with sharp feet are stronger than its centre. A group with no kink of its own reports what it would under the default order: the peak for a cusp, the midpoint (or its onset) for a step.label (
str) – Name used in error messages (the measurement path, at the measurement level).Which noise estimate scores
significanceagainst. The instrument’s reported per-point errors and the observed point-to-point scatter can describe different uncertainty contributions. A discrepancy affects the diagnostic candidate score; neither source is automatically a calibrated noise model.'auto'(default) prefers the instrument column when usable (>= 3 finite, positive values), else the second-difference scatter estimate; if it picks the instrument column and that column’s sigma exceedsNOISE_RATIO_WARNtimes the scatter estimate, it warns rather than using it silently.'instrument'requires a usable error column and raisesValueErrornamingnoise='scatter'as the fix when there is none.'scatter'always uses the second-difference estimate, ignoring any error column. A positive float supplies the sigma directly, iny’s own units. Recorded inparamsasnoise,noise_source('instrument'/'scatter'/'caller'),noise_sigma,noise_sigma_instrument,noise_sigma_scatterandnoise_ratio.With
'fisher'the same choice is resolved a second time, forz = x*y, and recorded with the same keys underparams['fisher_noise']; the signal’s own record above is left exactly as it would be without'fisher'. The instrument estimate is the median ofy_err*x(each point’s error scales with its own temperature) and the scatter estimate is the second-difference estimate ofzitself. A caller’s float is a sigma iny’s units, so forzit becomesnoise * median(x)– the same median the instrument estimate takes – rather than being read, wrongly, as a sigma iny·K. The record keeps the float as passed undernoiseand the converted value undernoise_sigma.
- Return type:
- Returns:
TransitionResult– With location columns named fromx_name/x_unit. With'fisher',curvesalso carries'yT'(the smoothedx*y) and'dyT_dT'(its derivative, the representation the Fisher extrema were found in).- Raises:
ValueError – For unknown
methodsorcriterion(criterion='fisher'included: Fisher hits are never grouped, so there is nothing for it to take priority over); for'fisher'on an axis that is not absolute temperature; and for a sweep that cannot be searched (too few points, not monotonic, systematically repeated setpoints).