spvctrl.measurement.settings.OpoSettings#
- class OpoSettings(wavelength_nm: float = 355.0, frequency_divider: int | None = None, energy_level: Literal['OFF', 'Adjust', 'MAX'] = 'MAX', batch_mode: Literal['Continuous', 'Burst', 'Trigger'] = 'Continuous')[source]#
Bases:
SettingsClassSettings for the EKSPLA OPO laser.
Methods
Return all fields of the settings class as a dictionary.
Convenience method for copy.deepcopy(self)
Return a tuple describing the fields of this dataclass.
Recursively construct a
SettingsClassfrom a dictionary.Return the settings as a dictionary.
Attributes
- __annotations__ = {'batch_mode': typing.Literal['Continuous', 'Burst', 'Trigger'], 'energy_level': typing.Literal['OFF', 'Adjust', 'MAX'], 'frequency_divider': typing.Optional[int], 'wavelength_nm': <class 'float'>}#
- __dataclass_fields__ = {'batch_mode': Field(name='batch_mode',type=typing.Literal['Continuous', 'Burst', 'Trigger'],default='Continuous',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Operation mode of the laser.'}),kw_only=False,_field_type=_FIELD), 'energy_level': Field(name='energy_level',type=typing.Literal['OFF', 'Adjust', 'MAX'],default='MAX',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Output energy level of the laser.'}),kw_only=False,_field_type=_FIELD), 'frequency_divider': Field(name='frequency_divider',type=typing.Optional[int],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Frequency divider of the laser: the base repetition rate of 50 Hz divided by this value. Either this or general.pulse_interval_s must be set; the divider is set automatically from the target pulse interval by TspvSettings.prepare() if that is given.'}),kw_only=False,_field_type=_FIELD), 'wavelength_nm': Field(name='wavelength_nm',type=<class 'float'>,default=355.0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Output wavelength of the OPG in nm, the OPG supports 2 nm to 1300 nm.', 'valid': (2, 1300)}),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__': 'spvctrl.measurement.settings', '__firstlineno__': 141, '__annotations__': {'wavelength_nm': <class 'float'>, 'frequency_divider': typing.Optional[int], 'energy_level': typing.Literal['OFF', 'Adjust', 'MAX'], 'batch_mode': typing.Literal['Continuous', 'Burst', 'Trigger']}, '__doc__': 'Settings for the EKSPLA OPO laser.', 'wavelength_nm': 355.0, 'frequency_divider': None, 'energy_level': 'MAX', 'batch_mode': 'Continuous', 'apply': <function OpoSettings.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__': {'wavelength_nm': Field(name='wavelength_nm',type=<class 'float'>,default=355.0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Output wavelength of the OPG in nm, the OPG supports 2 nm to 1300 nm.', 'valid': (2, 1300)}),kw_only=False,_field_type=_FIELD), 'frequency_divider': Field(name='frequency_divider',type=typing.Optional[int],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Frequency divider of the laser: the base repetition rate of 50 Hz divided by this value. Either this or general.pulse_interval_s must be set; the divider is set automatically from the target pulse interval by TspvSettings.prepare() if that is given.'}),kw_only=False,_field_type=_FIELD), 'energy_level': Field(name='energy_level',type=typing.Literal['OFF', 'Adjust', 'MAX'],default='MAX',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Output energy level of the laser.'}),kw_only=False,_field_type=_FIELD), 'batch_mode': Field(name='batch_mode',type=typing.Literal['Continuous', 'Burst', 'Trigger'],default='Continuous',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Operation mode of the laser.'}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function OpoSettings.__init__>, '__repr__': <function OpoSettings.__repr__>, '__eq__': <function OpoSettings.__eq__>, '__match_args__': ('wavelength_nm', 'frequency_divider', 'energy_level', 'batch_mode')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 141#
- __hash__ = None#
- __init__(wavelength_nm: float = 355.0, frequency_divider: int | None = None, energy_level: Literal['OFF', 'Adjust', 'MAX'] = 'MAX', batch_mode: Literal['Continuous', 'Burst', 'Trigger'] = 'Continuous') None#
- __match_args__ = ('wavelength_nm', 'frequency_divider', 'energy_level', 'batch_mode')#
- __module__ = 'spvctrl.measurement.settings'#
- __or__(other)#
Merge with another settings class or a dictionary. Unknown keys in a dictionary are ignored.
- __replace__(**changes)#
- __repr__()#
Return repr(self).
- __static_attributes__ = ()#
- __weakref__#
list of weak references to the object
- _get_dict(remove_empty_containers: bool = False, remove_None: bool = False, remove_if_None: list[str] | None = None) dict#
Return the settings as a dictionary, optionally cleaning up the output.
Base implementation for
get_dict(). Subclasses may call it with different arguments to configure the output.- Parameters:
remove_empty_containers – If True, remove empty
dict,list,tupleorsetvalues.remove_None – If True, remove all keys with a
Nonevalue.remove_if_None – If given, remove these keys only if their value is
None(absent keys are ignored).
- Returns:
Instance converted to dictionary, see
as_dict().
- _reorder_dict(d: dict) dict#
Reorder the keys of a dictionary created by
dataclasses.asdict()to the order offields().Walks the fields of
selfin parallel todand recurses into nestedSettingsClassinstances. All other values are kept as-is.- Parameters:
d – Dictionary as returned by
dataclasses.asdict()for this instance.- Returns:
Dictionary with the same values, but keys ordered like
fields().
- as_dict() dict#
Return all fields of the settings class as a dictionary.
Like
dataclasses.asdict(), but the keys are ordered likefields(): also the keys of nested SettingsClass instances (as field values and inside lists, tuples and dicts) are ordered by their fields. This waysave_yaml()and other YAML exports write the fields in the same order as they are defined in the class (or reordered bymetadata["order"], like in the GUI).- Returns:
Instance converted to dictionary.
- batch_mode: Literal['Continuous', 'Burst', 'Trigger'] = 'Continuous'#
- copy() Self#
Convenience method for copy.deepcopy(self)
- energy_level: Literal['OFF', 'Adjust', 'MAX'] = 'MAX'#
- fields()#
Return a tuple describing the fields of this dataclass.
Adapted version of dataclass.fields that applies additional sorting of the fields according to the field’s metadata[“order”] parameter.
Accepts a dataclass or an instance of one. Tuple elements are of type Field.
- frequency_divider: int | None = None#
- classmethod from_dict(data: dict, strict: bool = False) Self#
Recursively construct a
SettingsClassfrom 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 (Union with
None)a Union with any handled types
- Parameters:
strict – If True, raise a KeyError on keys in
datathat are not field names ofcls. Unknown keys are ignored otherwise.- Raises:
- get_dict() dict#
Return the settings as a dictionary.
as_dict()returns the settings class with all fields, whileget_dict()may be configured by subclasses to skip certain fields in the output. The default implementation returns all fields, likeas_dict(). :return: Instance converted to dictionary.
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- save_yaml(yaml_path: str)#
- wavelength_nm: float = 355.0#