calamari.repeats.AggregatedMeasurement#
- class calamari.repeats.AggregatedMeasurement(path, data_format, measurement_type, file_role, title, header=dict(), data=DataFrame(), moment_base=None, source=None, grouped_by='', grouped_by_family=dict(), error_rule='', params=dict())#
Bases:
MeasurementA
Measurementwhose repeats are combined.Produced by
aggregate_repeats(), never constructed directly. It is a realMeasurementsubclass, and deliberately so: because aggregation writes the combined values back under the file’s own column spellings, every accessor –moment_emu,moment_err_emu,chi_real,field_oe, the whole unit-resolution machinery – is inherited and simply works, and every consumer incalamari.plot,calamari.fitting,calamari.transitionsandcalamari.sweepstakes one unchanged. Not one accessor is overridden.restrictandwith_momentreturn anAggregatedMeasurementtoo, with the provenance intact, because they derive viadataclasses.replace(), which constructstype(self). The per-quantity[n]and[Birge]diagnostics are ordinary columns rather than parallel arrays for the same reason:restrictsubsets them correctly with no code of its own.- data#
Not the raw table the base class documents. This is the one derived case in calamari: the value and error columns hold combined numbers under the file’s original column names, so
data['Moment (emu)']is no longer what the instrument wrote. The unaggregated table is onsource. Two provenance columns per combined quantity,X [n]andX [Birge], are added.- Type:
- source#
The measurement this was aggregated from. Constituent rows are recoverable by re-running
repeat_groups()on it withparams, since grouping is deterministic – which is why no row-membership bookkeeping is stored here.Note this is the original, always: after
restrict()it still refers to the unfiltered measurement.
- grouped_by#
Which mechanism grouped the rows:
'measurement-number','setpoint-tolerance', or'empty'when there was nothing to group – a file with no rows, or one holding only housekeeping rows, which are carried through as themselves either way.Mechanisms are chosen per family, so a combined run whose AC rows carry a usable
Measurement Numberand whose VSM rows do not reports the composite'VSM:setpoint-tolerance+AC:measurement-number', inFAMILY_ORDER. This attribute followsmeasurement_typeexactly: one plain name while the families agree – which is every single-family file – and a composite only when they genuinely differ. Branch ongrouped_by_familyrather than parsing it.- Type:
- grouped_by_family#
The same answer keyed by measurement family,
{'VSM': 'setpoint-tolerance', 'AC': 'measurement-number'}. This is the structured form ofgrouped_by, and the one to read: which mechanism grouped a given family decides how much its[n]column can be trusted, and a file can now answer differently for each.Empty when
grouped_byis'empty'. A file calamari could place in no family at all – one with no moment or susceptibility column populated anywhere – keys its single population as'unknown'.- Type:
- params#
The tolerances and options actually used, not merely the mechanism’s name – without them, “re-running the grouping reproduces the groups” would only hold for default calls.
- Type:
Notes
The error columns carry two conventions at once after aggregation. A group of one keeps whatever the instrument wrote, including its “0 means a single scan, not exact” zero (see
moment_err_emu); a group of two or more holds a combined, possibly Birge-inflated error. The[n]column is what tells the two apart, and is the thing to check before using an error column as a fit weight.