prsctrl_gui.measurement.settings.PrsGuiSettings#

class PrsGuiSettings(modes: dict[str, ~prsctrl.measurement.settings.ModeSettings]=<factory>, general: MeasurementParameters = <factory>, laser: LaserSettings | None = None, led: LedSettings | None = None, monochromators: list[MonochromatorSettings] = <factory>, auto_set_init_gain: bool = False, sample_key: str | None = None, power_calibration_key: str | None = None, setup_info_key: str | None = None, additional_metadata: dict[str, str]=<factory>)[source]#

Bases: PrsSettings

Main measurement settings dataclass for prsctrl-gui.

Inherits .PrsSettings and only adds GUI-specific fields.

This class is is used a base for the MeasurementTask.

Methods

as_dict

Convenience wrapper for dataclasses.asdict(self)

from_dict

Recursively construct a SettingsClass from a dictionary.

get_metadata

Return the measurements settings converted to a metadata dictionary that contains only relevant information.

load_yaml

prepare

Apply pump power density setting.

save_yaml

Attributes

__annotations__ = {'additional_metadata': dict[str, str], 'power_calibration_key': typing.Optional[str], 'sample_key': typing.Optional[str], 'setup_info_key': typing.Optional[str]}#
__dataclass_fields__ = {'additional_metadata': Field(name='additional_metadata',type=dict[str, str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Additional metadata for this measurement.'}),kw_only=False,_field_type=_FIELD), 'auto_set_init_gain': Field(name='auto_set_init_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 set the pre-amplifier gain before the measurement. If set to an integer, `True` is implied and the value is the number of sample points in the spectral range to take into account for determining the gain.'}),kw_only=False,_field_type=_FIELD), 'general': Field(name='general',type=<class 'prsctrl.measurement.settings.MeasurementParameters'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'prsctrl.measurement.settings.MeasurementParameters'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'laser': Field(name='laser',type=typing.Optional[prsctrl.measurement.settings.LaserSettings],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'led': Field(name='led',type=typing.Optional[prsctrl.measurement.settings.LedSettings],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'modes': Field(name='modes',type=dict[str, prsctrl.measurement.settings.ModeSettings],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Mode key (ref/tra): mode settings'}),kw_only=False,_field_type=_FIELD), 'monochromators': Field(name='monochromators',type=list[prsctrl.measurement.settings.MonochromatorSettings],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'A list of monochromator settings is supported to allow for dual monochromator setups.'}),kw_only=False,_field_type=_FIELD), 'power_calibration_key': Field(name='power_calibration_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "Key of a power calibration in the database.\nOnly used when `pump_source` is 'laser' or 'led' and `pump_power_mWcm2` is given."}),kw_only=False,_field_type=_FIELD), 'sample_key': Field(name='sample_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Key of a sample in the sample database.\nSample information is added as metadata to the measurement data.'}),kw_only=False,_field_type=_FIELD), 'setup_info_key': Field(name='setup_info_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Key of a setup information entry in the database.'}),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_gui.measurement.settings', '__firstlineno__': 5, '__annotations__': {'sample_key': typing.Optional[str], 'power_calibration_key': typing.Optional[str], 'setup_info_key': typing.Optional[str], 'additional_metadata': dict[str, str]}, '__doc__': 'Main measurement settings dataclass for prsctrl-gui.\n\nInherits `.PrsSettings` and only adds GUI-specific fields.\n\nThis class is is used a base for the :py:class:`~prsctrl_gui.task.tasks.MeasurementTask`.\n', 'sample_key': None, 'power_calibration_key': None, 'setup_info_key': None, '__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__': {'modes': Field(name='modes',type=dict[str, prsctrl.measurement.settings.ModeSettings],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Mode key (ref/tra): mode settings'}),kw_only=False,_field_type=_FIELD), 'general': Field(name='general',type=<class 'prsctrl.measurement.settings.MeasurementParameters'>,default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'prsctrl.measurement.settings.MeasurementParameters'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'laser': Field(name='laser',type=typing.Optional[prsctrl.measurement.settings.LaserSettings],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'led': Field(name='led',type=typing.Optional[prsctrl.measurement.settings.LedSettings],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'monochromators': Field(name='monochromators',type=list[prsctrl.measurement.settings.MonochromatorSettings],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'A list of monochromator settings is supported to allow for dual monochromator setups.'}),kw_only=False,_field_type=_FIELD), 'auto_set_init_gain': Field(name='auto_set_init_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 set the pre-amplifier gain before the measurement. If set to an integer, `True` is implied and the value is the number of sample points in the spectral range to take into account for determining the gain.'}),kw_only=False,_field_type=_FIELD), 'sample_key': Field(name='sample_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Key of a sample in the sample database.\nSample information is added as metadata to the measurement data.'}),kw_only=False,_field_type=_FIELD), 'power_calibration_key': Field(name='power_calibration_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': "Key of a power calibration in the database.\nOnly used when `pump_source` is 'laser' or 'led' and `pump_power_mWcm2` is given."}),kw_only=False,_field_type=_FIELD), 'setup_info_key': Field(name='setup_info_key',type=typing.Optional[str],default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Key of a setup information entry in the database.'}),kw_only=False,_field_type=_FIELD), 'additional_metadata': Field(name='additional_metadata',type=dict[str, str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'dict'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Additional metadata for this measurement.'}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function PrsGuiSettings.__init__>, '__repr__': <function PrsGuiSettings.__repr__>, '__eq__': <function PrsGuiSettings.__eq__>, '__match_args__': ('modes', 'general', 'laser', 'led', 'monochromators', 'auto_set_init_gain', 'sample_key', 'power_calibration_key', 'setup_info_key', 'additional_metadata')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 5#
__hash__ = None#
__init__(modes: dict[str, ~prsctrl.measurement.settings.ModeSettings]=<factory>, general: MeasurementParameters = <factory>, laser: LaserSettings | None = None, led: LedSettings | None = None, monochromators: list[MonochromatorSettings] = <factory>, auto_set_init_gain: bool = False, sample_key: str | None = None, power_calibration_key: str | None = None, setup_info_key: str | None = None, additional_metadata: dict[str, str]=<factory>) None#
__match_args__ = ('modes', 'general', 'laser', 'led', 'monochromators', 'auto_set_init_gain', 'sample_key', 'power_calibration_key', 'setup_info_key', 'additional_metadata')#
__module__ = 'prsctrl_gui.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

additional_metadata: dict[str, str]#
as_dict() dict#

Convenience wrapper for dataclasses.asdict(self)

auto_set_init_gain: bool = False#
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 (Union with None)

  • a Union with any handled types

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

general: MeasurementParameters#
get_metadata(mode: str | None) dict[str, Any]#

Return the measurements settings converted to a metadata dictionary that contains only relevant information.

laser: LaserSettings | None = None#
led: LedSettings | None = None#
classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
modes: dict[str, ModeSettings]#
monochromators: list[MonochromatorSettings]#
power_calibration_key: str | None = None#
prepare(power_density_to_laser_power_mW: Callable[[float], float] | None = None, power_density_to_led_current_A: Callable[[float], float] | None = None)#

Apply pump power density setting.

If the pump source is led or laser and .MeasurementParameters.pump_power_mWcm2 is set, the power density is converted to the laser power in mW or led current in A using the conversion functions. These can be the methods of PowerConversion object.

Parameters:
  • power_density_to_laser_power_mW – Function to convert pump power density to laser power density.

  • power_density_to_led_current_A – Function to convert pump power density to led current density.

Raises:

RuntimeError if - pump source is set to `led or laser but not settings or power density are set - a power density is set but no power density conversion function was passed to this method

sample_key: str | None = None#
save_yaml(yaml_path: str)#
setup_info_key: str | None = None#