mpylab.device.powermeter_multichannel_common module¶
Shared infrastructure for channel facades of multi-channel power meters.
- class mpylab.device.powermeter_multichannel_common.ControllerSettings(acquisition: str, configured_channels: int, timeout: float = 60.0, poll_interval: float = 0.01)
Bases:
objectConfiguration which must agree for facades sharing one instrument.
- acquisition: str
- configured_channels: int
- poll_interval: float = 0.01
- timeout: float = 60.0
- class mpylab.device.powermeter_multichannel_common.SharedPowerMeterController(owner, key, settings, device_name)
Bases:
SharedControllerOwn one transport and state shared by all power-meter channels.
- Parameters:
owner (object) – Driver facade that opened the physical transport.
key (hashable) – Identifier used to share the controller between facades.
settings (ControllerSettings) – Configuration shared by every facade.
device_name (str) – Device name used in diagnostics.
- class mpylab.device.powermeter_multichannel_common.SharedPowerMeterFacade
Bases:
SharedFacadeCommon lifecycle for logical channels backed by one controller.
- mpylab.device.powermeter_multichannel_common.quantity_from_reading(driver, value, internal_unit)
Convert one meter reading and mismatch contribution to a quantity.
- Parameters:
driver (object) – Driver providing
get_standard_mismatch_uncertainty().value (float-like) – Numeric meter reading in internal_unit.
internal_unit (str or scuq.units.Unit) – Unit used by the physical instrument.
- Returns:
Reading with the standard mismatch uncertainty attached.
- Return type:
scuq.quantities.Quantity
- Raises:
TypeError – If internal_unit is neither a string nor an scuq unit.
ValueError – If the reading or mismatch uncertainty is invalid.
- mpylab.device.powermeter_multichannel_common.raw_response(response, key=None)
Return a scalar from a raw or parsed instrument response.
- Parameters:
response (object or dict) – Raw scalar response or dictionary of named regular-expression fields.
key (str, optional) – Preferred dictionary field.
- Returns:
Selected scalar response.
- Return type:
object
- Raises:
RuntimeError – If a dictionary contains multiple fields and key selects none.