prsctrl.measurement.settings.MeasurementSettings#
- class MeasurementSettings(measurement_time_s: float = 30, wait_time_s: float | None = None, additional_wait_time_s: float = 0, pump_source: str = 'none', auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: tuple | list | NoneType = None, energies_eV: tuple | list | NoneType = None, pump_power_mWcm2: float | None = None)[source]#
Bases:
SettingsClassMethods
Convenience wrapper for dataclasses.asdict(self)
Recursively construct a SettingsClass from a dictionary.
Generate a list of wavelengths according to either the 'wavelengths_nm' or 'energies_eV' field.
Attributes
- __annotations__ = {'additional_wait_time_s': <class 'float'>, 'auto_gain': <class 'bool'>, 'auto_sensitivity': <class 'bool'>, 'energies_eV': typing.Union[tuple, list, NoneType], 'measurement_time_s': <class 'float'>, 'pump_power_mWcm2': typing.Optional[float], 'pump_source': <class 'str'>, 'wait_time_s': typing.Optional[float], 'wavelengths_nm': typing.Union[tuple, list, NoneType]}#
- __dataclass_fields__ = {'additional_wait_time_s': Field(name='additional_wait_time_s',type=<class 'float'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds to wait for the signal to stabilize after changing the wavelength.\nSet to `0` for no wait time, and to `None` to automatically choose a value based on the lock-in time constant.', 'valid': (0, 999999)}),kw_only=False,_field_type=_FIELD), 'auto_gain': Field(name='auto_gain',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Whether to automatically adjust the gain during the measurement to stay in the optimum DC region. Not current implemented yet.'}),kw_only=False,_field_type=_FIELD), 'auto_sensitivity': Field(name='auto_sensitivity',type=<class 'bool'>,default=True,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Whether to automatically increase the lock-in sensitivity on overloads.'}),kw_only=False,_field_type=_FIELD), 'energies_eV': Field(name='energies_eV',type=typing.Union[tuple, list, NoneType],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Energy range in eV. Must be either a list of values or a tuple (start, stop, step). Only one of `wavelengths_nm` or `energies_eV` may be set.'}),kw_only=False,_field_type=_FIELD), 'measurement_time_s': Field(name='measurement_time_s',type=<class 'float'>,default=30,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds where data is recorded at each wavelength.', 'valid': (0, 9999999)}),kw_only=False,_field_type=_FIELD), 'pump_power_mWcm2': Field(name='pump_power_mWcm2',type=typing.Optional[float],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Power in mW/cm^2. If `pump_source` is set and a conversion table exists for the source then the `power_mW` setting for lasers or the `current_A` setting for LEDs can be overwritten with the value corresponding to the `power_mWcm2` setting.'}),kw_only=False,_field_type=_FIELD), 'pump_source': Field(name='pump_source',type=<class 'str'>,default='none',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "String describing which pump source is used.\nIf 'led', then the values from `PrsSettings.led` are applied. If 'laser', then the values from `PrsSettings.laser` are applied.", 'valid': ['laser', 'led', 'laser-manual', 'led-manual', 'none', 'manual']}),kw_only=False,_field_type=_FIELD), 'wait_time_s': Field(name='wait_time_s',type=typing.Optional[float],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds to wait for the signal to stabilize after changing the wavelength.\nSet to `0` for no wait time, and to `None` to automatically choose a value based on the lock-in time constant.', 'valid': (0, 999999)}),kw_only=False,_field_type=_FIELD), 'wavelengths_nm': Field(name='wavelengths_nm',type=typing.Union[tuple, list, NoneType],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Wavelength range in nm. Must be either a list of values or a tuple (start, stop, step). Only one of `wavelengths_nm` or `energies_eV` may be set.'}),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__': 42, '__annotations__': {'measurement_time_s': <class 'float'>, 'wait_time_s': typing.Optional[float], 'additional_wait_time_s': <class 'float'>, 'pump_source': <class 'str'>, 'auto_gain': <class 'bool'>, 'auto_sensitivity': <class 'bool'>, 'wavelengths_nm': typing.Union[tuple, list, NoneType], 'energies_eV': typing.Union[tuple, list, NoneType], 'pump_power_mWcm2': typing.Optional[float]}, 'measurement_time_s': 30, 'wait_time_s': None, 'additional_wait_time_s': 0, 'pump_source': 'none', 'auto_gain': False, 'auto_sensitivity': True, 'wavelengths_nm': None, 'energies_eV': None, 'pump_power_mWcm2': None, 'get_wavelengths_nm': <function MeasurementSettings.get_wavelengths_nm>, '__static_attributes__': ('energies_eV', 'wavelengths_nm'), '__doc__': "MeasurementSettings(measurement_time_s: float = 30, wait_time_s: Optional[float] = None, additional_wait_time_s: float = 0, pump_source: str = 'none', auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: Union[tuple, list, NoneType] = None, energies_eV: Union[tuple, list, NoneType] = None, pump_power_mWcm2: Optional[float] = None)", '__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__': {'measurement_time_s': Field(name='measurement_time_s',type=<class 'float'>,default=30,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds where data is recorded at each wavelength.', 'valid': (0, 9999999)}),kw_only=False,_field_type=_FIELD), 'wait_time_s': Field(name='wait_time_s',type=typing.Optional[float],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds to wait for the signal to stabilize after changing the wavelength.\nSet to `0` for no wait time, and to `None` to automatically choose a value based on the lock-in time constant.', 'valid': (0, 999999)}),kw_only=False,_field_type=_FIELD), 'additional_wait_time_s': Field(name='additional_wait_time_s',type=<class 'float'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time in seconds to wait for the signal to stabilize after changing the wavelength.\nSet to `0` for no wait time, and to `None` to automatically choose a value based on the lock-in time constant.', 'valid': (0, 999999)}),kw_only=False,_field_type=_FIELD), 'pump_source': Field(name='pump_source',type=<class 'str'>,default='none',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "String describing which pump source is used.\nIf 'led', then the values from `PrsSettings.led` are applied. If 'laser', then the values from `PrsSettings.laser` are applied.", 'valid': ['laser', 'led', 'laser-manual', 'led-manual', 'none', 'manual']}),kw_only=False,_field_type=_FIELD), 'auto_gain': Field(name='auto_gain',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Whether to automatically adjust the gain during the measurement to stay in the optimum DC region. Not current implemented yet.'}),kw_only=False,_field_type=_FIELD), 'auto_sensitivity': Field(name='auto_sensitivity',type=<class 'bool'>,default=True,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Whether to automatically increase the lock-in sensitivity on overloads.'}),kw_only=False,_field_type=_FIELD), 'wavelengths_nm': Field(name='wavelengths_nm',type=typing.Union[tuple, list, NoneType],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Wavelength range in nm. Must be either a list of values or a tuple (start, stop, step). Only one of `wavelengths_nm` or `energies_eV` may be set.'}),kw_only=False,_field_type=_FIELD), 'energies_eV': Field(name='energies_eV',type=typing.Union[tuple, list, NoneType],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Energy range in eV. Must be either a list of values or a tuple (start, stop, step). Only one of `wavelengths_nm` or `energies_eV` may be set.'}),kw_only=False,_field_type=_FIELD), 'pump_power_mWcm2': Field(name='pump_power_mWcm2',type=typing.Optional[float],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Power in mW/cm^2. If `pump_source` is set and a conversion table exists for the source then the `power_mW` setting for lasers or the `current_A` setting for LEDs can be overwritten with the value corresponding to the `power_mWcm2` setting.'}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function MeasurementSettings.__init__>, '__repr__': <function MeasurementSettings.__repr__>, '__eq__': <function MeasurementSettings.__eq__>, '__match_args__': ('measurement_time_s', 'wait_time_s', 'additional_wait_time_s', 'pump_source', 'auto_gain', 'auto_sensitivity', 'wavelengths_nm', 'energies_eV', 'pump_power_mWcm2')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 42#
- __hash__ = None#
- __init__(measurement_time_s: float = 30, wait_time_s: float | None = None, additional_wait_time_s: float = 0, pump_source: str = 'none', auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: tuple | list | None = None, energies_eV: tuple | list | None = None, pump_power_mWcm2: float | None = None) None#
- __match_args__ = ('measurement_time_s', 'wait_time_s', 'additional_wait_time_s', 'pump_source', 'auto_gain', 'auto_sensitivity', 'wavelengths_nm', 'energies_eV', 'pump_power_mWcm2')#
- __module__ = 'prsctrl.measurement.settings'#
- __or__(other)#
Merge with another settings class or a dictionary.
- __replace__(**changes)#
- __repr__()#
Return repr(self).
- __static_attributes__ = ('energies_eV', 'wavelengths_nm')#
- __weakref__#
list of weak references to the object
- additional_wait_time_s: float = 0#
- as_dict() dict#
Convenience wrapper for dataclasses.asdict(self)
- auto_gain: bool = False#
- auto_sensitivity: bool = True#
- energies_eV: tuple | list | None = None#
- 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
- get_wavelengths_nm(round_to_digits: int | None = 2, update_field: bool = True) list[float][source]#
Generate a list of wavelengths according to either the ‘wavelengths_nm’ or ‘energies_eV’ field. Either field may already be a list of values, or a tuple (start, stop, step size).
- Parameters:
round_to_digits – Optional number of digits to round the values to.
update_field – If True, overwrite the value of ‘wavelengths_nm’ with the returned array and ‘energies_eV’ with None.
- Returns:
list of wavelengths in nm
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- measurement_time_s: float = 30#
- pump_power_mWcm2: float | None = None#
- pump_source: str = 'none'#
- save_yaml(yaml_path: str)#
- wait_time_s: float | None = None#
- wavelengths_nm: tuple | list | None = None#