Prior Proscan Stage Controller#

class QInstrument.instruments.PriorScientific.Proscan.instrument.QProscan(portName=None, **kwargs)[source]#

Bases: QPollingMixin, QSerialInstrument

Prior Scientific Proscan II/III Microscope Stage Controller.

Controls the XY stage and Z focus drive of a Prior Scientific motorized microscope stage over RS-232.

Signals#

positionChanged(list[int])

Emitted by position() with the current [x, y, z] coordinates in µm.

limitsChanged(object)

Emitted by _poll() with the result of active_limits() after each position update. Value is a tuple[bool, bool, bool, bool] or None.

Properties#

speedint

Maximum XY stage speed. Range [1, 100].

accelerationint

XY stage acceleration. Range [1, 100].

scurveint

Time derivative of XY stage acceleration. Range [1, 100].

stepsizefloat

XY single-step size [µm].

zspeedint

Maximum focus drive speed. Range [1, 100].

zaccelerationint

Focus drive acceleration. Range [1, 100].

zscurveint

Time derivative of focus acceleration. Range [1, 100].

zstepsizefloat

Focus drive single-step size [µm].

xresolutionfloat

X-axis encoder resolution [µm/step]. Read-only.

yresolutionfloat

Y-axis encoder resolution [µm/step]. Read-only.

zresolutionfloat

Z-axis encoder resolution [µm/step]. Read-only.

uprfloat

XY stage µm per revolution [µm/rev].

zuprfloat

Z focus drive µm per revolution [µm/rev].

flipbool

True: invert Y axis direction.

mirrorbool

True: invert X axis direction.

movingbool

True if the stage or focus drive is currently in motion. Read-only.

limitstuple[bool, bool, bool, bool] or None

Active limit switches per axis (x, y, z, fourth), or None if no limits are currently active. Read-only.

Limit Switch Bits#

Both = (triggered since last read) and LMT (currently active) return a one-byte hex value. Each bit identifies one limit switch:

Bit

Mask

Limit

D00

0x01

+X

D01

0x02

−X

D02

0x04

+Y

D03

0x08

−Y

D04

0x10

+Z

D05

0x20

−Z

D06

0x40

+4th

D07

0x80

−4th

RS-232 Commands#

Command

Args

Response

Description

?

…,END

Hardware description (multi-line, ends with END)

$

int

Motion status bitmask (bits 0-3: motion active)

=

hex

Limit switches triggered since last read

LMT

hex

Currently active limit switches

I

R

Controlled stop (decelerate to halt)

K

R

Emergency stop (immediate halt)

VERSION

str

Firmware version string

SERIAL

str

Controller serial number

COMP

mode

0

Communication mode (0 = standard)

P

x,y,z

Query current stage position [µm]

P

x,y[,z]

0

Define current position label [µm]

Z

0

Zero: set coordinate origin at current position

G

x,y[,z]

R

Absolute move to position [µm]

GR

x,y[,z]

R

Relative move by offset [µm]

GX

x

R

Move X axis to absolute position [µm]

GY

y

R

Move Y axis to absolute position [µm]

GZ

z

R

Move Z (focus) to absolute position [µm]

M

R

Move to origin (coordinate zero)

VS

vx,vy

R

Continuous XY velocity [µm/s]; VS,0,0 to stop

VZ

vz

R

Continuous Z velocity [µm/s]; VZ,0 to stop

H

R

Home stage to hardware limits

L

R

Step one increment in −X direction

R

R

Step one increment in +X direction

F

R

Step one increment in +Y direction

B

R

Step one increment in −Y direction

U

R

Step focus drive one increment upward

D

R

Step focus drive one increment downward

X

sx,sy

Query XY step sizes [µm]

X

sx,sy

0

Set XY step sizes [µm]

C

sz

Query Z step size [µm]

C

sz

0

Set Z step size [µm]

XD

±1

0

Set X-axis direction (+1 normal, −1 inverted)

YD

±1

0

Set Y-axis direction (+1 normal, −1 inverted)

SMS

[n]

int/0

Get/set XY max speed [1–100]

SAS

[n]

int/0

Get/set XY acceleration [1–100]

SCS

[n]

int/0

Get/set XY S-curve factor [1–100]

SMZ

[n]

int/0

Get/set Z max speed [1–100]

SAZ

[n]

int/0

Get/set Z acceleration [1–100]

SCZ

[n]

int/0

Get/set Z S-curve factor [1–100]

RES,X

float

Query X-axis encoder resolution [µm/step]

RES,Y

float

Query Y-axis encoder resolution [µm/step]

RES,Z

float

Query Z-axis encoder resolution [µm/step]

UPR

[v]

float/0

Get/set XY µm per revolution [µm/rev]

ZUPR

[v]

float/0

Get/set Z µm per revolution [µm/rev]

J

n

0

Joystick enable (1) / disable (0)

JXD

±1

0

Joystick X direction (+1 normal, −1 inverted)

JYD

