Motor
- class lys_instr.MultiController.MultiControllerInterface(*axisNamesAll, **kwargs)[source]
Bases:
HardwareInterfaceAbstract interface for multi-axis controllers (e.g., motors, switches, or similar).
This class provides background polling, state management, and Qt signals for axis value and state updates. Subclasses must implement device-specific methods:
_get(),_set(),_isBusy(), and_isAlive()._get(),_set(), and_isBusy()should raiseRuntimeErroron communication errors;_isAlive()should return the current alive state without raisingRuntimeErrorthat interrupts monitoring.- aliveStateChanged
Signal (dict) emitted when alive state changes.
- busyStateChanged
Signal (dict) emitted when busy state changes.
- get(type=<class 'dict'>)[source]
Get the current values of all axes in the specified data type.
- Parameters:
type (type, optional) – Output type (dict, list, or np.ndarray). Defaults to dict.
- Returns:
Axis values in the requested format.
- Return type:
dict or list or np.ndarray
- Raises:
TypeError – If an unsupported output type is requested.
- property isAlive
Current alive state of all axes.
- Returns:
Mapping of axis names to their alive state.
- Return type:
dict[str, bool]
- property isBusy
Current busy state of all axes.
- Returns:
Mapping of axis names to their busy state.
- Return type:
dict[str, bool]
- Raises:
RuntimeError – If the device is not responding or a communication error occurs.
- property nameList
List of all axis names.
- Returns:
Axis names in the order they were registered.
- Return type:
list[str]
- set(wait=False, lock=True, **kwargs)[source]
Set target values for one or more axes.
For each axis specified in
kwargs, set its target value, e.g.,set(x=1.0, y=2.0). Optionally wait until all axes become idle after setting.- Parameters:
wait (bool, optional) – If True, block until all axes become idle after setting. Defaults to False.
lock (bool, optional) – If True, acquire the instance mutex while applying targets. Defaults to True.
**kwargs – Axis-value pairs to set, e.g., x=1.0, y=2.0.
- Raises:
ValueError – If any provided axis name is invalid.
- settingsWidget()[source]
Return a device-specific settings dialog.
Subclasses should override this to provide a QDialog for device settings. The base implementation returns
None.- Returns:
Settings dialog, or
Noneif not provided by the base class.- Return type:
QDialog | None
- stop()[source]
Stop all axes.
Call the instance-specific
_stop()method to perform the actual stopping logic.
- property target
Current target values of all axes.
- Returns:
Mapping of axis names to their target values.
- Return type:
dict[str, float]
- valueChanged
Signal (dict) emitted when axis values change.
- class lys_instr.MultiController.MultiMotorInterface(*axesNames, autoSave=True, **kwargs)[source]
Bases:
OffsettableMultiMotorInterfaceMulti-axis motor interface.
Thin subclass of OffsettableMultiMotorInterface kept for semantic clarity and for future device-specific extensions.
- class lys_instr.MultiController.MultiSwitchInterface(labelNames, *axisNamesAll, **kwargs)[source]
Bases:
MultiControllerInterfaceInterface for switch-type multi-axis controllers (referred to as switches for short).
Convenience subclass for devices where each axis behaves like a switch with discrete label positions.
- property labelNames
List of label names associated with the switch axes.
- Returns:
Label names in the order corresponding to axis registration.
- Return type:
list[str]
- class lys_instr.MultiController.OffsettableMultiMotorInterface(*axesNames, autoSave=True, **kwargs)[source]
Bases:
MultiControllerInterfaceInterface for motor-type multi-axis controllers (referred to as motors for short) with offset functionality.
Convenience subclass for devices where each axis exposes a continuous position value. This class adds a per-axis offsets dictionary that is applied to
get()/set()operations and can be persisted to disk.- get(type=<class 'dict'>)[source]
Get current axis values in user coordinates (stored offsets subtracted).
- Parameters:
type (type, optional) – Output container type (dict, list, np.ndarray). Defaults to dict.
- Returns:
Axis values in user coordinates (stored offsets subtracted).
- Return type:
dict | list | np.ndarray
- Raises:
TypeError – If an unsupported output type is requested.
- load(path='.lys/lys_instr/motorOffsets')[source]
Load persisted per-axis offsets into memory.
- Parameters:
path (str) – Filesystem path to load offsets from. Defaults to
.lys/lys_instr/motorOffsets.
- property offset
Dictionary mapping axis names to respective offsets.
- offsetChanged
Signal emitted when any axis offset value changes.
- class offsetDict(axesNames, parent)[source]
Bases:
dictDictionary subclass that stores per-axis offsets and emits a signal when any value changes.
- valueChanged
Signal emitted when any axis offset value changes.
- save(path='.lys/lys_instr/motorOffsets')[source]
Persist per-axis offsets to disk.
- Parameters:
path (str) – Filesystem path to save offsets to. Defaults to
.lys/lys_instr/motorOffsets.
- set(**kwargs)[source]
Set target values for axes in user coordinates (stored offsets subtracted).
Adjust each provided value by adding the corresponding per-axis offset before delegating to the parent implementation. For example, calling
set(x=1.0)will result in the value1.0 + self.offset.get('x', 0)being sent to the underlying controller.- Parameters:
**kwargs (float) – Axis-value pairs in user coordinates.
- Returns:
None
- class lys_instr.gui.MultiMotor.MultiMotorGUI(obj, axisNamesSettable=None, axisNamesJoggable=None, axisNamesOffsettable=None, memory=None, memoryPath=None)[source]
Bases:
QWidgetGUI widget for controlling and monitoring a multi-axis motor.
Provides controls for moving, jogging, offsetting, and saving/loading positions for multiple axes. Accepts a
MultiMotorInterfaceinstance or a sequence of such instances. Listens to theirbusyStateChangedandaliveStateChangedsignals to update the GUI.- property controllers
Mapping of axis names to respective controllers (motors).
- Returns:
Mapping of axis names to controllers (later controllers overwrite earlier ones when axis names collide).
- Return type:
dict[str, MultiMotorInterface]
- class lys_instr.gui.MultiSwitch.MultiSwitchGUI(obj, axisNamesSettable=None)[source]
Bases:
QWidgetGUI widget for controlling and monitoring a multi-axis switch.
Provides controls for setting and displaying switch states for multiple axes. Accepts a
MultiControllerInterfaceinstance or a sequence of such instances. Listens to theirbusyStateChangedandaliveStateChangedsignals to update the GUI.- property controllers
Mapping of axis names to respective controllers (switches).
- Returns:
Mapping of axis names to controllers (later controllers overwrite earlier ones when axis names collide).
- Return type:
dict[str, MultiSwitchInterface]