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 raiseRuntimeError
if the device is not responding or a communication error occurs._isAlive()
should always return the current alive state and should not raiseRuntimeError
that causes interruption. Theupdated
signal should be emitted by the acquisition thread to inform when new data is acquired.- Parameters:
exposure (float or None) – The initial exposure time. If the device does not support the exposure time, None should be set.
**kwargs – Additional keyword arguments passed to QThread.
- aliveStateChanged
Emitted when alive state changes.
- busyStateChanged
Emitted when busy state changes.
- dataAcquired
emitted when data is acquired.
- property exposure
Return the exposure time. If the detector does not support the exposure time, None will be returned.
- Returns:
The exposure time
- Return type:
float or None
- property isAlive
Returns the 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
Returns whether the detector is currently busy.
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]
Returns a generic settings dialog.
This method is intended to be overridden in subclasses to provide a device-specific settings UI.
- Returns:
The settings dialog.
- Return type:
QDialog
- Raises:
NotImplementedError – If the subclass does not implement this method.
- startAcq(iter=1, wait=False, output=False)[source]
Starts acquisition in an acquisition thread.
If both wait and output are True, the method blocks until acquisition is complete 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 if output is True, otherwise None.
- Return type:
dict[tuple, np.ndarray] or None
- stop()[source]
Stops the acquisition and emits the latest acquired data.
This method waits for the acquisition worker thread to finish if it is running.
- updated
emitted by the acquisition thread when new data is acquired.
- class lys_instr.MultiDetector.MultiDetectorInterface(exposure=1, **kwargs)[source]
Bases:
DetectorInterface
Abstract interface for multi-detector devices.
This class extends DetectorInterface to support detectors that acquire multi-dimensional data frames. Subclasses should implement device-specific logic for data acquisition and shape reporting.
- property axes
The axes for the full data.
- Returns:
The axes for the full data.
- Return type:
list of numpy.ndarray
- Raises:
NotImplementedError – If the subclass does not implement this property.
- property dataShape
The shape of the acquired data.
- Returns:
Shape of the acquired data.
- Return type:
tuple
- property frameDim
The number of dimensions for a single frame of data.
- Returns:
Number of dimensions for a single frame.
- Return type:
int
- property frameShape
The shape of a single frame.
- Returns:
Shape of a single frame.
- Return type:
tuple
- Raises:
NotImplementedError – If the subclass does not implement this property.
- property indexDim
The number of dimensions for indexing acquired data frames.
- Returns:
Number of dimensions for indexing acquired data.
- Return type:
int
- property indexShape
The shape of the single frame.
- Returns:
Shape of the indices.
- Return type:
tuple
- Raises:
NotImplementedError – If the subclass does not implement this property.