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

Remove CalibrationData.load_all() & .select_calibrations() for now

parent ae582d37
No related branches found
No related tags found
1 merge request!885Revised CalCat API
...@@ -524,20 +524,6 @@ class CalibrationData(Mapping): ...@@ -524,20 +524,6 @@ class CalibrationData(Mapping):
mods.intersection_update(self[cal_type].constants) mods.intersection_update(self[cal_type].constants)
return self.select_modules(aggregator_names=mods) 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( def select_modules(
self, module_nums=None, *, aggregator_names=None, qm_names=None self, module_nums=None, *, aggregator_names=None, qm_names=None
) -> "CalibrationData": ) -> "CalibrationData":
...@@ -570,28 +556,6 @@ class CalibrationData(Mapping): ...@@ -570,28 +556,6 @@ class CalibrationData(Mapping):
return type(self)(d, sorted(aggregators)) 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: class ConditionsBase:
calibration_types = {} # For subclasses: {calibration: [parameter names]} calibration_types = {} # For subclasses: {calibration: [parameter names]}
......
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