microscope.controllers.prior module

Prior controller.

class microscope.controllers.prior.ProScanIII(port: str, baudrate: int = 9600, timeout: float = 0.5, **kwargs)[source]

Bases: microscope.devices.ControllerDevice

Prior ProScanIII controller.

The controlled devices have the following labels:

filter 1
Filter wheel connected to connector labelled “FILTER 1”.
filter 2
Filter wheel connected to connector labelled “FILTER 1”.
filter 3
Filter wheel connected to connector labelled “A AXIS”.


The Prior ProScanIII can control up to three filter wheels. However, a filter position may have a different number dependening on which connector it is. For example, using an 8 position filter wheel, what is position 1 on the filter 1 and 2 connectors, is position 4 when on the A axis (filter 3) connector.


Map of names to the controlled devices.

class microscope.controllers.prior._ProScanIIIConnection(port: str, baudrate: int, timeout: float)[source]

Bases: object

Connection to a Prior ProScanIII and wrapper to its commands.

Devices that are controlled by the same controller should share the same connection instance to ensure correct synchronization of communications from different threads. This ensures that commands for different devices, or replies from different devices, don’t get entangled.

This class also implements the logic to parse and validate commands so it can be shared between multiple devices.

_command_and_validate(command: bytes, expected: bytes) → None[source]

Send command and raise exception if answer is unexpected

assert_filterwheel_number(number: int) → None[source]
changed_timeout(new_timeout: float)[source]
command(command: bytes) → None[source]

Send command to device.

get_command(command: bytes) → bytes[source]

Send get command and return the answer.

get_description(command: bytes) → bytes[source]

Send a get description command and return it.

get_filter_position(number: int) → int[source]
get_n_filter_positions(number: int) → int[source]
has_filterwheel(number: int) → bool[source]
move_command(command: bytes) → None[source]

Send a move command and check return value.

read_until_timeout() → None[source]

Read until timeout; used to clean buffer if in an unknown state.

readline() → bytes[source]

Read a line from the device connection.

set_command(command: bytes) → None[source]

Send a set command and check return value.

set_filter_position(number: int, pos: int) → None[source]