pystages.pi

class pystages.pi.PI(dev: str | None = None, baudrate: int = 115200, addresses: List[int] = [1])

Class to control PI stages.

__init__(dev: str | None = None, baudrate: int = 115200, addresses: List[int] = [1]) None

Initialize the PI stage.

Parameters:
  • dev – Serial device string (for instance ‘/dev/ttyUSB0’ or ‘COM0’), an instance of Link, or an instance of SMC100 sharing the same serial device. If not provided, a suitable device is searched according to according to vendor and product IDs

  • baudrate – Baudrate for the serial connection.

  • addresses – An iterable of int controller addresses.

error() List[PIError]

Get the error status of the stage.

Returns:

The error status of the stage.

fast_reference(negative_limit=True)

Perform a fast reference move.

Parameters:

address – The address of the stage.

home(wait=False)

Move the stage to the home position (make a reference to low limit).

Parameters:

wait – If True, wait for the stage to reach the home position.

idn() List[str]

Get the ID of the stage.

Returns:

The ID of the stage.

property is_moving: bool

Check if the stage is moving.

Parameters:

address – The address of the stage.

Returns:

True if the stage is moving, False otherwise.

is_reference_needed() bool

Check if a reference move is needed for at least one axis.

Returns:

True if a reference move is needed, False otherwise.

move(address: int, position: float) None

Move the stage to the specified position.

Parameters:
  • address – The address of the stage.

  • position – The position to move to.

property position: Vector

Get the position of the stage.

Returns:

The position of the stage.

query(command: str, address: int | None = None, args=None) List[str]

Send a command to the stage and return the response.

Parameters:
  • address – The address of the stage.

  • command – The command to send.

Returns:

The response from the stage.

property reference_methods

Get the reference methods.

0: An absolute position value can be assigned with POS,

or a referencing move can be started with FRF, FNL or FPL.

1 (default): A referencing move must be started with FRF, FNL or FPL.

Using POS is not allowed.

stop()

Stop the stage.

Parameters:

address – The address of the stage.

class pystages.pi.PIError(value)

An enumeration.

class pystages.pi.PIReferencingMethod(value)

Enum for PI reference methods.