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 for Measurement inputs (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 in x up 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 in x up 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 and METHODS). No default here: the scan-kind defaults live in detect_transitions(), which knows what the data is. Each method has its own sign vocabulary 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 forms z = x*y on the prepared points, resamples and differentiates z with the same Savitzky-Golay window as everything else, and searches dz/dx exactly as 'derivative' searches dy/dx. It needs absolute temperature, so it requires x_unit='K' and every x > 0, and raises otherwise. Its hits are never grouped with the other methods: each is its own candidate with n_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 under CRITERION_PRIORITY would 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, for z (see noise), and recorded in params['fisher_noise']; its sweep_range_over_noise is z’s range over that sigma, and its raw_strength_unit is y·K/K (the prominence of d(yT)/dT, in y’s own unit once the Kelvins cancel).

  • x_name (str) – Name the output’s location columns (e.g. x_name='T', x_unit='K' gives T_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' gives T_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 on y (the instrument’s, where the file carries them). Absent, the noise level falls back to a second-difference estimate; either way params['noise_source'] records which was used – see noise= 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 in params.

  • polyorder (int) – Savitzky-Golay polynomial order (default 3).

  • prominence_fraction (float) – Detection floor – see DEFAULT_PROMINENCE_FRACTION.

  • criterion (str | None) – Method whose member reports a grouped feature’s coordinate, promoted to the front of CRITERION_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).

  • noise (str | float) –

    Which noise estimate scores significance against. 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 exceeds NOISE_RATIO_WARN times the scatter estimate, it warns rather than using it silently. 'instrument' requires a usable error column and raises ValueError naming noise='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, in y’s own units. Recorded in params as noise, noise_source ('instrument'/'scatter'/ 'caller'), noise_sigma, noise_sigma_instrument, noise_sigma_scatter and noise_ratio.

    With 'fisher' the same choice is resolved a second time, for z = x*y, and recorded with the same keys under params['fisher_noise']; the signal’s own record above is left exactly as it would be without 'fisher'. The instrument estimate is the median of y_err*x (each point’s error scales with its own temperature) and the scatter estimate is the second-difference estimate of z itself. A caller’s float is a sigma in y’s units, so for z it becomes noise * median(x) – the same median the instrument estimate takes – rather than being read, wrongly, as a sigma in y·K. The record keeps the float as passed under noise and the converted value under noise_sigma.

Return type:

TransitionResult

Returns:

TransitionResult – With location columns named from x_name/x_unit. With 'fisher', curves also carries 'yT' (the smoothed x*y) and 'dyT_dT' (its derivative, the representation the Fisher extrema were found in).

Raises:

ValueError – For unknown methods or criterion (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).