Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 4 KB

adding-device-support.rst

File metadata and controls

102 lines (73 loc) · 4 KB

Adding support for more devices

There are three main device types that ImSwitch's hardware control module supports: detectors, lasers and positioners. In order to add support for a new detector, laser or positioner, a corresponding device manager class must be implemented in ImSwitch's code.

How device managers are implemented

Detector support is implemented in device manager classes derived from the abstract base class DetectorManager. The corresponding parent class for lasers is LaserManager, and for positioners it is PositionerManager. These derived classes are placed in the detectors, lasers and positioners sub-modules respectively in the imswitch.imcontrol.model.managers module.

The required constructor signature for the device managers is __init__(deviceInfo, name, **lowLevelManagers). deviceInfo is the DetectorInfo, LaserInfo or PositionerInfo object which represents the device's entry in the setup file (see the hardware control setup page <imcontrol-setups> for further information). Inside it, the managerProperties dict field may contain manager-specific properties. name is a unique name that is used to identify the device, which is defined by the key of the device's entry in the setup file. lowLevelManagers is a dict containing objects that facilitate low-level device interaction, which are documented here <Available low-level managers>. Note that super().__init__ has a different signature, depending on which base class is used.

When creating a new device manager, you will need to implement all the abstract methods and properties defined in the base class. You should avoid overriding non-abstract properties. Overriding non-abstract methods is generally fine, but you should make sure that they continue to work as expected. The device manager class must be placed in a .py file with the same name as the class, in the appropriate location as outlined above. No other action is required for the device manager to be available to use; it will automatically be managed by a multi-manager as outlined in the paper.

You can find a simple example of a positioner manager implementation here.

Base class documentation

DetectorManager

imswitch.imcontrol.model.managers.detectors.DetectorManager.DetectorManager

imswitch.imcontrol.model.managers.detectors.DetectorManager.DetectorAction

imswitch.imcontrol.model.managers.detectors.DetectorManager.DetectorParameter

imswitch.imcontrol.model.managers.detectors.DetectorManager.DetectorNumberParameter

imswitch.imcontrol.model.managers.detectors.DetectorManager.DetectorListParameter

LaserManager

imswitch.imcontrol.model.managers.lasers.LaserManager.LaserManager

PositionerManager

imswitch.imcontrol.model.managers.positioners.PositionerManager.PositionerManager

Available low-level managers

lowLevelManagers['nidaqManager']

imswitch.imcontrol.model.managers.NidaqManager.NidaqManager

lowLevelManagers['rs232sManager']

imswitch.imcontrol.model.managers.RS232sManager.RS232sManager

imswitch.imcontrol.model.managers.rs232.RS232Manager.RS232Manager