Skip to content
Snippets Groups Projects
Commit 963331af authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Fix passing through aggregators when selecting & merging

parent c2fa065a
No related branches found
No related tags found
1 merge request!885Revised CalCat API
...@@ -246,17 +246,15 @@ class CalibrationData(Mapping): ...@@ -246,17 +246,15 @@ class CalibrationData(Mapping):
if cal_type in calibrations if cal_type in calibrations
} }
# TODO: missing for some modules? # TODO: missing for some modules?
return type(self)(d) return type(self)(d, self.aggregators)
def select_modules(self, *aggregators): def select_modules(self, *aggregators):
return type(self)( return type(self)({
{
cal_type: mcv.select_modules(*aggregators).constants cal_type: mcv.select_modules(*aggregators).constants
for (cal_type, mcv) in self.constant_groups.items() for (cal_type, mcv) in self.constant_groups.items()
} }, sorted(aggregators))
)
def merge(self, *others: Sequence["CalibrationData"]) -> "CalibrationData": def merge(self, *others: "CalibrationData") -> "CalibrationData":
d = {} d = {}
for cal_type, mcv in self.constant_groups.items(): for cal_type, mcv in self.constant_groups.items():
d[cal_type] = mcv.constants.copy() d[cal_type] = mcv.constants.copy()
...@@ -264,7 +262,11 @@ class CalibrationData(Mapping): ...@@ -264,7 +262,11 @@ class CalibrationData(Mapping):
if cal_type in other: if cal_type in other:
d[cal_type].update(other[cal_type].constants) d[cal_type].update(other[cal_type].constants)
return type(self)(d) aggregators = set(self.aggregators)
for other in others:
aggregators.update(other.aggregators)
return type(self)(d, sorted(aggregators))
class ConditionsBase: class ConditionsBase:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment