Welcome to the open-cytomat documentation!

This module is an unofficial Python interface for Thermo Fisher Scientific Cytomat devices.

Usage

To control the Cytomat, use the cytomat.Cytomat class. It requires the serial port as parameter:

>>> from cytomat import Cytomat

>>> c = Cytomat("COM5")

>>> print("Current temperature:", c.climate_controller.current_temperature)
Current temperature: 37.03

>>> print("Plate on transfer station?", c.overview_status.transfer_station_occupied)
Plate on transfer station? True

>>> c.move_plate_from_transfer_station_to_slot(5)

The Cytomat class

class cytomat.Cytomat(serial_port: str)[source]
plate_handler: PlateHandler

Exposes functionality related to plate handling

barcode_scanner: BarcodeScanner

Exposes functionality of the built-in barcode scanner

maintenance_controller: MaintenanceController

Exposes maintenance functionality

climate_controller: ClimateController

Exposes functionality related to temperature and CO2

shaker_controller: ShakerController

Exposes tower shaker functionality

property overview_status: OverviewStatus

Status overview

property action_status: ActionStatus

Action status

property error_status: ErrorStatus

Error status

property warning_status: WarningStatus

Warning status

wait_until_not_busy(timeout: float, poll_interval: float = 0.5) OverviewStatus[source]

Block the current thread until the device is not busy anymore.

Parameters:
  • timeout – The timeout in seconds

  • poll_interval – The polling interval in seconds

Raises:

TimeoutError – If the device is still busy after the given timeout duration

Components

class cytomat.plate_handler.PlateHandler(serial_port: SerialPort)[source]
initialize() OverviewStatus[source]

(Re-) initialize the plate handler

move_plate_from_transfer_station_to_slot(slot: int) OverviewStatus[source]

Move a plate from the transfer station to the given slot

Parameters:

slot – The target slot

move_plate_from_slot_to_transfer_station(slot: int) OverviewStatus[source]

Move a plate from the given slot to the transfer station

Parameters:

slot – The slot where the plate is located

move_plate_from_transfer_station_to_handler() OverviewStatus[source]

Move a plate from the transfer station to the plate handler shovel

move_plate_from_handler_to_transfer_station() OverviewStatus[source]

Move a plate from the plate handler shovel to the transfer station

move_plate_from_exposed_position_to_inside() OverviewStatus[source]

Move a plate from the exposed position (above the transfer station) to the neutral position inside the device

move_plate_from_inside_to_exposed_position() OverviewStatus[source]

Move a plate from the neutral position inside the device to the exposed position (above the transfer station)

move_plate_from_handler_to_slot(slot: int) OverviewStatus[source]

Move a plate from the plate handler shovel to the given slot

Parameters:

slot – The target slot

move_plate_from_slot_to_handler(slot: int) OverviewStatus[source]

Move a plate from the given slot to the plate handler shovel

Parameters:

slot – The slot where the plate is located

move_plate_from_exposed_position_to_slot(slot: int) OverviewStatus[source]

Move a plate from the exposed position (above the transfer station) to the given slot

Parameters:

slot – The target slot

move_plate_from_slot_to_exposed_position(slot: int) OverviewStatus[source]

Move a plate from the given slot to the exposed position (above the transfer station)

Parameters:

slot – The slot where the plate is located

retract_shovel() OverviewStatus[source]

Retract the plate handler shovel

extend_shovel() OverviewStatus[source]

Extend the plate handler shovel

close_transfer_door() OverviewStatus[source]

Close the transfer door

open_transfer_door() OverviewStatus[source]

Open the transfer door

reset_handler_position() OverviewStatus[source]

Reset the handler to the neutral position

move_handler_below_slot_height(slot: int) OverviewStatus[source]

Move the handler below the given slot (only changes height, not rotation)

Parameters:

slot – The target slot

move_handler_above_slot_height(slot: int) OverviewStatus[source]

Move the handler above the given slot (only changes height, not rotation)

Parameters:

slot – The target slot

rotate_handler_to_slot(slot: int) OverviewStatus[source]

Rotate the handler to the given slot (only changes rotation, not height)

Parameters:

slot – The target slot

rotate_handler_to_transfer_station() OverviewStatus[source]

Rotate the handler to the transfer station (only changes rotation, not height)

move_x_to_slot(slot: int) OverviewStatus[source]

Move along to the given slot (only moves along the x axis)

Parameters:

slot – The target slot

class cytomat.climate_controller.ClimateController(serial_port: SerialPort)[source]
property current_temperature: float

The current temperature, in °C (read-only)

property target_temperature: float

The target temperature, in °C (can be set)

property current_co2: float

The current CO2 level (read-only)

property target_co2: float

The target CO2 level (can be set)

class cytomat.shaker_controller.ShakerController(serial_port: SerialPort)[source]
get_shaker_frequency(shaker: int) int[source]

Get the frequency of the given shaker

