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 real Measurement subclass, so every accessor, plot helper, fit and transition detector takes it unchanged.

Parameters:
Return type:

AggregatedMeasurement

Returns:

AggregatedMeasurement

Raises:

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 includes AC 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] and X [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.