prsctrl.measurement.settings.MeasurementParameters#
- class MeasurementParameters(measurement_time_s: float = 30, wait_time_s: Optional[float] = None, additional_wait_time_s: float = 0, pump_source: str = 'none', pump_power_mWcm2: Optional[float] = None, auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: Union[tuple[float, float, float], list[float], NoneType] = None, energies_eV: Union[tuple[float, float, float], list[float], NoneType] = None, offset_strategy: Literal['none', 'start-end', 'time-interval'] = 'time-interval', offset_intervals_minutes: list[int] = <factory>)[source]#
Bases:
SettingsClassMethods
Convenience wrapper for dataclasses.asdict(self)
Recursively construct a
SettingsClassfrom a dictionary.Return the measurements settings converted to a metadata dictionary that contains only relevant information.
Generate a list of wavelengths according to either the 'wavelengths_nm' or 'energies_eV' field.
Generate a list of wavelengths according to either the 'wavelengths_nm' or 'energies_eV' field and offset measurements.
Attributes
- __annotations__ = {'additional_wait_time_s': <class 'float'>, 'auto_gain': <class 'bool'>, 'auto_sensitivity': <class 'bool'>, 'energies_eV': typing.Union[tuple[float, float, float], list[float], NoneType], 'measurement_time_s': <class 'float'>, 'offset_intervals_minutes': list[int], 'offset_strategy': typing.Literal['none', 'start-end', 'time-interval'], 'pump_power_mWcm2': typing.Optional[float], 'pump_source': <class 'str'>, 'wait_time_s': typing.Optional[float], 'wavelengths_nm': typing.Union[tuple[float, float, float], list[float], 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[float, float, float], list[float], 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.', 'metadatas': {'tuple': {'metadatas': ({'decimals': 3, 'default': 1.55}, {'decimals': 3, 'default': 2.8}, {'decimals': 3, 'default': 0.005}), 'labels': ('Start', 'Stop', 'Step')}, 'list': {'metadatas': {'decimals': 3}}}}),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), 'offset_intervals_minutes': Field(name='offset_intervals_minutes',type=list[int],default=<dataclasses._MISSING_TYPE object>,default_factory=<function MeasurementParameters.<lambda>>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "How many minutes to wait after the last offset measurement. The last interval is repeated indefinetely.\nOnly applies when offset_strategy='time-interval'.\nStart and end offsets are always recorded, unless offset_strategy='none'."}),kw_only=False,_field_type=_FIELD), 'offset_strategy': Field(name='offset_strategy',type=typing.Literal['none', 'start-end', 'time-interval'],default='time-interval',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Which offset reduction strategy to use. Determines where offset measurements are added.'}),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 :py:attr:`PrsSettings.led` are applied. If 'laser', then the values from :py:attr:`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[float, float, float], list[float], 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.', 'metadatas': {'tuple': {'metadatas': ({'decimals': 3, 'default': 420}, {'decimals': 3, 'default': 800}, {'decimals': 3, 'default': 1}), 'labels': ('Start', 'Stop', 'Step')}, 'list': {'metadatas': {'decimals': 3}}}}),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__': 44, '__annotations__': {'measurement_time_s': <class 'float'>, 'wait_time_s': typing.Optional[float], 'additional_wait_time_s': <class 'float'>, 'pump_source': <class 'str'>, 'pump_power_mWcm2': typing.Optional[float], 'auto_gain': <class 'bool'>, 'auto_sensitivity': <class 'bool'>, 'wavelengths_nm': typing.Union[tuple[float, float, float], list[float], NoneType], 'energies_eV': typing.Union[tuple[float, float, float], list[float], NoneType], 'offset_strategy': typing.Literal['none', 'start-end', 'time-interval'], 'offset_intervals_minutes': list[int]}, 'measurement_time_s': 30, 'wait_time_s': None, 'additional_wait_time_s': 0, 'pump_source': 'none', 'pump_power_mWcm2': None, 'auto_gain': False, 'auto_sensitivity': True, 'wavelengths_nm': None, 'energies_eV': None, 'offset_strategy': 'time-interval', 'get_wavelengths_nm': <function MeasurementParameters.get_wavelengths_nm>, 'get_wavelengths_nm_with_offsets': <function MeasurementParameters.get_wavelengths_nm_with_offsets>, 'get_metadata': <function MeasurementParameters.get_metadata>, '__static_attributes__': ('energies_eV', 'wavelengths_nm'), '__doc__': "MeasurementParameters(measurement_time_s: float = 30, wait_time_s: Optional[float] = None, additional_wait_time_s: float = 0, pump_source: str = 'none', pump_power_mWcm2: Optional[float] = None, auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: Union[tuple[float, float, float], list[float], NoneType] = None, energies_eV: Union[tuple[float, float, float], list[float], NoneType] = None, offset_strategy: Literal['none', 'start-end', 'time-interval'] = 'time-interval', offset_intervals_minutes: list[int] = <factory>)", '__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 :py:attr:`PrsSettings.led` are applied. If 'laser', then the values from :py:attr:`PrsSettings.laser` are applied.", 'valid': ['laser', 'led', 'laser-manual', 'led-manual', 'none', 'manual']}),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), '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[float, float, float], list[float], 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.', 'metadatas': {'tuple': {'metadatas': ({'decimals': 3, 'default': 420}, {'decimals': 3, 'default': 800}, {'decimals': 3, 'default': 1}), 'labels': ('Start', 'Stop', 'Step')}, 'list': {'metadatas': {'decimals': 3}}}}),kw_only=False,_field_type=_FIELD), 'energies_eV': Field(name='energies_eV',type=typing.Union[tuple[float, float, float], list[float], 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.', 'metadatas': {'tuple': {'metadatas': ({'decimals': 3, 'default': 1.55}, {'decimals': 3, 'default': 2.8}, {'decimals': 3, 'default': 0.005}), 'labels': ('Start', 'Stop', 'Step')}, 'list': {'metadatas': {'decimals': 3}}}}),kw_only=False,_field_type=_FIELD), 'offset_strategy': Field(name='offset_strategy',type=typing.Literal['none', 'start-end', 'time-interval'],default='time-interval',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Which offset reduction strategy to use. Determines where offset measurements are added.'}),kw_only=False,_field_type=_FIELD), 'offset_intervals_minutes': Field(name='offset_intervals_minutes',type=list[int],default=<dataclasses._MISSING_TYPE object>,default_factory=<function MeasurementParameters.<lambda>>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "How many minutes to wait after the last offset measurement. The last interval is repeated indefinetely.\nOnly applies when offset_strategy='time-interval'.\nStart and end offsets are always recorded, unless offset_strategy='none'."}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function MeasurementParameters.__init__>, '__repr__': <function MeasurementParameters.__repr__>, '__eq__': <function MeasurementParameters.__eq__>, '__match_args__': ('measurement_time_s', 'wait_time_s', 'additional_wait_time_s', 'pump_source', 'pump_power_mWcm2', 'auto_gain', 'auto_sensitivity', 'wavelengths_nm', 'energies_eV', 'offset_strategy', 'offset_intervals_minutes')})#
- __eq__(other)#
Return self==value.
- __firstlineno__ = 44#
- __hash__ = None#
- __init__(measurement_time_s: float = 30, wait_time_s: float | None = None, additional_wait_time_s: float = 0, pump_source: str = 'none', pump_power_mWcm2: float | None = None, auto_gain: bool = False, auto_sensitivity: bool = True, wavelengths_nm: tuple[float, float, float] | list[float] | None=None, energies_eV: tuple[float, float, float] | list[float] | None=None, offset_strategy: Literal['none', 'start-end', 'time-interval']='time-interval', offset_intervals_minutes: list[int] = <factory>) None#
- __match_args__ = ('measurement_time_s', 'wait_time_s', 'additional_wait_time_s', 'pump_source', 'pump_power_mWcm2', 'auto_gain', 'auto_sensitivity', 'wavelengths_nm', 'energies_eV', 'offset_strategy', 'offset_intervals_minutes')#
- __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[float, float, float] | list[float] | None = None#
- classmethod from_dict(data: dict)#
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
- get_metadata() dict[str, Any][source]#
Return the measurements settings converted to a metadata dictionary that contains only relevant information.
Leaves out wavelengths and energies, as those will be contained in the data as columns anyways. Leaves out optional values that are set to
None.
- get_wavelengths_nm(round_to_digits: int | None = 2, update_field: bool = False) 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
- get_wavelengths_nm_with_offsets(time_per_wavelength: int, round_to_digits: int | None = 2, update_field: bool = False) list[float | str][source]#
Generate a list of wavelengths according to either the ‘wavelengths_nm’ or ‘energies_eV’ field and offset measurements.
- Parameters:
time_per_wavelength – Estimated runtime per wavelength measurements. Required when offset_strategy==”time-interval”.
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 and offset measurements
- classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
- measurement_time_s: float = 30#
- offset_intervals_minutes: list[int]#
- offset_strategy: Literal['none', 'start-end', 'time-interval'] = 'time-interval'#
- pump_power_mWcm2: float | None = None#
- pump_source: str = 'none'#
- save_yaml(yaml_path: str)#
- wait_time_s: float | None = None#
- wavelengths_nm: tuple[float, float, float] | list[float] | None = None#