calamari.repeats.aggregate_repeats#
- calamari.repeats.aggregate_repeats(measurement, *, error='birge', t_tol_K=0.025, h_tol_Oe=1.0, drive_rtol=0.001, frequency_rtol=0.001, max_repeats=32, use_counter=True)#
Collapse each repeat group into a single row.
Returns an
AggregatedMeasurement– a realMeasurementsubclass, so every accessor, plot helper, fit and transition detector takes it unchanged.- Parameters:
measurement (
Measurement) – The file to aggregate. Aggregating an already-aggregated measurement raises: after one pass theMeasurement Numbercolumn holds first-values, so a second pass would silently fall through to the tolerance path.error (
str) – Which uncertainty to write into each error column; seecombine(), including then = 2caveat on the default.t_tol_K (
float) – Passed torepeat_groups().h_tol_Oe (
float) – Passed torepeat_groups().drive_rtol (
float) – Passed torepeat_groups().frequency_rtol (
float) – Passed torepeat_groups().max_repeats (
int) – Passed torepeat_groups().use_counter (
bool) – Passed torepeat_groups().
- Return type:
- Returns:
- Raises:
RepeatGroupError – From
repeat_groups(), or if a provenance column name collides with a column the file already has.RepeatWeightError – From
combine().TypeError – If
measurementis already anAggregatedMeasurement.
Notes
What happens to each column:
A quantity with a paired error column (DC moment, chi’/chi’’, the AC moment components, AC moment/susceptibility amplitude) is combined by
combine(), and both its value and its error column are rewritten. A quantity with no error column in the file is averaged unweighted.Setpoint columns (temperature, field, AC frequency, AC drive) get the unweighted group mean.
Min./Max.columns get the min of mins and the max of maxes, which is what those columns mean.Everything else –
Time Stamp,Range, the* Status (code)columns,Measure Count,Transport Action,Measurement Number,Map 01..``Map 16`` – keeps the first value of its group. Notably that includesAC Phase, which is an angle on a -90..270 range where a naive mean is wrong near the wrap; averaging it would be worse than not.
Two provenance columns are added per combined quantity,
X [n]andX [Birge]. They are per quantity rather than per group on purpose: a group’s row count is not the number of points that went into a given column, and in an interleaved AC/DC file that is the normal case rather than an anomaly.