Gl100

A class to control and interface with the PTI tunable dye laser.

Attributes

LOWER_LIMIT (float)

Lowest limit laser can be set to in nm (380.00)

UPPER_LIMIT (float)

Highest limit laser can be set to in nm (750.00)

ZERO (string)

Command used to zero the stepper motor (X0= 15T)

GET_MANUFACTURER (string)

Command used to get the manufacturer information (X-12?)

GET_POSTION (string)

Used to get the current stepper motor position (X-1?)

toml_config (dict)

Default configuration template for the device

data (dict)

Measurement data storage

config

Bound configuration as defined by the user

connect_to_rex (bool)

Whether to connect to rex experiment manager

sock

Socket connection when rex is enabled

step_size (float)

Step size for wavelength measurements.

start_wavelength (float)

Initial start wavelength for a scan

final_wavelength (float)

End wavelength for a measurement scan

grating_factor (float)

Factor related to the diffraction grating used in the system.

name (string)

Name or identifier for the device.

scan_data (dict)

Stores data related to the scan, namely positions and motor steps required, as well as error from desired wavelenght goals.

start_measurement_position (float)

Position of the start wavelength in stepper motor units.

end_measurement_position (float)

Position of the end wavelength in stepper motor units.

min_step_size (float)

Minimum allowable step size for the measurement system. (min 1/grating factor nm)

current_index (int)

The current index position within a scan or measurement sequence.

total_steps_from_zero (int)

Total number of steps the stepper motor has moved from the zero position.

total_steps (int)

Total number of steps required to complete the scan from start to end.

Configuration

This class requires configuration in your config.toml file:

Example Configuration


[device.GL100_Dye_Laser]
# GL100_Dye_Laser measurement configuration
# Step size in nm
step_size = 0.1
# Calibrated wavelength from mechanical dial (nm)
initial_position = 490
# Start wavelength in (nm)
start_position = 500
# End wavelength in (nm)
end_position = 600
# Dye used for the experiment
dye = "C540"

Methods

setup_config

Sets up the device configuration by loading necessary parameters from the config file and checks any hardware limits. Connects to the correct port if the device is found.

check_limits

Checks if the configured positions are within the device's wavelength limits. Raises: DeviceError: If any position is outside the defined LOWER_LIMIT or UPPER_LIMIT.

check_step

Signature: check_step(step_size)

Ensures the step size is not smaller than the minimum allowed step size. Logs a warning if the step size is adjusted.

Args: step_size (float): Desired step size.

move_to_next_position

Moves to the next scan position and returns the corresponding scan data.

Returns: dict or None: Next position data or None if scan is complete.

move

Signature: move(steps)

Moves the stepper motor by the specified number of steps.

Args: steps (int): Number of steps to move.

measure

Performs a measurement at the current scan position.

Returns: dict or None: Measurement data at the current position, or None if the scan is complete.

find_correct_port

Signature: find_correct_port(expected_response, baudrate, timeout)

connect

send_command

Signature: send_command(command)

return_to_zero

Return to the zero position by moving exact negative of total steps. Includes backlash compensation.

move_to_start

Move to start position with backlash compensation. Always approaches from lower wavelength to avoid mechanical backlash.

Returns: float: The actual position reached in nm.