motion package

motion.elliptec_server module

Allows control of Thorlabs elliptec stages.

class motion.elliptec_server.elliptecServer

Bases: HardwareInterfaceServer

Provides access to Thorlabs elliptec stages.

N_CHANNELS = 1
STATUS_DICT = {'00': 'OK', '01': 'Communication time out', '02': 'Mechanical time out', '03': 'Command error', '04': 'Value out of range', '05': 'Module isolated', '06': 'Module out of isolation', '07': 'Initializing error', '08': 'Thermal error', '09': 'Busy', '10': 'Sensor error', '11': 'Motor error', '12': 'Out of range', '13': 'Over current error'}
TICKS_PER_MM = 1024.0
__init__()
static decode_message(msg)

Decodes a message from the elliptec stage into a dictionary.

Parameters:

msg (str) – A message from the elliptec stage

Returns:

A dictionary of the information included in the message

Return type:

dict

get_position(self, c)

Reads the current position of the selected device

Parameters:

c – The LabRAD context

Yields:

float – The stage’s position in mm. Note that, if the device is not homed, the value can overflow and be very large.

home(self, c)

Move the stage to the home position.

Parameters:

c – The LabRAD context

Yields:

str – A serialized JSON describing the stage’s status. Includes position if the homing is complete.

initServer(self)

Lists connected elliptec stages, if any, and connects to the first one.

move_abs(c, pos)

home(self, c)

Move the stage to the a position relative to home.

Parameters:
  • c – The LabRAD context

  • pos (float) – The target position in milimeters

Yields:

str – A serialized JSON describing the stage’s status. Includes position if the move is complete.

name = '%LABRADNODE%_elliptec'
refresh_available_interfaces()

fill self.interfaces with available hardware

status(self, c)

Get the status of the stage

Parameters:

c – The LabRAD context

Yields:

str – A serialized JSON describing the stage’s status.

motion.elliptec_server.to_hex(x, bits)

Converts an integer to two’s complement hex

Parameters:
  • x (int) – A number

  • bits (int) – The number of bits in the output number

Returns:

A hex string representing x in two’s complement

Return type:

str

motion.elliptec_server.twos_complement(hexstr, bits)

Converts a hex string of a two’s complement number to an integer

Parameters:
  • hexstr (str) – The number in hex

  • bits (int) – The number of bits in hexstr

Returns:

An integer containing the number

Return type:

int