trspectrometer.plugins.interface package

Module for management of the interface hardware.

The interface hardware is responsible for several tasks related to synchronising the various devices to the laser sync pulses, and getting that information sent back to the host computer:

  • Externally trigger the detector with the correct timings so that the detector exposure period captures the arrival of the laser’s light pulse.

  • Start detector triggering when requested by software, or on receipt of an external trigger input signal such as the delay movement.

  • Generate the appropriate synchronisation signal to drive the chopper.

  • Read and return the state of the chopper (“on” or “off”) on each triggering of the detector.

  • Read and return the state of the delay encoder (quadrature) on each triggering of the detector.

Not all functions are necessarily essential depending, for example, on the particular acquisition mode in use.

The implementation of the functionality is abstracted from the software interface. The python pluginlib is used to find classes which implement and extend the Interface class and actually communicate with the attached interface hardware.

Interface classes which are built-in include:

To load the interface plugin module, ensure "interface" is present in the Configuration File’s load=[...] list inside the Plugins section. To configure the module to use a specific driver class, ensure a [[hardware.interface]] section is present such as the default:

# Interface configuration
# The entry specifies a single device
#   name (string) : Friendly name for the interface to use in the application
#   class (string) : Name of specific class to load to drive the interface
#   options (dict) : Dictionary of key=value pairs to pass the the class init() method
[[hardware.interface]]
name = "Interface"
class = "DummyInterface"
options = {}

Multiple interface devices can be specified by including multiple [[hardware.interface]] sections. The double rectangular brackets around [[hardware.interface]] indicate that multiple sections are permitted. The same class type may be initialised multiple times with different values for its options. Acquisition methods may then select which interface entry to use.

class trspectrometer.plugins.interface.Interface(**kwargs)[source]

Bases: Plugin

Parent class for all interface plugins.

Every interface driver class should derive from this parent, so that the automatic device class discovery can function.

arm() None[source]

Arm the device, ready to be triggered by an external signal.

This acts similarly to using the start() method, but instead of immediately starting to trigger the detector, the interface will wait for a trigger signal from an external input, such as the “movement” signal from an attached delay stage.

This method is used by the ta_swept acquisition method, which requires a delay which provides both raw encoder position and movement trigger signals to the interface hardware.

close() None[source]

Close the connection to the device.

is_initialised() bool[source]

Test whether the interface hardware is present and initialised, and not in any error state.

register_data_callback(callback: callable) None[source]

Register a function to receive notifications for data received from the device.

The callback method should take the form of data_callback(quad_pos, chop_state), where quad_pos is an array of quadrature positions, and chop_state is the chopper on/off state.

Parameters:

callback – Function to call when data is received.

set_encoder_count(value: int) None[source]

Configure the current value for the delay quadrature encoder reading.

This should be set to match the delay’s own record of its quadrature value. Note that to ensure accuracy, the delay should be homed and stopped prior to reading its quadrature position.

Parameters:

value – New quadrature encoder value.

start(count: int = 0) None[source]

Begin acquisition of data.

The triggering of the detector will start immediately, and the state of the delay encoder and chopper will be collected for each trigger pulse sent to the detector. To stop the triggering, call the stop() method. Once stopped, data will be returned to any functions previously registered using the register_data_callback() method.

Setting the count parameter to a positive integer will cause the triggering to stop after the given number of trigger pulses have been sent. The default of 0 means to trigger until the stop() method is called.

Parameters:

count – Number of trigger of trigger pulses to send.

stop() None[source]

Abort the acquisition of data.

This will stop the interface regardless of whether it was started with the trigger(), start(), or arm() methods.

trigger() None[source]

Begin triggering the detector, but do not collect chopper or delay state information.

Note that data related to the delay encoder or chopper state will not be passed to any registered data callback functions when using this mode of triggering.

unregister_data_callback(callback: callable) None[source]

Unregister a function previously registered to receive data callbacks using register_data_callback().

Parameters:

callback – Function to unregister.

description

Description of this interface device.

class trspectrometer.plugins.interface.InterfaceStatusPanel(parent=None)[source]

Bases: QFrame

hideEvent(event)[source]

Handler for widget hide events.

refresh()[source]

Refresh the state of the hardware connection and update the panel’s display.

showEvent(event)[source]

Handler for widget show events.

devices_changed

Qt Signal to indicate the devices have changed in some way and the panel requires refreshing.

staticMetaObject = PySide6.QtCore.QMetaObject("InterfaceStatusPanel" inherits "QFrame": Methods:   #34 type=Signal, signature=devices_changed() )
trspectrometer.plugins.interface.statuspanel

QWidget class type to use for displaying hardware status.

trspectrometer.plugins.interface.add_change_callback(callback_function)[source]

Register a function to be called when the devices are refreshed.

Parameters:

callback_function – Function to call when devices are refreshed.

trspectrometer.plugins.interface.close()[source]

Close any open Interface devices.

trspectrometer.plugins.interface.init()[source]

Initialise the Interface device specified in the configuration file.

trspectrometer.plugins.interface.remove_change_callback(callback_function)[source]

Unregister a callback function added using add_change_callback().

Parameters:

callback_function – Function to unregister.

trspectrometer.plugins.interface.devices = [None]

Reference to a Interface class. The number of entries in the list should correspond to the [[hardware.interface]] entries in the configuration file. If a device is missing or not initialised, a value of None will be used as a placeholder.

Submodules