mpylab.device.lumiloop_multichannel_common module

Shared infrastructure for channel-oriented LUMILOOP drivers.

class mpylab.device.lumiloop_multichannel_common.SharedFacade

Bases: SharedFacade

Common public API for facades backed by a shared controller.

GetDataNB(retrigger=False)

Read this facade and optionally start a new acquisition generation.

Parameters:

retrigger (bool or str, optional) – Whether to trigger again after returning the current value.

Returns:

Result returned by the concrete facade’s GetData method.

Return type:

tuple

Raises:

ValueError – If retrigger is not a recognized boolean value.

GetFreq()

Return the correction frequency shared by all facades.

Returns:

Status code and current frequency in Hz.

Return type:

tuple of (int, float)

SetFreq(freq)

Set the correction frequency shared by all facades.

Parameters:

freq (float) – Frequency in Hz.

Returns:

Status code and applied frequency in Hz.

Return type:

tuple of (int, float)

Trigger()

Start a new logical acquisition generation.

Returns:

Controller status code.

Return type:

int

class mpylab.device.lumiloop_multichannel_common.SharedSettings(acquisition: str, configured_count: int | None, low_mode: int, high_mode: int, mode_frequency: float, ready_timeout: float, trigger_timeout: float, measurement_duration: float, minimum_samples: int, virtual_sample_rate: int, device_selector: str | None = None, logical_identities: tuple = ())

Bases: object

Settings which must agree for facades sharing one physical device.

acquisition: str
configured_count: int | None
device_selector: str | None = None
high_mode: int
logical_identities: tuple = ()
low_mode: int
measurement_duration: float
minimum_samples: int
mode_frequency: float
ready_timeout: float
trigger_timeout: float
virtual_sample_rate: int
mpylab.device.lumiloop_multichannel_common.parse_mode_pair(mode, supported_modes, device_name)

Return and validate a low-/high-frequency detector-mode pair.

Parameters:
  • mode (sequence of int or str) – Pair of detector modes, or text containing exactly two integers.

  • supported_modes (collection of int) – Detector modes accepted by the device.

  • device_name (str) – Device name used in validation errors.

Returns:

Low- and high-frequency detector modes.

Return type:

tuple of int

Raises:

ValueError – If the pair is malformed or contains an unsupported mode.

mpylab.device.lumiloop_multichannel_common.parse_numeric_list(response, device_name)

Parse a comma-separated SCPI numeric response.

Parameters:
  • response (str-like) – Comma-separated response values.

  • device_name (str) – Device name used in error messages.

Returns:

Parsed response values.

Return type:

list of float

Raises:
  • RuntimeError – If the device returned no response.

  • ValueError – If a response field is not numeric.

mpylab.device.lumiloop_multichannel_common.read_binary_block(device, device_name, terminator=b'\r\n')

Read one size-prefixed LUMILOOP binary block and its terminator.

Parameters:
  • device (object) – Communication object providing read_bytes(count).

  • device_name (str) – Device name used in error messages.

  • terminator (bytes, optional) – Expected bytes following the binary payload.

Returns:

Binary payload without size prefix and terminator.

Return type:

bytes

Raises:
  • EOFError – If the response ends prematurely.

  • RuntimeError – If the response terminator is invalid.

mpylab.device.lumiloop_multichannel_common.read_exact(device, count, device_name)

Read an exact number of bytes from a LUMILOOP binary response.

Parameters:
  • device (object) – Communication object providing read_bytes(count).

  • count (int) – Number of bytes to read.

  • device_name (str) – Device name used in error messages.

Returns:

Concatenated response bytes.

Return type:

bytes

Raises:

EOFError – If the response ends before count bytes have been received.

mpylab.device.lumiloop_multichannel_common.waveform_sample_count(duration, sample_rate, minimum_samples)

Calculate a duration-based waveform length with a lower bound.

Parameters:
  • duration (float) – Requested measurement duration in seconds.

  • sample_rate (float) – Effective waveform sample rate in samples per second.

  • minimum_samples (int) – Minimum number of samples to request.

Returns:

Required number of waveform samples.

Return type:

int

Raises:

ValueError – If sample_rate is not positive.