prsctrl.measurement.settings.MonochromatorSettings#

class MonochromatorSettings(resolution_nm: float = 1.0, resolution_eV: float = -1)[source]#

Bases: SettingsClass

Monochromator settings, to apply a bandwidth/resolution

Methods

apply

as_dict

Convenience wrapper for dataclasses.asdict(self)

from_dict

Recursively construct a SettingsClass from a dictionary.

load_yaml

save_yaml

Attributes

resolution_eV

Resolution in eV.

resolution_nm

Resolution in nm.

__annotations__ = {'resolution_eV': <class 'float'>, 'resolution_nm': <class 'float'>}#
__dataclass_fields__ = {'resolution_eV': Field(name='resolution_eV',type=<class 'float'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'resolution_nm': Field(name='resolution_nm',type=<class 'float'>,default=1.0,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__': 160, '__annotations__': {'resolution_nm': <class 'float'>, 'resolution_eV': <class 'float'>}, '__doc__': '\nMonochromator settings, to apply a bandwidth/resolution\n', 'resolution_nm': 1.0, 'resolution_eV': -1, 'apply': <function MonochromatorSettings.apply>, '__static_attributes__': (), '__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__': {'resolution_nm': Field(name='resolution_nm',type=<class 'float'>,default=1.0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'resolution_eV': Field(name='resolution_eV',type=<class 'float'>,default=-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 MonochromatorSettings.__init__>, '__repr__': <function MonochromatorSettings.__repr__>, '__eq__': <function MonochromatorSettings.__eq__>, '__match_args__': ('resolution_nm', 'resolution_eV')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 160#
__hash__ = None#
__init__(resolution_nm: float = 1.0, resolution_eV: float = -1) None#
__match_args__ = ('resolution_nm', 'resolution_eV')#
__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: Monochromator)[source]#
as_dict() dict#

Convenience wrapper for dataclasses.asdict(self)

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'>)#
resolution_eV: float = -1#

Resolution in eV. Will be applied if > 0.

resolution_nm: float = 1.0#

Resolution in nm. Will be applied if resolution_eV < 0.

save_yaml(yaml_path: str)#