From c6659def2bae86f075ab46f51c92926311dabb78 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Tue, 19 Dec 2023 17:05:54 +0000 Subject: [PATCH] Remove CalibrationData.load_all() & .select_calibrations() for now --- src/cal_tools/calcat_interface2.py | 36 ------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/cal_tools/calcat_interface2.py b/src/cal_tools/calcat_interface2.py index 084f194b0..a2af18146 100644 --- a/src/cal_tools/calcat_interface2.py +++ b/src/cal_tools/calcat_interface2.py @@ -524,20 +524,6 @@ class CalibrationData(Mapping): mods.intersection_update(self[cal_type].constants) return self.select_modules(aggregator_names=mods) - def select_calibrations(self, calibrations, require_all=True): - if require_all: - missing = set(calibrations) - set(self.constant_groups) - if missing: - raise KeyError(f"Missing calibrations: {', '.join(sorted(missing))}") - - d = { - cal_type: mcv.constants - for (cal_type, mcv) in self.constant_groups.items() - if cal_type in calibrations - } - # TODO: missing for some modules? - return type(self)(d, self.aggregators) - def select_modules( self, module_nums=None, *, aggregator_names=None, qm_names=None ) -> "CalibrationData": @@ -570,28 +556,6 @@ class CalibrationData(Mapping): return type(self)(d, sorted(aggregators)) - def load_all(self, caldb_root=None): - res = {} - - const_load_mp = psh.ProcessContext(num_workers=24) - keys = [] - for cal_type, mcv in self.constant_groups.items(): - res[cal_type] = {} - for module in mcv.aggregators: - dset = mcv.constants[module].dataset_obj(caldb_root) - res[cal_type][module] = const_load_mp.alloc( - shape=dset.shape, dtype=dset.dtype - ) - keys.append((cal_type, module)) - - def _load_constant_dataset(wid, index, key): - cal_type, mod = key - dset = self[cal_type].constants[mod].dataset_obj(caldb_root) - dset.read_direct(res[cal_type][mod]) - - const_load_mp.map(_load_constant_dataset, keys) - return res - class ConditionsBase: calibration_types = {} # For subclasses: {calibration: [parameter names]} -- GitLab