Parameters:

shaker – The shaker number (1-based)

Returns:

Return type:

The shaker frequency

set_shaker_frequency(shaker: int, frequency: int) OverviewStatus[source]

Set the frequency of the given shaker

Parameters:
  • shaker – The shaker number (1-based)

  • frequency – The target frequency

initialize_shakers() OverviewStatus[source]

Initialize the shakers

start_all_shakers() OverviewStatus[source]

Start all shakers

start_shaker(shaker: int) OverviewStatus[source]

Start the given shaker

Parameters:

shaker – The shaker number (1-based)

stop_all_shakers() OverviewStatus[source]

Stop all shakers

stop_shaker(shaker: int) OverviewStatus[source]

Stop the given shaker

Parameters:

shaker – The shaker number (1-based)

class cytomat.maintenance_controller.MaintenanceController(serial_port: SerialPort)[source]
reset_error_status() OverviewStatus[source]

Reset the error status

restart_device() OverviewStatus[source]

Restart the device

set_pitch(stacker: int, pitch: int) OverviewStatus[source]

Set the pitch of the given stacker

Parameters:
  • stacker – The stacker index (1-based)

  • pitch – The pitch (in steps)

send_barcode_scanner_data_via_rs232() OverviewStatus[source]

Send barcode scanner data via the RS-232 interface

send_temperate_co2_via_rs232() OverviewStatus[source]

Send barcode scanner data via the RS-232 interface

class cytomat.barcode_scanner.BarcodeScanner(serial_port: SerialPort)[source]
read_all_barcodes() OverviewStatus[source]

Real all barcodes

Returns:

Return type:

The overview status after command submission

read_barcodes_in_range(start_slot: int, end_slot: int) OverviewStatus[source]

Read all barcodes in the given range

Parameters:
  • start_slot – The start slot

  • end_slot – The end slot

Returns:

Return type:

The overview status after command submission

get_barcode_20char(slot: int) str[source]

Get the barcode at the given slot (for short barcodes)

Parameters:

slot – The slot number

Returns:

Return type:

The barcode

get_barcode_30char(slot: int) str[source]

Get the barcode at the given slot (for long barcodes)

Parameters:

slot – The slot number

Returns:

Return type:

The barcode

abort_barcode_reading() OverviewStatus[source]

Abort barcode reading

Returns:

Return type:

The overview status after command submission

property last_barcode_20char: str

The last read barcode (for short barcodes)

Returns:

Return type:

The last barcode

property last_barcode_30char: str

The last read barcode (for short barcodes)

Returns:

Return type:

The last barcode

read_barcode_at_slot(slot: int) OverviewStatus[source]

Read the barcode at the given slot

Parameters:

slot – The slot number

Returns:

Return type:

The overview status after command submission

read_20char_barcode_at_current_position() OverviewStatus[source]

Read the barcode at the current position (for short barcodes)

Returns:

Return type:

The overview status after command submission

read_30char_barcode_at_current_position() OverviewStatus[source]

Read the barcode at the current position (for long barcodes)

Returns:

Return type:

The overview status after command submission

class cytomat.swap_station.SwapStation(serial_port: SerialPort)[source]
property status: SwapStationStatus

The swap station status

rotate_to_position_1() OverviewStatus[source]

Rotate to position 1

rotate_to_position_2() OverviewStatus[source]

Rotate to position 2

Status classes

class cytomat.status.OverviewStatus(busy, ready, warning, error, shovel_occupied, transfer_door_open, device_door_open, transfer_station_occupied)[source]

Create new instance of OverviewStatus(busy, ready, warning, error, shovel_occupied, transfer_door_open, device_door_open, transfer_station_occupied)

property busy

Alias for field number 0

property ready

Alias for field number 1

property warning

Alias for field number 2

property error

Alias for field number 3

property shovel_occupied

Alias for field number 4

property transfer_door_open

Alias for field number 5

property device_door_open

Alias for field number 6

property transfer_station_occupied

Alias for field number 7

classmethod from_hex_string(hex_byte: str) OverviewStatus[source]

Create an instance from the hex string (e.g. 'F1')

class cytomat.status.ActionStatus(type, target)[source]

Create new instance of ActionStatus(type, target)

property type

Alias for field number 0

property target

Alias for field number 1

classmethod from_hex_string(hex_byte: str) ActionStatus[source]

Create an instance from the hex string (e.g. 'F1')

class cytomat.status.ActionTarget(value)[source]

An enumeration.

InitPosition = 1
WaitPosition = 2
Stacker = 3
TransferStation = 4
class cytomat.status.ActionType(value)[source]

An enumeration.

