prsctrl.measurement.settings.PrsSettings#

class PrsSettings(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)[source]#

Bases: SettingsClass

All settings for a photoreflectance-type measurement.

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__ = {'auto_set_init_gain': <class 'bool'>, 'general': <class 'prsctrl.measurement.settings.MeasurementParameters'>, 'laser': typing.Optional[prsctrl.measurement.settings.LaserSettings], 'led': typing.Optional[prsctrl.measurement.settings.LedSettings], 'modes': dict[str, prsctrl.measurement.settings.ModeSettings], 'monochromators': list[prsctrl.measurement.settings.MonochromatorSettings]}#
__dataclass_fields__ = {'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)}#
__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__': 370, '__annotations__': {'modes': dict[str, prsctrl.measurement.settings.ModeSettings], 'general': <class 'prsctrl.measurement.settings.MeasurementParameters'>, 'laser': typing.Optional[prsctrl.measurement.settings.LaserSettings], 'led': typing.Optional[prsctrl.measurement.settings.LedSettings], 'monochromators': list[prsctrl.measurement.settings.MonochromatorSettings], 'auto_set_init_gain': <class 'bool'>}, '__doc__': 'All settings for a photoreflectance-type measurement.\n    ', 'laser': None, 'led': None, 'auto_set_init_gain': False, 'prepare': <function PrsSettings.prepare>, 'get_metadata': <function PrsSettings.get_metadata>, '__static_attributes__': ('laser', 'led'), '__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)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function PrsSettings.__init__>, '__repr__': <function PrsSettings.__repr__>, '__eq__': <function PrsSettings.__eq__>, '__match_args__': ('modes', 'general', 'laser', 'led', 'monochromators', 'auto_set_init_gain')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 370#
__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) None#
__match_args__ = ('modes', 'general', 'laser', 'led', 'monochromators', 'auto_set_init_gain')#
__module__ = 'prsctrl.measurement.settings'#
__or__(other)#

Merge with another settings class or a dictionary.

__replace__(**changes)#
__repr__()#

Return repr(self).

__static_attributes__ = ('laser', 'led')#
__weakref__#

list of weak references to the object

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][source]#

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]#
prepare(power_density_to_laser_power_mW: Callable[[float], float] | None = None, power_density_to_led_current_A: Callable[[float], float] | None = None)[source]#

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

save_yaml(yaml_path: str)#