photons.equipment.thorlabs_stage module

Communicate with a Thorlabs translation/rotation stage.

class photons.equipment.thorlabs_stage.ThorlabsStage(record, **kwargs)[source]

Bases: KinesisBase

Communicate with a Thorlabs translation/rotation stage.

The ConnectionRecord.properties attribute must contain the “encoder_factor” to convert the encoder position to real-world units.

Parameters:
  • record (EquipmentRecord) – The equipment record.

  • **kwargs – Keyword arguments. Can be specified as attributes of an XML element in a configuration file (with the tag of the element equal to the alias of record).

connection: IntegratedStepperMotors | BenchtopStepperMotor
info()[source]

Returns the information about the stage.

For example:

{
  'unit': str, either ' mm' or the unicode value of the degree symbol
  'minimum': float, the minimum position that the stage can be set to
  'maximum': float, the maximum position that the stage can be set to
}
Return type:

dict[str, float | str]

home(wait=True)[source]

Home the stage.

Parameters:

wait (bool) – Whether to wait for the stage to finish homing before returning to the calling program.

Return type:

None

stop()[source]

Stop moving immediately.

Return type:

None

get_encoder()[source]

Returns the value of the encoder.

Return type:

int

get_position()[source]

Returns the position of the stage (in mm or degrees).

Return type:

float

set_position(position, wait=True)[source]

Set the position of the stage (in mm or degrees).

Parameters:
  • position (float) – The position, in mm or degrees.

  • wait (bool) – Whether to wait for the stage to finish moving before returning to the calling program.

Return type:

None

to_human(encoder, ndigits=4)[source]

Convert the encoder value to human units.

Parameters:
  • encoder (int) – The value of the encoder.

  • ndigits (int) – Round the value to ndigits precision (see round() for more details).

Return type:

float

Returns:

The position (in mm or degrees).

to_encoder(position)[source]

Convert the position (in mm or degrees) to an encoder value.

Parameters:

position (float) – The position of the stage (in mm or degrees).

Return type:

int

Returns:

The encoder value.