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:
SettingsClassAll settings for a photoreflectance-type measurement.
Methods
Convenience wrapper for dataclasses.asdict(self)
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.
Return the measurements settings converted to a metadata dictionary that contains only relevant information.
Apply pump power density setting.
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. Unknown keys in a dictionary are ignored.
- __replace__(**changes)#
- __repr__()#
Return repr(self).
- __static_attributes__ = ('laser', 'led')#
- __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().
- as_dict() dict#
Convenience wrapper for dataclasses.asdict(self)
Returns all fields of the settings class. For a dictionary where certain fields may be skipped, see
get_dict().
- auto_set_init_gain: bool = False#
- copy() Self#
Convenience method for copy.deepcopy(self)
- 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.
- 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:
- general: MeasurementParameters#
- 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.
- 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
ledorlaserand.MeasurementParameters.pump_power_mWcm2is 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 ofPowerConversionobject.- 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
`ledorlaserbut 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)#