Instrument

class asgard_alignment.Instrument.Instrument(config_pth)

Bases: object

A class that creates connections to controllers, ESOdevice instances, and provides a means for the MDS to communicate with the Instrument. Open an instrument with a configuration file. The configuration file must be a JSON file with the following format:

[
    {
        "name": "HTPP1",
        "serial_number": "123456",
        "motor_type": "M100D",
        "motor_config": {}
    },
]

The Instrument will attempt to connect to each device in the config file, opening and saving connections to the controllers and devices.

Parameters:

config_pth (str) – The path to the configuration file for the instrument

Return type:

None

Attributes Summary

devices

A dictionary of devices with the device name as the key

Methods Summary

compute_serial_to_port_map()

By inspecting the list of usb devices, find the serial number of the motor and the corresponding port (e.g. /dev/ttyUSB0).

find_zaber_usb_port()

Find the COM port for the Zaber motor

Attributes Documentation

devices

A dictionary of devices with the device name as the key

Methods Documentation

static compute_serial_to_port_map()

By inspecting the list of usb devices, find the serial number of the motor and the corresponding port (e.g. /dev/ttyUSB0)

Returns:

mapping – A dictionary that maps the serial number of the motor to the port

Return type:

dict

static find_zaber_usb_port()

Find the COM port for the Zaber motor

Returns:

str

The COM port for the Zaber motor

static compute_serial_to_port_map()

By inspecting the list of usb devices, find the serial number of the motor and the corresponding port (e.g. /dev/ttyUSB0)

Returns:

mapping – A dictionary that maps the serial number of the motor to the port

Return type:

dict

property devices

A dictionary of devices with the device name as the key

static find_zaber_usb_port()

Find the COM port for the Zaber motor

Returns:

str

The COM port for the Zaber motor

health()

Summarise the health of the instrument in a json format with the following - axis name - motor type - is connected - state

ping_connection(axis)

Ping the connection to the motor

Parameters:

axis (str) – The name of the motor to ping

Returns:

True if the connection is successful, False otherwise

Return type:

bool