calamari.repeats#
Repeat-measurement grouping and aggregation.
combine() and group_consecutive() operate on arrays;
repeat_groups() and aggregate_repeats() operate on measurements.
Measurements report repeat counts, but aggregation requires an explicit call because
it changes observations and their uncertainties.
Grouping#
Group consecutive observations within each measurement family, preserving separate
sweep branches. Families come from calamari.measurement.row_families(), which
uses populated channels when transport metadata is absent. Ambiguous rows are refused
when several families are present.
Each family independently resolves its grouping mechanism (instrument counter or
setpoint tolerance), tolerance scales and separation check. Every proposed group must
agree in setpoint coordinates or raise
RepeatGroupError. Tolerance grouping also requires
separated within-group and between-group steps; see _check_separation().
Uncertainties#
The default combines repeats by inverse-variance weighting with Birge-scaled error,
sigma_int * max(1, sqrt(chi2/nu)). error='internal' and error='external'
are explicit alternatives. The default has upward bias for small groups; see
combine() for its assumptions and the two-repeat case.
For repeats at identical x with fixed standard errors, the original weighted least-squares cost and that of the combined mean with internal propagated error differ only by a parameter-independent term. Parameter estimates and Hessians therefore agree. Setpoint jitter, averaging x or changing the error model can break this equivalence. Record aggregation and weighting choices; they also affect detection and presentation.
Grouping and combination are deterministic. Recover constituent rows by rerunning
repeat_groups() on AggregatedMeasurement.source with its recorded settings.
Module attributes
Absolute temperature span (K) allowed within a proposed repeat group. |
|
Absolute field span (Oe) allowed within a proposed repeat group. |
|
AC drive amplitude tolerance, relative. |
|
a frequency is a magnitude, not an offset, so a relative tolerance is the meaningful one. |
|
Sanity bound on how many rows one repeat group may hold. |
Functions
Collapse each repeat group into a single row. |
|
Combine repeat measurements of one quantity into a single point. |
|
Group consecutive rows that share every key to within tolerance. |
|
Find the repeat groups in a measurement, without combining anything. |
Classes
A |
|
One repeat group reduced to a single value, with its diagnostics. |