prsctrl.measurement.settings.LedSettings#
- class LedSettings(mode: str = 'TTL', current_A: float = 0.1)[source]#
Bases:
SettingsClassMethods
Convenience wrapper for dataclasses.asdict(self)
Recursively construct a SettingsClass from a dictionary.
Attributes
- __annotations__ = {'current_A': <class 'float'>, 'mode': <class 'str'>}#
- __dataclass_fields__ = {'current_A': Field(name='current_A',type=<class 'float'>,default=0.1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'mode': Field(name='mode',type=<class 'str'>,default='TTL',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}#
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
- __dict__ = mappingproxy({'__module__': 'prsctrl.measurement.settings', '__firstlineno__': 106, '__annotations__': {'mode': <class 'str'>, 'current_A': <class 'float'>}, 'mode': 'TTL', 'current_A': 0.1, 'apply': <function LedSettings.apply>, '__static_attributes__': (), '__doc__': "LedSettings(mode: str = 'TTL', current_A: float = 0.1)", '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'mode': Field(name='mode',type=<class 'str'>,default='TTL',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'current_A': Field(name='current_A',type=<class 'float'>,default=0.1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function LedSettings.__init__>, '__repr__': <function LedSettings.__repr__>, '__eq__': <function LedSettings.__eq__>, '__match_args__': ('mode', 'current_A')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 106#
- __hash__ = None#
- __init__(mode: str = 'TTL', current_A: float = 0.1) None#
- __match_args__ = ('mode', 'current_A')#
- __module__ = 'prsctrl.measurement.settings'#
- __or__(other)#
Merge with another settings class or a dictionary.
- __replace__(**changes)#
- __repr__()#
Return repr(self).
- __static_attributes__ = ()#
- __weakref__#
list of weak references to the object
- apply(device: LedController)[source]#
- as_dict() dict#
Convenience wrapper for dataclasses.asdict(self)
- current_A: float = 0.1#
- classmethod from_dict(data: dict)#
Recursively construct a SettingsClass from a dictionary. If the value of a field is another SettingsClass, from_dict will be called for that field as well. Handled are: - SettingsClass - list[SettingsClass] - dict[<any>, SettingsClass] - all of the above as Optional
- Raises:
ValueError – If data contains a value that has the wrong type for the field of cls (ONLY if the type is a subclass of SettingsClass! Other types are not enforced)
KeyError – If data contains a key that is not a field name of cls
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- mode: str = 'TTL'#
- save_yaml(yaml_path: str)#