trspectrometer.plugins.chopper package

Module for management of optical choppers.

A chopper is used to modulate laser beams so that enhanced detection is possible by comparing the difference between the laser “on” signal to that of the laser “off”.

The implementation of the actual control of the hardware is abstracted from the software interface. The python pluginlib is used to find classes which implement and extend the Chopper class and actually communicate with the chopper device.

Chopper plugin classes which are built-in are:

To load the chopper plugin module, ensure "chopper" 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.chopper]] section is present such as the default:

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

Multiple chopper devices can be specified by including multiple [[hardware.chopper]] sections. The double rectangular brackets around [[hardware.chopper]] 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 chopper entry to use.

class trspectrometer.plugins.chopper.Chopper(**kwargs)[source]

Bases: Plugin

Parent class of all chopper plugins.

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

close() None[source]

Close the connection to the device.

get_divider() int[source]

Get the frequency divider of the chopper.

Returns:

Frequency divider.

get_enabled() bool[source]

Get the current running state of the chopper.

Returns:

True if chopper is running, False if not.

get_frequency() Optional[int][source]

Get the source frequency of the chopper.

A value of None indicates that the frequency is synced to an external source.

Returns:

Source frequency, or None if external sync.

is_initialised() bool[source]

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

set_divider(value: int) None[source]

Set the frequency divider of the chopper.

Parameters:

value – Frequency divider.

set_enabled(value: bool) None[source]

Set the current running state of the chopper.

Parameters:

valueTrue to start the chopper, False to stop.

set_frequency(value: Optional[int]) None[source]

Set the internal source frequency of the chopper.

A value of None indicates that the frequency should be synced to an external source.

Parameters:

value – Source frequency, or None if external sync.

description

Description of this chopper device.

class trspectrometer.plugins.chopper.ChopperStatusPanel(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("ChopperStatusPanel" inherits "QFrame": Methods:   #34 type=Signal, signature=devices_changed() )
trspectrometer.plugins.chopper.statuspanel

QWidget class type to use for displaying hardware status.

trspectrometer.plugins.chopper.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.chopper.close()[source]

Close any open chopper devices.

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

Initialise the chopper devices specified in the configuration file.

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

Unregister a callback function added using add_change_callback().

Parameters:

callback_function – Function to unregister.

trspectrometer.plugins.chopper.devices = [None]

List of instances of chopper device classes. The number of entries in the list should correspond to the [[hardware.chopper]] entries in the configuration file. If a device is missing or not initialised, a value of None should be used as a placeholder.

Submodules