Source code for iCalibrationDB.calibration_constant

from .detectors import DetectorTypes
from .util import DictConvertable

[docs]class CalibrationConstant(DictConvertable): """ A calibration constant bound to a detector type """ mandatory = ["flg_auto_approve", "description", "calibration_name", "detector_type_name"] def __init__(self): super(CalibrationConstant, self).__init__() self._datadict["flg_auto_approve"] = True @property def device_type_name(self): """ The device type the constant refers to. Expects an object of type `Detector`. """ det = self._datadict.get("detector_type_name") if det is None: return None return DetectorTypes(det) @device_type_name.setter def device_type_name(self, value): if value and not isinstance(value, (DetectorTypes)): raise ValueError("Expecting Detector object") self._datadict["detector_type_name"] = value.value @device_type_name.deleter def device_type_name(self): del self._datadict["detector_type_name"] @property def name(self): """ The name of the constant """ return self._datadict.get("calibration_name") @name.setter def name(self, value): self._datadict["calibration_name"] = str(value) @name.deleter def name(self): del self._datadict["calibration_name"] @property def description(self): """ A description for the constant """ return self._datadict.get("description") @description.setter def description(self, value): self._datadict["description"] = str(value) @description.deleter def description(self): del self._datadict["description"] @property def auto_approve(self): """ If the constant is auto-approved for good quality """ return self._datadict.get("flg_auto_approve") @auto_approve.setter def auto_approve(self, value): self._datadict["flg_auto_approve"] = bool(value) @auto_approve.deleter def auto_approve(self): del self._datadict["flg_auto_approve"] @property def data(self): """ The constant data itself. Should be a numpy array, usually of dimensions (x, y, memory cell) """ return self._datadict.get("data") @data.setter def data(self, value): self._datadict["data"] = value @data.deleter def data(self): del self._datadict["data"]