trspectrometer.hardware module

Module for management of various spectrometer hardware devices.

This does not actually control any hardware itself, but instead stores references to plugin modules which do the hard work.

A hardware plugin is a normal plugin module, but must also:

  • Implement a init() method to connect to and initialise the device(s).

  • Implement a close() method to disconnect from devices and free any used resources.

  • Implement a statuspanel property to return a QWidget class type (not an instance of the class!) to display device status information in the hardware status panel. This may be None if no panel is required.

  • Add a reference to itself to the modules dictionary, for example using hardware.modules[__name__] = sys.modules[__name__].

Calling of the plugin’s init() and close() methods will be handled automatically, as will creation and display of the statuspanel if provided.

class trspectrometer.hardware.HardwareStatusPanel(parent=None)[source]

Bases: QScrollArea

staticMetaObject = PySide6.QtCore.QMetaObject("HardwareStatusPanel" inherits "QScrollArea": )
trspectrometer.hardware.close()[source]

Close connections to all hardware devices.

trspectrometer.hardware.init()[source]

Initialise all hardware devices.

trspectrometer.hardware.modules = {}

Dictionary of configured hardware device modules. The keys are strings containing the name of the module, with values being the loaded module instance. Hardware plugin modules should add themselves to this, for example by using hardware.modules[__name__] = sys.modules[__name__].