±1

0

Joystick Y direction (+1 normal, −1 inverted)

JZD

±1

0

Joystick Z direction (+1 normal, −1 inverted)

STAGE

…,END

Stage description (multi-line, ends with END)

FOCUS

…,END

Focus system description (multi-line, ends with END)

positionChanged#

alias of object

limitsChanged#

alias of object

POLL_INTERVAL: int = 200#

Milliseconds between the end of one poll response and the start of the next query. Default: 0 (maximum throughput).

comm = {'baudRate': qtpy.QtSerialPort.QSerialPort.BaudRate.Baud9600, 'dataBits': qtpy.QtSerialPort.QSerialPort.DataBits.Data8, 'eol': '\r', 'flowControl': qtpy.QtSerialPort.QSerialPort.FlowControl.NoFlowControl, 'parity': qtpy.QtSerialPort.QSerialPort.Parity.NoParity, 'stopBits': qtpy.QtSerialPort.QSerialPort.StopBits.OneStop}#
property settings: dict[str, bool | int | float | str]#

Current values of all writable registered properties.

Getting this property calls every qualifying getter, which may issue instrument queries. A property qualifies when its setter is not None (writable).

Setting it calls each registered setter for keys present in the supplied dict, skipping unknown keys and read-only properties. Unlike set(), the setter does not emit propertyValue for each key; call _syncProperties() after a bulk restore if the UI must reflect the new values.

Subclasses that need to exclude specific properties from save/restore (e.g. motion-speed parameters that must not be silently overwritten on reconnect) should override both the getter and setter to filter those names. See QProscan for an example.

receive(**kwargs)[source]#

Return the next response line, handling E18 queue-full errors.

If the controller returns E18 (command queue full), logs a warning and returns an empty string so that all callers treat the response as a failed read.

Return type:

str

Returns:

str – Response string, or '' on timeout or E18.

identify()[source]#

Return True if the device responds to COMP,0 with '0'.

Sets the controller to standard communication mode as a side effect, ensuring a known state for all subsequent commands.

Return type:

bool

Returns:

bool – True if the controller acknowledges COMP,0.

version()[source]#

Return the 3-character firmware version string.

Return type:

str

position()[source]#

Return the current stage position and emit positionChanged.

Return type:

list[int]

Returns:

list[int][x, y, z] coordinates of the current stage position in µm.

set_position(position)[source]#

Define the coordinates of the current physical position.

No axis may be moving when this command is issued. Returns False immediately if the stage is in motion.

Parameters:

position (list[int]) – [x, y] or [x, y, z] coordinates to assign to the current stage position, in µm.

Return type:

bool

Returns:

bool – True if the controller acknowledged the command.

set_origin()#

Set the coordinate system origin to the current position.

Return type:

bool

Returns:

bool – True if the controller acknowledged the command.

move_to(position, relative=False)[source]#

Move the stage to a target position.

Parameters:
  • position (list[int]) – [x, y] target coordinates in µm.

  • relative (bool) – True: move by position relative to current location. False: move to the absolute coordinates. Default: False.

Return type:

bool

Returns:

bool – True once the controller acknowledges the motion command.

move_to_origin()[source]#

Move the stage to the coordinate origin.

Return type:

bool

Returns:

bool – True once the controller acknowledges the motion command.

set_velocity(velocity)#

Start continuous stage motion at the specified velocity.

Passing [0, 0] stops motion. Velocity is maintained until a new set_velocity() or stop() call.

Parameters:

velocity (list[float]) – [vx, vy] velocity components in µm/s.

Return type:

None

stop()#

Stop all stage and focus motion immediately.

Return type:

bool

Returns:

bool – True once the controller acknowledges the stop command.

status()[source]#

Return the raw controller status word.

Return type:

int

Returns:

int – Bitmask; bits 0–3 indicate motion in progress.

emergency_stop()#

Stop all stage and focus motion immediately without deceleration.

Sends the K command (hard stop). Prefer stop() for normal halts; use this only when immediate cessation is required.

Return type:

bool

Returns:

bool – True if the controller acknowledged the command.

triggered_limits()[source]#

Return per-axis limit switches triggered since the last read.

Reads the = register, which clears automatically on read. Returns None if no limits were triggered, so callers can use a simple truthiness check.

Return type:

tuple[bool, bool, bool, bool] | None

Returns:

tuple[bool, bool, bool, bool] or None(x, y, z, fourth)True on each axis that had a limit triggered since the previous call; None if none.

active_limits()[source]#

Return per-axis limit switches currently in contact.

Returns None if no limits are active, so callers can use a simple truthiness check.

Return type:

tuple[bool, bool, bool, bool] | None

Returns:

tuple[bool, bool, bool, bool] or None(x, y, z, fourth)True on each axis whose limit switch is currently active; None if none.

stepLeft()[source]#

Step the stage one increment in the −X direction.

Return type:

bool

stepRight()[source]#

Step the stage one increment in the +X direction.

