AFL.automation.prepare.OT2Prepare#
Functions
|
Ensure that a number has units and convert to the default_units |
|
Classes
|
|
|
HTTP-backed Opentrons OT-2 driver. |
|
Preparation-oriented OT-2 driver. |
|
Base class for prepare drivers. |
- class AFL.automation.prepare.OT2Prepare.OT2Prepare(overrides=None)[source]#
Preparation-oriented OT-2 driver.
This class combines
OT2HTTPDrivertransport primitives with the higher-level preparation workflow implemented byPrepareDriver. It adds stock-aware tip reservation, destination occupancy tracking, and execution helpers for preparation plans.- Parameters:
overrides (dict, optional) – Configuration overrides merged into the inherited defaults.
Examples
>>> driver = OT2Prepare({"robot_ip": "192.168.1.50"}) >>> driver.add_prep_targets(["4A1", "4A2"]) >>> driver.resolve_destination(None) '4A1'
- defaults = {'catch_protocol': {}, 'catch_volume': '900 ul', 'deck': {}, 'fixed_compositions': {}, 'prep_targets': [], 'prepare_volume': '900 ul', 'stock_locations': {}, 'stock_mix_order': [], 'stock_transfer_params': {}, 'stocks': []}#
- __init__(overrides=None)[source]#
Initialize the preparation driver.
- Parameters:
overrides (dict, optional) – Configuration values applied on top of the inherited defaults.
Examples
>>> driver = OT2Prepare({"prepare_volume": "500 ul"}) >>> driver.last_target_location is None True
- status()[source]#
Return combined preparation and robot status lines.
Examples
>>> isinstance(driver.status(), list) True
- clear_sample_locations(locations=None)[source]#
Clear occupied sample destination tracking.
- Parameters:
locations (str or sequence of str, optional) – Specific occupied locations to clear. If omitted, all occupied sample locations are cleared.
- Returns:
Normalized locations that were cleared.
- Return type:
Examples
>>> driver.clear_sample_locations(["4A1"]) ['4A1'] >>> driver.clear_sample_locations() []
- resolve_destination(destination)[source]#
Resolve the destination well for a preparation.
- Parameters:
destination (str or None) – Explicit destination location. If
None, the next queued preparation target is consumed.- Returns:
Normalized destination location.
- Return type:
- Raises:
ValueError – If no destination is available or the destination is already occupied.
Examples
>>> driver.resolve_destination("4A1") '4A1'
- execute_preparation(target, balanced_target, destination)[source]#
Execute a simple preparation protocol into one destination.
- Parameters:
- Returns:
Truewhen all transfers succeed, otherwiseFalse.- Return type:
- Raises:
ValueError – If no protocol is available or a stock location cannot be resolved.
Examples
>>> driver.execute_preparation(target, balanced_target, "4A1") True
- execute_preparation_plan(target, balanced_target, destination, procedure_plan, intermediate_destinations)[source]#
Execute a staged preparation plan with intermediates.
- Parameters:
target (object) – Original target specification.
balanced_target (object) – Balanced target object associated with the plan.
destination (str) – Final destination location.
procedure_plan (dict) – Staged plan containing dilution and final-mix steps.
intermediate_destinations (sequence of str) – Concrete deck locations assigned to intermediate stages.
- Returns:
Truewhen the plan completes successfully.- Return type:
- Raises:
ValueError – If the intermediate mapping is inconsistent or a stage type is unknown.
Examples
>>> driver.execute_pre preparation_plan(target, balanced_target, "4A1", plan, ["5A1"]) True
- stocks_by_location(location)[source]#
Return the configured stock object at a deck location.
- Parameters:
location (str) – Deck location associated with a configured stock.
- Returns:
Matching stock object.
- Return type:
- Raises:
ValueError – If no stock is configured at the requested location.
- build_prepare_result(feasible_result, balanced_target)[source]#
Build the serialized result payload for a preparation.
- process_stocks()[source]#
Process stocks and refresh deck-derived preparation state.
Notes
This extends
PrepareDriverstock processing by rebuilding the reverse deck map and stock-tip reservation state.
- get_transfer_params(stock_name)[source]#
Return merged transfer parameters for a stock.
- Parameters:
stock_name (str) – Stock identifier.
- Returns:
Default transfer parameters overlaid with stock-specific overrides.
- Return type:
Examples
>>> isinstance(driver.get_transfer_params("default"), dict) True
- reorder_protocol(protocol)[source]#
Reorder protocol steps according to configured stock-name order.
- Parameters:
protocol (sequence) – Protocol steps with a
sourceattribute (or procedure-plan transfer dictionaries withsource_location). A stock may have several source wells; all of those wells are ordered using the stock’s configured name.- Returns:
Reordered protocol steps.
- Return type:
- transfer_to_catch(source=None, dest=None, **kwargs)[source]#
Transfer a prepared sample into the configured catch destination.
- Parameters:
- Returns:
The method raises on failure and records the transfer on success.
- Return type:
None
- Raises:
ValueError – If no source or destination can be resolved.
RuntimeError – If the underlying transfer fails.
- load_gen1_p10(mount, tip_rack_slots, **kwargs)[source]#
Load a GEN1 P10 single-channel pipette.
- Parameters:
mount ({"left", "right"}) – Mount on which to load the pipette.
tip_rack_slots (sequence of str) – Tiprack slots associated with the pipette.
**kwargs – Additional keyword arguments forwarded to
load_instrument().
- Returns:
Loaded pipette identifier returned by the robot.
- Return type: