from .operating_condition import OperatingCondition
from .util import DictConvertable
[docs]class DetectorCondition(DictConvertable):
"""
Detector condition's group operating conditions and additional meta-data.
"""
mandatory = ["name", "flg_available", "parameters"]
def __init__(self):
super(DetectorCondition, self).__init__()
self._datadict["flg_available"] = True
self._datadict["parameters"] = []
@property
def name(self):
"""
The name of the detector condition, will be used in data base
"""
return self._datadict.get("name")
@name.setter
def name(self, value):
self._datadict["name"] = str(value)
@name.deleter
def name(self):
del self._datadict["name"]
@property
def available(self):
"""
Internal parameter, should be left at the default (True).
"""
return self._datadict.get("flg_available")
@available.setter
def available(self, value):
self._datadict["flg_available"] = bool(value)
@available.deleter
def available(self):
del self._datadict["flg_available"]
@property
def description(self):
"""
A description for this detector condition.
"""
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 parameters(self):
"""
The operating parameters of the detector at this condition.
Expects a list of `OperatingConditions`.
"""
return self._datadict.get("parameters")
@parameters.setter
def parameters(self, value):
if not all(isinstance(oc, OperatingCondition) for oc in value):
raise ValueError("Expecting list of OperatingConditions")
self._datadict["parameters"] = value
@parameters.deleter
def parameters(self):
del self._datadict["parameters"]