Return type:

bool

stepForward()[source]#

Step the stage one increment in the +Y direction.

Return type:

bool

stepBackward()[source]#

Step the stage one increment in the −Y direction.

Return type:

bool

stepUp()[source]#

Step the focus drive one increment upward.

Return type:

bool

stepDown()[source]#

Step the focus drive one increment downward.

Return type:

bool

description()[source]#

Return lines of hardware description from the controller.

Return type:

list[str]

stage()[source]#

Return lines of stage description from the controller.

Return type:

list[str]

focus()[source]#

Return lines of focus system description from the controller.

Return type:

list[str]

class QInstrument.instruments.PriorScientific.Proscan.fake.QFakeProscan(*args, **kwargs)[source]#

Bases: QFakeInstrument, QProscan

Simulated Prior Proscan controller for UI development.

Mirrors all properties of QProscan using an in-memory store. No hardware is required.

positionChanged#

alias of object

limitsChanged#

alias of object

identify()[source]#

Return True if the device responds to COMP,0 with '0'.

Sets the controller to standard communication mode as a side effect, ensuring a known state for all subsequent commands.

Return type:

bool

Returns:

bool – True if the controller acknowledges COMP,0.

position()[source]#

Return the simulated stage position and emit positionChanged.

Return type:

list[int]

set_position(position)[source]#

Store the given coordinates as the current simulated position.

Return type:

bool

set_origin()[source]#

Set the simulated origin to [0, 0, 0].

Return type:

bool

status()[source]#

Return 0 (not moving, no faults).

Return type:

int

emergency_stop()[source]#
Return type:

bool

triggered_limits()[source]#

Return per-axis limit switches triggered since the last read.

Reads the = register, which clears automatically on read. Returns None if no limits were triggered, so callers can use a simple truthiness check.

Return type:

None

Returns:

tuple[bool, bool, bool, bool] or None(x, y, z, fourth)True on each axis that had a limit triggered since the previous call; None if none.

active_limits()[source]#

Return per-axis limit switches currently in contact.

Returns None if no limits are active, so callers can use a simple truthiness check.

Return type:

None

Returns:

tuple[bool, bool, bool, bool] or None(x, y, z, fourth)True on each axis whose limit switch is currently active; None if none.

stop()[source]#
Return type:

bool

move_to(position, relative=False)[source]#

Move the stage to a target position.

Parameters:
  • position (list[int]) – [x, y] target coordinates in µm.

  • relative (bool) – True: move by position relative to current location. False: move to the absolute coordinates. Default: False.

Return type:

bool

Returns:

bool – True once the controller acknowledges the motion command.

move_to_origin()[source]#

Move the stage to the coordinate origin.

Return type:

bool

Returns:

bool – True once the controller acknowledges the motion command.

set_velocity(velocity)[source]#
Return type:

None

stepLeft()[source]#

Step the stage one increment in the −X direction.

Return type:

bool

stepRight()[source]#

Step the stage one increment in the +X direction.

Return type:

bool

stepForward()[source]#

Step the stage one increment in the +Y direction.

Return type:

bool

stepBackward()[source]#

Step the stage one increment in the −Y direction.

Return type:

bool

stepUp()[source]#

Step the focus drive one increment upward.

Return type:

bool

stepDown()[source]#

Step the focus drive one increment downward.

Return type:

bool

description()[source]#

Return lines of hardware description from the controller.

Return type:

list[str]

stage()[source]#

Return lines of stage description from the controller.

Return type:

list[str]

focus()[source]#

Return lines of focus system description from the controller.

Return type:

list[str]

class QInstrument.instruments.PriorScientific.Proscan.widget.QProscanWidget(*args, interval=None, **kwargs)[source]#

Bases: QInstrumentWidget

Control widget for the Prior Scientific Proscan stage controller.

Displays the current XY and Z position, provides a joystick for continuous XY motion, a rotary encoder for Z focus, and spinboxes for speed, acceleration, and step-size settings.

Position displays turn red when the corresponding axis limit switch is active.

UIFILE = '/home/docs/checkouts/readthedocs.org/user_builds/qinstrument/envs/latest/lib/python3.12/site-packages/QInstrument/instruments/PriorScientific/Proscan/ProscanWidget.ui'#
INSTRUMENT#

alias of QProscan

HARDWARE_DOMINANT = True#
showEvent(event)[source]#

Reconcile device settings on first show.

On the first time the widget is shown, schedules _firstShow() via a zero-delay timer so that reconciliation runs after Qt has finished processing the show event. This avoids a crash caused by opening a modal dialog (nested event loop) from inside an event handler. Subsequent show events are passed through without reconciling.

Return type:

None

class QInstrument.instruments.PriorScientific.Proscan.tree.QProscanTree(*args, device=None, fields=None, **kwargs)[source]#

Bases: QInstrumentTree

Parameter tree for the Prior Scientific Proscan stage controller.

INSTRUMENT#

alias of QProscan