AFL.automation.prepare.VirtualOT2HTTPDriver#

Functions

listify(obj)

Classes

Driver(name[, defaults, overrides, ...])

OT2HTTPDriver([overrides])

HTTP-backed Opentrons OT-2 driver.

VirtualOT2HTTPDriver([overrides])

In-memory mock of OT2HTTPDriver for CI testing.

class AFL.automation.prepare.VirtualOT2HTTPDriver.VirtualOT2HTTPDriver(overrides=None)[source]#

In-memory mock of OT2HTTPDriver for CI testing.

This driver inherits from OT2HTTPDriver but overrides all network-facing functionality. Calls simply update internal state and log actions, allowing test suites to exercise OT2-dependent code without requiring hardware or the HTTP server.

__init__(overrides=None)[source]#

Initialize the OT-2 HTTP driver.

Parameters:

overrides (dict, optional) – Configuration values that override the class defaults.

Examples

>>> driver = OT2HTTPDriver({"robot_ip": "127.0.0.1", "robot_port": "31950"})
>>> driver.base_url
'http://127.0.0.1:31950'
reset()[source]#

Reset all stored state.

home(**kwargs)[source]#

Home the robot’s axes using the dedicated /robot/home endpoint.

This endpoint is a direct control endpoint and doesn’t require creating a run. It can be used to home all axes at once or specific axes as needed.

load_labware(name, slot, module=None, **kwargs)[source]#

Load labware into a deck slot or module.

Parameters:
  • name (str) – Labware load name or namespace/load_name key.

  • slot (str) – Deck slot identifier.

  • module (str, optional) – Module identifier when loading onto a module.

  • check_run_status (bool, default=True) – If False, skip the run-status GET check when ensuring a run.

  • **kwargs – Additional options, including labware_json for custom labware.

Returns:

Loaded labware identifier returned by the robot.

Return type:

str

load_instrument(name, mount, tip_rack_slots, **kwargs)[source]#

Load a pipette and initialize tip tracking.

Parameters:
  • name (str) – Pipette name or alias.

  • mount ({"left", "right"}) – Mount on which to load the pipette.

  • tip_rack_slots (sequence of str) – Slots containing compatible tipracks.

  • reload (bool, default=False) – If True, preserve existing tip availability during run reload.

  • check_run_status (bool, default=True) – If False, skip the run-status GET check when ensuring a run.

  • update_pipettes (bool, default=True) – If False, skip refreshing attached pipette metadata.

Returns:

Loaded pipette identifier returned by the robot.

Return type:

str

pick_up_tip(mount)[source]#
drop_tip(mount)[source]#
transfer(source, dest, volume, drop_tip=True, **kwargs)[source]#

Transfer liquid between two deck locations.

Parameters:
  • source (str) – Source deck location such as "2A1".

  • dest (str) – Destination deck location such as "3B1".

  • volume (float) – Requested transfer volume in microliters.

  • mix_before (sequence of int and float, optional) – Two-item sequence (repetitions, volume_ul) applied before the aspirate step.

  • mix_after (sequence of int and float, optional) – Two-item sequence (repetitions, volume_ul) applied after the dispense step.

  • air_gap (float, default=0) – Air gap volume in microliters.

  • aspirate_rate (float, optional) – Aspirate flow rate in microliters per second.

  • dispense_rate (float, optional) – Dispense flow rate in microliters per second.

  • mix_aspirate_rate (float, optional) – Aspirate flow rate used during mix cycles.

  • mix_dispense_rate (float, optional) – Dispense flow rate used during mix cycles.

  • blow_out (bool, default=False) – If True, perform a blow-out after dispensing.

  • post_aspirate_delay (float, default=0.0) – Delay in seconds after moving above the source well.

  • aspirate_equilibration_delay (float, default=0.0) – Delay in seconds while the tip remains in the source liquid after aspirating.

  • post_dispense_delay (float, default=0.0) – Delay in seconds after dispensing.

  • drop_tip (bool, default=True) – If True, discard the tip after the transfer.

  • return_tip (bool, default=False) – If True, return the tip to its origin instead of discarding it.

  • force_new_tip (bool, default=False) – If True, force a fresh tip between split sub-transfers.

  • to_top (bool, default=True) – Dispense at the top of the destination well.

  • to_center (bool, default=False) – Dispense at the center of the destination well.

  • to_top_z_offset (float, default=0) – Additional z-offset applied when dispensing to the top.

  • source_z_offset (float, default=0) – Additional z-offset applied when aspirating from the source.

  • tip_rack_offset (dict, optional) – Offset mapping with x, y, and z keys used for tip pickup and tip return.

  • return_tip_z_offset (float, optional) – Return-only z-offset applied when returning a tip to its origin. If omitted, the existing tip_rack_offset z value is used.

  • fast_mixing (bool, default=False) – Reserved flag for higher-level callers.

  • touch_tip (bool, default=False) – If True, touch the tip to the destination well after dispense.

  • tip_location (str, optional) – Explicit tip location to use, for example "1A1".

  • **kwargs – Additional compatibility aliases such as blowout and touchTip.

Returns:

Structured transfer metadata including selected pipette, subtransfer volumes, source and destination well metadata, and applied options.

Return type:

dict

Raises:
  • ValueError – If the transfer request is invalid or no suitable pipette is loaded.

  • RuntimeError – If the underlying robot command fails.

Examples

>>> driver.transfer("2A1", "3A1", 150)
>>> driver.transfer(
...     "2A1",
...     "3A1",
...     50,
...     mix_before=(3, 40),
...     return_tip=True,
...     tip_rack_offset={"x": 0, "y": 0, "z": -1},
... )