Detector

class lys_instr.MultiDetector.DetectorInterface(exposure=1, **kwargs)[source]

Bases: HardwareInterface

Abstract interface for detector devices.

This class provides background polling, threaded (worker) acquisition, and Qt signal management for detector state and data updates. Subclasses must implement device-specific methods: _get(), _stop(), and _isAlive(). _get() and _stop() should raise RuntimeError if the device is not responding or a communication error occurs. _isAlive() should always return the current alive state and should not raise RuntimeError that interrupts monitoring. The updated signal is emitted by the acquisition thread when new data is available.

aliveStateChanged

Signal (bool) emitted when alive state changes.

busyStateChanged

Signal (bool) emitted when busy state changes.

dataAcquired

Signal (dict) emitted when data is acquired.

property exposure

Exposure time.

Returns:

The exposure time.

Return type:

float | None

property isAlive

Current alive state of the detector.

This property should be implemented in subclasses to provide device-specific logic.

Returns:

True if the detector is alive, False otherwise.

Return type:

bool

property isBusy

Current busy state of the detector.

This property reflects the internal busy flag, which is True during acquisition.

Returns:

True if the detector is busy, False otherwise.

Return type:

bool

settingsWidget()[source]

Return a device-specific settings dialog.

Subclasses should override this to provide a QDialog for device settings.

Raises:

NotImplementedError – If the subclass does not implement this method.

startAcq(iter=1, wait=False, output=False)[source]

Start acquisition in an acquisition thread.

If both wait and output are True, the method blocks until acquisition completes and returns the acquired data.

Parameters:
  • iter (int) – Number of iterations.

  • wait (bool, optional) – If True, blocks until acquisition is complete. Defaults to False.

  • output (bool, optional) – If True, returns acquired data as a dictionary. Defaults to False.

Returns:

Acquired data that maps index tuples to frames when output is True; otherwise None.

Return type:

dict[tuple, np.ndarray] | None

stop()[source]

Stop the acquisition and emit the latest acquired data.

This method waits for the acquisition worker thread to finish if it is running.

updated

Signal emitted by the acquisition thread when new data is acquired.

waitForReady()[source]

Block further interaction until the device is no longer busy.

Returns:

None

class lys_instr.MultiDetector.MultiDetectorInterface(exposure=1, **kwargs)[source]

Bases: DetectorInterface

Abstract interface for multi-dimensional detector devices.

This class extends DetectorInterface to support detectors that acquire data with multi-dimensional indices. Subclasses should implement device-specific acquisition and property reporting logic.

property axes

Axis coordinates for the full data.

Returns:

Coordinate arrays corresponding to each axis of the index grid.

Return type:

list[numpy.ndarray]

Raises:

NotImplementedError – If the subclass does not implement this property.

property dataShape

Shape of the full data.

Returns:

Combined shape of the full dataset.

Return type:

tuple[int, …]

property frameDim

Number of dimensions for a single frame of data.

Returns:

Number of dimensions for a single frame.

Return type:

int

property frameShape

Shape of a single frame.

Returns:

Dimensions of a single frame.

Return type:

tuple[int, …]

Raises:

NotImplementedError – If the subclass does not implement this property.

property indexDim

Dimension of the index grid.

Returns:

Dimension of the index grid.

Return type:

int

property indexShape

Shape of the index tuples.

Returns:

Shape of the index tuples.

Return type:

tuple[int, …]

Raises:

NotImplementedError – If the subclass does not implement this property.

class lys_instr.gui.MultiDetector.MultiDetectorGUI(obj, wait=False, interval=1, iter=1)[source]

Bases: QWidget

GUI widget providing acquisition controls and a multicut display for a multi-dimensional detector.

Accepts a MultiDetectorInterface instance supplying data and signals. Listens to the detector’s busyStateChanged, aliveStateChanged, and dataAcquired signals to update the GUI.