MoveHeightBelowSlot = 1
CheckHeightBelowSlot = 2
MoveHeightAboveSlot = 3
CheckHeightAboveSlot = 4
RotateToSlot = 5
CheckRotation = 6
ExtendShovel = 7
CheckExtendedShovel = 8
CheckShovelExtensionSensor = 9
RetractShovel = 10
CheckRetractedShovel = 11
CloseTransferDoor = 12
CheckTransferDoorClosed = 13
OpenTransferDoor = 14
CheckTransferDoorOpened = 15
MoveSwapStationToPos1 = 16
CheckSwapStationAtPos1 = 17
MoveSwapStationToPos2 = 18
CheckSwapStationAtPos2 = 19
CheckPlateOnShovel = 20
CheckPlateOnTransferStation = 21
MoveToBarcodeReader = 22
CheckHandlerAtBarcodeReader = 23
ReadBarcode = 24
class cytomat.status.WarningStatus(value)[source]

An enumeration.

NoWarning = 0
MotorCommunicationDisrupted = 1
PlateNotMountedOnShovel = 2
PlateNotDroppedFromShovel = 3
ShovelNotExtended = 4
ProcedureTimeout = 5
TransferDoorNotOpened = 6
TransferDoorNotClosed = 7
ShovelNotRetracted = 8
InitialisingDueToOpenedDeviceDoor = 9
TransferStationNotRotated = 12
class cytomat.status.ErrorStatus(value)[source]

An enumeration.

NoError = 0
MotorCommunicationDisrupted = 1
PlateNotMountedOnShovel = 2
PlateNotDroppedFromShovel = 3
ShovelNotExtended = 4
ProcedureTimeout = 5
TransferDoorNotOpened = 6
TransferDoorNotClosed = 7
ShovelNotRetracted = 8
StepMotorTemperatureTooHigh = 10
OtherStepMotorError = 11
TransferStationNotRotated = 12
HeatingOrCo2CommunicationDisrupted = 13
ShakerCommunicationDisrupted = 14
ShakerConfigurationOutOfOrder = 15
ShakerNotStarted = 16
ShakerClampNotOpen = 19
ShakerClampNotClosed = 20
Critical = 255
class cytomat.status.SwapStationStatus(position1_at_door, occupied_at_door, occupied_at_user)[source]

Create new instance of SwapStationStatus(position1_at_door, occupied_at_door, occupied_at_user)

property position1_at_door

Alias for field number 0

property occupied_at_door

Alias for field number 1

property occupied_at_user

Alias for field number 2

classmethod from_response_string(response: str) SwapStationStatus[source]

Create an instance from the response string (e.g. '111')

Serial Port

class cytomat.serial_port.SerialPort(port: str, *, timeout: float)[source]

Wraps a plain serial connection to simplify communication with Cytomat devices

Parameters:
  • port (str) – The address of the port (e.g. “COM3” on Windows or “/dev/ttyACM0” on Unix)

  • timeout (float, seconds) – A TimeoutError will be raised of read or write operations took longer than this duration

issue_action_command(command: str) OverviewStatus[source]

Issue a command which results in ‘ok XX’ or ‘er XX’.

Parameters:

command (str) – The command

Returns:

The current device status, as given by the response ‘ok XX’

Return type:

OverviewStatus

Raises:
issue_status_command(command: str) str[source]

Issue a status command in the form of ‘ch:xx’ or ‘ch:xx …’, which results in responses like ‘xx …’. Returns the response without the prefix

Parameters:

command (str) – The command

Returns:

The response without the prefix

Return type:

str

Raises:

InvalidCommand – If the command did not match ‘ch:xx’ or ‘ch:xx …’

Examples

>>> self.issue_action_command("ch:bs")
'01'  # full response was 'bs 01'

Errors

exception cytomat.errors.UnexpectedResponse[source]
exception cytomat.errors.InvalidCommand[source]
exception cytomat.errors.SerialCommunicationError[source]

Errors corresponding to device responses ‘er XX’

exception cytomat.errors.UnknownErrorCode[source]
exception cytomat.errors.DeviceBusy[source]
exception cytomat.errors.CommandUnknown[source]
exception cytomat.errors.InvalidCommandTelegramStructure[source]
exception cytomat.errors.WrongTelegramParameters[source]
exception cytomat.errors.UnknownSlotNumber[source]
exception cytomat.errors.WrongHandlerPosition[source]
exception cytomat.errors.ShovelNotExtended[source]
exception cytomat.errors.HandlerOccupied[source]
exception cytomat.errors.HandlerEmpty[source]
exception cytomat.errors.TransferStationEmpty[source]
exception cytomat.errors.TransferStationNotInPosition[source]
exception cytomat.errors.TransferDoorNotConfigured[source]
exception cytomat.errors.TransferDoorNotOpen[source]
exception cytomat.errors.TransferStationOccupied[source]
exception cytomat.errors.InternalMemoryAccessError[source]
exception cytomat.errors.UnauthorizedAccess[source]
exception cytomat.errors.InvalidResponseTelegramStructure[source]
exception cytomat.errors.Timeout[source]
exception cytomat.errors.ShakerNotActive[source]