cal_entries¶
-
ndmapper.calibrations.cal_entries(cal_dict, cal_type, reference=None)[source] [edit on github]¶ Extract entries of a specified type from the ‘calibrations’ section of a calibration dictionary (typically for iterating over and processing calibrations of a given type).
This could also be done by the user in 1-2 lines of code, but involves some nested loops or (in)comprehensions that are less user-readable than a function call (to avoid duplication of type information in calibration dictionary, which would then have to be kept synchronized).
Parameters: cal_dict :
dictA dictionary of calibration files & associations, in the format produced by
init_cal_dict()orservices.look_up_cals().cal_type :
strType of calibration to be looked up (matching a type name in the ‘associations’ sub-dict).
reference :
strortupleofstr, optionalOne or more filenames with which matching calibrations must be associated, to limit the selection. By default, all available calibrations of type
cal_typeare selected.Returns: A tuple of (key, value) tuple pairs from the dictionary, where each first element is a calibration name label and each second element a list of constituent filenames. These are the
items()of the input ‘calibrations’ sub-dict that matchcal_type(and, if specified,reference). The result can be iterated over directly, for processing each entry in turn, or converted withdict()to reproduce the appropriate subset ofcal_dict['calibrations'].