from opentrons import protocol_api
from opentrons.protocol_api import SINGLE
from opentrons.types import Point
metadata = {
'protocolName': 'Multichannel Color Dispensing (Single Tip) - Dani',
'author': '',
'description': 'Aspirate colors column-wise with a single tip on an '
'8-channel pipette and dispense into virtual grid '
'positions in a reservoir.',
'apiLevel': '2.20'
}
# ---------------------------------------------------------------------------
# USER CONFIGURATION
# ---------------------------------------------------------------------------
VOLUME_PER_DROP = 2
DISPENSE_HEIGHT = 0
START_TIP = "E1"
DROP_TIP_IN_TRASH = True
# Usable volume per well (leave margin below 250 µL max)
WELL_CAPACITY = 220 # µL
# ---------------------------------------------------------------------------
# COLOR MAP
# IMPORTANT: use "source_wells" (plural), not "source_well"
# ---------------------------------------------------------------------------
mscarlet_i_points = [(-7.7, 38.5),(-5.5, 38.5),(-3.3, 38.5),(-1.1, 38.5),(1.1, 38.5),(3.3, 38.5),(5.5, 38.5),(7.7, 38.5),(-14.3, 36.3),(-12.1, 36.3),(-9.9, 36.3),(-7.7, 36.3),(-5.5, 36.3),(-3.3, 36.3),(-1.1, 36.3),(1.1, 36.3),(3.3, 36.3),(5.5, 36.3),(7.7, 36.3),(9.9, 36.3),(12.1, 36.3),(14.3, 36.3),(-20.9, 34.1),(-18.7, 34.1),(-16.5, 34.1),(-14.3, 34.1),(-12.1, 34.1),(-9.9, 34.1),(-7.7, 34.1),(-5.5, 34.1),(-3.3, 34.1),(-1.1, 34.1),(1.1, 34.1),(3.3, 34.1),(5.5, 34.1),(7.7, 34.1),(9.9, 34.1),(12.1, 34.1),(14.3, 34.1),(16.5, 34.1),(18.7, 34.1),(20.9, 34.1),(-23.1, 31.9),(-20.9, 31.9),(-18.7, 31.9),(-16.5, 31.9),(-14.3, 31.9),(-12.1, 31.9),(-9.9, 31.9),(-7.7, 31.9),(-5.5, 31.9),(-3.3, 31.9),(-1.1, 31.9),(1.1, 31.9),(3.3, 31.9),(5.5, 31.9),(7.7, 31.9),(9.9, 31.9),(12.1, 31.9),(14.3, 31.9),(16.5, 31.9),(18.7, 31.9),(20.9, 31.9),(23.1, 31.9),(-25.3, 29.7),(-23.1, 29.7),(-20.9, 29.7),(-18.7, 29.7),(-16.5, 29.7),(-14.3, 29.7),(-12.1, 29.7),(-9.9, 29.7),(-7.7, 29.7),(-5.5, 29.7),(-3.3, 29.7),(-1.1, 29.7),(1.1, 29.7),(3.3, 29.7),(5.5, 29.7),(7.7, 29.7),(9.9, 29.7),(12.1, 29.7),(14.3, 29.7),(16.5, 29.7),(18.7, 29.7),(20.9, 29.7),(23.1, 29.7),(25.3, 29.7),(-27.5, 27.5),(-25.3, 27.5),(-23.1, 27.5),(-20.9, 27.5),(-18.7, 27.5),(-16.5, 27.5),(-14.3, 27.5),(-12.1, 27.5),(-9.9, 27.5),(-7.7, 27.5),(-5.5, 27.5),(-3.3, 27.5),(-1.1, 27.5),(1.1, 27.5),(3.3, 27.5),(5.5, 27.5),(7.7, 27.5),(9.9, 27.5),(12.1, 27.5),(14.3, 27.5),(16.5, 27.5),(18.7, 27.5),(20.9, 27.5),(23.1, 27.5),(25.3, 27.5),(27.5, 27.5),(-29.7, 25.3),(-27.5, 25.3),(-25.3, 25.3),(-23.1, 25.3),(-20.9, 25.3),(-18.7, 25.3),(-16.5, 25.3),(-14.3, 25.3),(-12.1, 25.3),(-9.9, 25.3),(-7.7, 25.3),(-5.5, 25.3),(-3.3, 25.3),(-1.1, 25.3),(1.1, 25.3),(3.3, 25.3),(5.5, 25.3),(7.7, 25.3),(9.9, 25.3),(12.1, 25.3),(14.3, 25.3),(16.5, 25.3),(18.7, 25.3),(20.9, 25.3),(23.1, 25.3),(25.3, 25.3),(27.5, 25.3),(29.7, 25.3),(-31.9, 23.1),(-29.7, 23.1),(-27.5, 23.1),(-25.3, 23.1),(-23.1, 23.1),(-20.9, 23.1),(-18.7, 23.1),(-16.5, 23.1),(-14.3, 23.1),(-12.1, 23.1),(-9.9, 23.1),(-7.7, 23.1),(-5.5, 23.1),(-3.3, 23.1),(-1.1, 23.1),(1.1, 23.1),(3.3, 23.1),(5.5, 23.1),(7.7, 23.1),(9.9, 23.1),(12.1, 23.1),(14.3, 23.1),(16.5, 23.1),(18.7, 23.1),(20.9, 23.1),(23.1, 23.1),(25.3, 23.1),(27.5, 23.1),(29.7, 23.1),(31.9, 23.1),(-34.1, 20.9),(-31.9, 20.9),(-29.7, 20.9),(-27.5, 20.9),(-25.3, 20.9),(-23.1, 20.9),(-20.9, 20.9),(-18.7, 20.9),(-16.5, 20.9),(-14.3, 20.9),(-12.1, 20.9),(-9.9, 20.9),(-7.7, 20.9),(-5.5, 20.9),(-3.3, 20.9),(-1.1, 20.9),(1.1, 20.9),(3.3, 20.9),(5.5, 20.9),(7.7, 20.9),(9.9, 20.9),(12.1, 20.9),(14.3, 20.9),(16.5, 20.9),(18.7, 20.9),(20.9, 20.9),(23.1, 20.9),(25.3, 20.9),(27.5, 20.9),(29.7, 20.9),(31.9, 20.9),(34.1, 20.9),(-34.1, 18.7),(-31.9, 18.7),(-29.7, 18.7),(-27.5, 18.7),(-25.3, 18.7),(-23.1, 18.7),(-20.9, 18.7),(-18.7, 18.7),(-16.5, 18.7),(-14.3, 18.7),(-12.1, 18.7),(-9.9, 18.7),(-7.7, 18.7),(-5.5, 18.7),(-3.3, 18.7),(-1.1, 18.7),(1.1, 18.7),(3.3, 18.7),(5.5, 18.7),(7.7, 18.7),(9.9, 18.7),(12.1, 18.7),(14.3, 18.7),(16.5, 18.7),(18.7, 18.7),(20.9, 18.7),(23.1, 18.7),(25.3, 18.7),(27.5, 18.7),(29.7, 18.7),(31.9, 18.7),(34.1, 18.7),(-34.1, 16.5),(-31.9, 16.5),(-29.7, 16.5),(-27.5, 16.5),(-25.3, 16.5),(-23.1, 16.5),(-20.9, 16.5),(-18.7, 16.5),(-16.5, 16.5),(-14.3, 16.5),(-12.1, 16.5),(-9.9, 16.5),(-7.7, 16.5),(-5.5, 16.5),(-3.3, 16.5),(-1.1, 16.5),(1.1, 16.5),(3.3, 16.5),(5.5, 16.5),(7.7, 16.5),(9.9, 16.5),(12.1, 16.5),(14.3, 16.5),(16.5, 16.5),(18.7, 16.5),(20.9, 16.5),(23.1, 16.5),(25.3, 16.5),(27.5, 16.5),(29.7, 16.5),(31.9, 16.5),(34.1, 16.5),(-36.3, 14.3),(-34.1, 14.3),(-31.9, 14.3),(-29.7, 14.3),(-27.5, 14.3),(-25.3, 14.3),(-23.1, 14.3),(-20.9, 14.3),(-18.7, 14.3),(-16.5, 14.3),(-14.3, 14.3),(-12.1, 14.3),(-9.9, 14.3),(-7.7, 14.3),(-5.5, 14.3),(-3.3, 14.3),(-1.1, 14.3),(1.1, 14.3),(3.3, 14.3),(5.5, 14.3),(7.7, 14.3),(9.9, 14.3),(12.1, 14.3),(14.3, 14.3),(16.5, 14.3),(18.7, 14.3),(20.9, 14.3),(23.1, 14.3),(25.3, 14.3),(27.5, 14.3),(29.7, 14.3),(31.9, 14.3),(34.1, 14.3),(36.3, 14.3),(-36.3, 12.1),(-34.1, 12.1),(-31.9, 12.1),(-29.7, 12.1),(-27.5, 12.1),(-25.3, 12.1),(-23.1, 12.1),(-20.9, 12.1),(-18.7, 12.1),(-16.5, 12.1),(-14.3, 12.1),(-12.1, 12.1),(-9.9, 12.1),(-7.7, 12.1),(-5.5, 12.1),(-3.3, 12.1),(-1.1, 12.1),(1.1, 12.1),(3.3, 12.1),(5.5, 12.1),(7.7, 12.1),(9.9, 12.1),(12.1, 12.1),(14.3, 12.1),(16.5, 12.1),(18.7, 12.1),(20.9, 12.1),(23.1, 12.1),(25.3, 12.1),(27.5, 12.1),(29.7, 12.1),(31.9, 12.1),(34.1, 12.1),(36.3, 12.1),(-36.3, 9.9),(-34.1, 9.9),(-31.9, 9.9),(-23.1, 9.9),(-20.9, 9.9),(-18.7, 9.9),(-16.5, 9.9),(-7.7, 9.9),(-5.5, 9.9),(-3.3, 9.9),(5.5, 9.9),(7.7, 9.9),(9.9, 9.9),(12.1, 9.9),(14.3, 9.9),(29.7, 9.9),(31.9, 9.9),(34.1, 9.9),(36.3, 9.9),(-38.5, 7.7),(-36.3, 7.7),(-34.1, 7.7),(-31.9, 7.7),(-23.1, 7.7),(-20.9, 7.7),(-18.7, 7.7),(-16.5, 7.7),(-7.7, 7.7),(-5.5, 7.7),(-3.3, 7.7),(5.5, 7.7),(7.7, 7.7),(9.9, 7.7),(31.9, 7.7),(34.1, 7.7),(36.3, 7.7),(38.5, 7.7),(-38.5, 5.5),(-36.3, 5.5),(-34.1, 5.5),(-31.9, 5.5),(-23.1, 5.5),(-20.9, 5.5),(-18.7, 5.5),(-16.5, 5.5),(-7.7, 5.5),(-5.5, 5.5),(-3.3, 5.5),(5.5, 5.5),(7.7, 5.5),(9.9, 5.5),(18.7, 5.5),(20.9, 5.5),(23.1, 5.5),(34.1, 5.5),(36.3, 5.5),(38.5, 5.5),(-38.5, 3.3),(-36.3, 3.3),(-34.1, 3.3),(-31.9, 3.3),(-23.1, 3.3),(-20.9, 3.3),(-18.7, 3.3),(-16.5, 3.3),(-7.7, 3.3),(-5.5, 3.3),(-3.3, 3.3),(5.5, 3.3),(7.7, 3.3),(9.9, 3.3),(18.7, 3.3),(20.9, 3.3),(23.1, 3.3),(25.3, 3.3),(29.7, 3.3),(31.9, 3.3),(34.1, 3.3),(36.3, 3.3),(38.5, 3.3),(-38.5, 1.1),(-36.3, 1.1),(-34.1, 1.1),(-31.9, 1.1),(-23.1, 1.1),(-20.9, 1.1),(-18.7, 1.1),(-16.5, 1.1),(-7.7, 1.1),(-5.5, 1.1),(-3.3, 1.1),(5.5, 1.1),(7.7, 1.1),(16.5, 1.1),(18.7, 1.1),(20.9, 1.1),(23.1, 1.1),(25.3, 1.1),(27.5, 1.1),(29.7, 1.1),(31.9, 1.1),(34.1, 1.1),(36.3, 1.1),(38.5, 1.1),(-38.5, -1.1),(-36.3, -1.1),(-34.1, -1.1),(-31.9, -1.1),(-23.1, -1.1),(-20.9, -1.1),(-18.7, -1.1),(-16.5, -1.1),(-7.7, -1.1),(-5.5, -1.1),(-3.3, -1.1),(5.5, -1.1),(7.7, -1.1),(16.5, -1.1),(18.7, -1.1),(20.9, -1.1),(23.1, -1.1),(25.3, -1.1),(27.5, -1.1),(29.7, -1.1),(31.9, -1.1),(34.1, -1.1),(36.3, -1.1),(38.5, -1.1),(-38.5, -3.3),(-36.3, -3.3),(-34.1, -3.3),(-31.9, -3.3),(-23.1, -3.3),(-20.9, -3.3),(-18.7, -3.3),(-16.5, -3.3),(-7.7, -3.3),(-5.5, -3.3),(-3.3, -3.3),(5.5, -3.3),(7.7, -3.3),(16.5, -3.3),(18.7, -3.3),(20.9, -3.3),(23.1, -3.3),(25.3, -3.3),(27.5, -3.3),(29.7, -3.3),(31.9, -3.3),(34.1, -3.3),(36.3, -3.3),(38.5, -3.3),(-38.5, -5.5),(-36.3, -5.5),(-34.1, -5.5),(-31.9, -5.5),(-23.1, -5.5),(-20.9, -5.5),(-18.7, -5.5),(-16.5, -5.5),(-7.7, -5.5),(-5.5, -5.5),(-3.3, -5.5),(5.5, -5.5),(7.7, -5.5),(18.7, -5.5),(20.9, -5.5),(23.1, -5.5),(25.3, -5.5),(27.5, -5.5),(29.7, -5.5),(31.9, -5.5),(34.1, -5.5),(36.3, -5.5),(38.5, -5.5),(-38.5, -7.7),(-36.3, -7.7),(-34.1, -7.7),(-31.9, -7.7),(-20.9, -7.7),(-18.7, -7.7),(-16.5, -7.7),(-7.7, -7.7),(-5.5, -7.7),(-3.3, -7.7),(5.5, -7.7),(7.7, -7.7),(9.9, -7.7),(18.7, -7.7),(20.9, -7.7),(23.1, -7.7),(31.9, -7.7),(34.1, -7.7),(36.3, -7.7),(38.5, -7.7),(-36.3, -9.9),(-34.1, -9.9),(-31.9, -9.9),(-7.7, -9.9),(-5.5, -9.9),(-3.3, -9.9),(5.5, -9.9),(7.7, -9.9),(9.9, -9.9),(31.9, -9.9),(34.1, -9.9),(36.3, -9.9),(-36.3, -12.1),(-34.1, -12.1),(-31.9, -12.1),(-29.7, -12.1),(-9.9, -12.1),(-7.7, -12.1),(-5.5, -12.1),(-3.3, -12.1),(5.5, -12.1),(7.7, -12.1),(9.9, -12.1),(12.1, -12.1),(29.7, -12.1),(31.9, -12.1),(34.1, -12.1),(36.3, -12.1),(-36.3, -14.3),(-34.1, -14.3),(-31.9, -14.3),(-29.7, -14.3),(-27.5, -14.3),(-25.3, -14.3),(-23.1, -14.3),(-20.9, -14.3),(-18.7, -14.3),(-16.5, -14.3),(-14.3, -14.3),(-12.1, -14.3),(-9.9, -14.3),(-7.7, -14.3),(-5.5, -14.3),(-3.3, -14.3),(-1.1, -14.3),(1.1, -14.3),(3.3, -14.3),(5.5, -14.3),(7.7, -14.3),(9.9, -14.3),(12.1, -14.3),(14.3, -14.3),(16.5, -14.3),(18.7, -14.3),(20.9, -14.3),(23.1, -14.3),(25.3, -14.3),(27.5, -14.3),(29.7, -14.3),(31.9, -14.3),(34.1, -14.3),(36.3, -14.3),(-34.1, -16.5),(-31.9, -16.5),(-29.7, -16.5),(-27.5, -16.5),(-25.3, -16.5),(-23.1, -16.5),(-20.9, -16.5),(-18.7, -16.5),(-16.5, -16.5),(-14.3, -16.5),(-12.1, -16.5),(-9.9, -16.5),(-7.7, -16.5),(-5.5, -16.5),(-3.3, -16.5),(-1.1, -16.5),(1.1, -16.5),(3.3, -16.5),(5.5, -16.5),(7.7, -16.5),(9.9, -16.5),(12.1, -16.5),(14.3, -16.5),(16.5, -16.5),(18.7, -16.5),(20.9, -16.5),(23.1, -16.5),(25.3, -16.5),(27.5, -16.5),(29.7, -16.5),(31.9, -16.5),(34.1, -16.5),(-34.1, -18.7),(-31.9, -18.7),(-29.7, -18.7),(-27.5, -18.7),(-25.3, -18.7),(-23.1, -18.7),(-20.9, -18.7),(-18.7, -18.7),(-16.5, -18.7),(-14.3, -18.7),(-12.1, -18.7),(-9.9, -18.7),(-7.7, -18.7),(-5.5, -18.7),(-3.3, -18.7),(-1.1, -18.7),(1.1, -18.7),(3.3, -18.7),(5.5, -18.7),(7.7, -18.7),(9.9, -18.7),(12.1, -18.7),(14.3, -18.7),(16.5, -18.7),(18.7, -18.7),(20.9, -18.7),(23.1, -18.7),(25.3, -18.7),(27.5, -18.7),(29.7, -18.7),(31.9, -18.7),(34.1, -18.7),(-34.1, -20.9),(-31.9, -20.9),(-29.7, -20.9),(-27.5, -20.9),(-25.3, -20.9),(-23.1, -20.9),(-20.9, -20.9),(-18.7, -20.9),(-16.5, -20.9),(-14.3, -20.9),(-12.1, -20.9),(-9.9, -20.9),(-7.7, -20.9),(-5.5, -20.9),(-3.3, -20.9),(-1.1, -20.9),(1.1, -20.9),(3.3, -20.9),(5.5, -20.9),(7.7, -20.9),(9.9, -20.9),(12.1, -20.9),(14.3, -20.9),(16.5, -20.9),(18.7, -20.9),(20.9, -20.9),(23.1, -20.9),(25.3, -20.9),(27.5, -20.9),(29.7, -20.9),(31.9, -20.9),(34.1, -20.9),(-31.9, -23.1),(-29.7, -23.1),(-27.5, -23.1),(-25.3, -23.1),(-23.1, -23.1),(-20.9, -23.1),(-18.7, -23.1),(-16.5, -23.1),(-14.3, -23.1),(-12.1, -23.1),(-9.9, -23.1),(-7.7, -23.1),(-5.5, -23.1),(-3.3, -23.1),(-1.1, -23.1),(1.1, -23.1),(3.3, -23.1),(5.5, -23.1),(7.7, -23.1),(9.9, -23.1),(12.1, -23.1),(14.3, -23.1),(16.5, -23.1),(18.7, -23.1),(20.9, -23.1),(23.1, -23.1),(25.3, -23.1),(27.5, -23.1),(29.7, -23.1),(31.9, -23.1),(-29.7, -25.3),(-27.5, -25.3),(-25.3, -25.3),(-23.1, -25.3),(-20.9, -25.3),(-18.7, -25.3),(-16.5, -25.3),(-14.3, -25.3),(-12.1, -25.3),(-9.9, -25.3),(-7.7, -25.3),(-5.5, -25.3),(-3.3, -25.3),(-1.1, -25.3),(1.1, -25.3),(3.3, -25.3),(5.5, -25.3),(7.7, -25.3),(9.9, -25.3),(12.1, -25.3),(14.3, -25.3),(16.5, -25.3),(18.7, -25.3),(20.9, -25.3),(23.1, -25.3),(25.3, -25.3),(27.5, -25.3),(29.7, -25.3),(-27.5, -27.5),(-25.3, -27.5),(-23.1, -27.5),(-20.9, -27.5),(-18.7, -27.5),(-16.5, -27.5),(-14.3, -27.5),(-12.1, -27.5),(-9.9, -27.5),(-7.7, -27.5),(-5.5, -27.5),(-3.3, -27.5),(-1.1, -27.5),(1.1, -27.5),(3.3, -27.5),(5.5, -27.5),(7.7, -27.5),(9.9, -27.5),(12.1, -27.5),(14.3, -27.5),(16.5, -27.5),(18.7, -27.5),(20.9, -27.5),(23.1, -27.5),(25.3, -27.5),(27.5, -27.5),(-25.3, -29.7),(-23.1, -29.7),(-20.9, -29.7),(-18.7, -29.7),(-16.5, -29.7),(-14.3, -29.7),(-12.1, -29.7),(-9.9, -29.7),(-7.7, -29.7),(-5.5, -29.7),(-3.3, -29.7),(-1.1, -29.7),(1.1, -29.7),(3.3, -29.7),(5.5, -29.7),(7.7, -29.7),(9.9, -29.7),(12.1, -29.7),(14.3, -29.7),(16.5, -29.7),(18.7, -29.7),(20.9, -29.7),(23.1, -29.7),(25.3, -29.7),(-23.1, -31.9),(-20.9, -31.9),(-18.7, -31.9),(-16.5, -31.9),(-14.3, -31.9),(-12.1, -31.9),(-9.9, -31.9),(-7.7, -31.9),(-5.5, -31.9),(-3.3, -31.9),(-1.1, -31.9),(1.1, -31.9),(3.3, -31.9),(5.5, -31.9),(7.7, -31.9),(9.9, -31.9),(12.1, -31.9),(14.3, -31.9),(16.5, -31.9),(18.7, -31.9),(20.9, -31.9),(23.1, -31.9),(-20.9, -34.1),(-18.7, -34.1),(-16.5, -34.1),(-14.3, -34.1),(-12.1, -34.1),(-9.9, -34.1),(-7.7, -34.1),(-5.5, -34.1),(-3.3, -34.1),(-1.1, -34.1),(1.1, -34.1),(3.3, -34.1),(5.5, -34.1),(7.7, -34.1),(9.9, -34.1),(12.1, -34.1),(14.3, -34.1),(16.5, -34.1),(18.7, -34.1),(20.9, -34.1),(-14.3, -36.3),(-12.1, -36.3),(-9.9, -36.3),(-7.7, -36.3),(-5.5, -36.3),(-3.3, -36.3),(-1.1, -36.3),(1.1, -36.3),(3.3, -36.3),(5.5, -36.3),(7.7, -36.3),(9.9, -36.3),(12.1, -36.3),(14.3, -36.3),(-7.7, -38.5),(-5.5, -38.5),(-3.3, -38.5),(-1.1, -38.5),(1.1, -38.5),(3.3, -38.5),(5.5, -38.5),(7.7, -38.5)]
azurite_points = [(-5.4, 23.4),(-1.8, 23.4),(1.8, 23.4),(5.4, 23.4),(-9, 19.8),(-5.4, 19.8),(-1.8, 19.8),(1.8, 19.8),(5.4, 19.8),(9, 19.8),(12.6, 19.8),(12.6, 16.2),(12.6, 12.6),(-12.6, 9),(-1.8, 9),(1.8, 9),(5.4, 9),(12.6, 9),(-12.6, 5.4),(12.6, 5.4),(-12.6, 1.8),(12.6, 1.8),(-12.6, -1.8),(-9, -1.8),(-5.4, -1.8),(-1.8, -1.8),(1.8, -1.8),(5.4, -1.8),(-12.6, -5.4),(-5.4, -12.6)]
mko2_points = [(9, 23.4),(-12.6, 16.2),(12.6, -1.8),(-9, -5.4),(1.8, -5.4),(16.2, -9),(-12.6, -12.6),(-9, -16.2),(-5.4, -16.2),(-1.8, -16.2),(-12.6, -23.4),(-9, -23.4),(-5.4, -23.4),(-1.8, -23.4),(1.8, -23.4),(5.4, -23.4),(9, -23.4),(-5.4, -30.6),(-1.8, -30.6),(1.8, -30.6),(5.4, -30.6),(9, -30.6),(12.6, -30.6),(16.2, -34.2)]
sfgfp_points = []
COLOR_MAP = [
{'name': 'Red', 'source_wells': ['A1','B1','C1','D1','E1','F1','G1','H1'], 'points': mscarlet_i_points}
]
# ---------------------------------------------------------------------------
# RESERVOIR BOUNDS
# ---------------------------------------------------------------------------
RESERVOIR_X_MM = 107.0
RESERVOIR_Y_MM = 67.0
ALLOW_OUT_OF_BOUNDS = False
# ---------------------------------------------------------------------------
# PROTOCOL
# ---------------------------------------------------------------------------
def run(protocol: protocol_api.ProtocolContext):
# --- Labware ---
tip_rack = protocol.load_labware('opentrons_96_tiprack_20ul', 6)
plate = protocol.load_labware('scienfocus_96_wellplate_250ul', 1)
reservoir = protocol.load_labware('thermo_1_reservoir_90000ul', 2)
# --- Pipette ---
pipette = protocol.load_instrument('p20_multi_gen2', 'left',
tip_racks=[tip_rack])
pipette.configure_nozzle_layout(style=SINGLE, start="H1")
# --- Reference locations ---
reservoir_well = reservoir['A1']
dispense_base = reservoir_well.bottom(DISPENSE_HEIGHT)
# --- Tip ordering ---
ordered_tips = []
for col in tip_rack.columns():
ordered_tips.extend(col)
start_tip_well = tip_rack.wells_by_name()[START_TIP]
try:
next_tip_index = ordered_tips.index(start_tip_well)
except ValueError as exc:
raise RuntimeError(f"START_TIP '{START_TIP}' is not in the loaded tip rack.") from exc
# -----------------------------------------------------------------------
# MAIN LOOP
# -----------------------------------------------------------------------
for color in COLOR_MAP:
if not color['points']:
continue
source_wells = [plate.wells_by_name()[w] for w in color['source_wells']]
current_well_index = 0
remaining_volume = WELL_CAPACITY
n_dispenses = len(color['points'])
protocol.comment(
f"--- {color['name']} | {len(source_wells)} wells | "
f"{n_dispenses} × {VOLUME_PER_DROP} µL ---"
)
# Pick up one tip per color
if next_tip_index >= len(ordered_tips):
raise RuntimeError("Out of tips for the configured colors.")
pipette.pick_up_tip(ordered_tips[next_tip_index])
next_tip_index += 1
for (x_offset, y_offset) in color['points']:
# --- Bounds check ---
if (abs(x_offset) > RESERVOIR_X_MM / 2) or (abs(y_offset) > RESERVOIR_Y_MM / 2):
protocol.comment(
f"WARNING: {color['name']} point ({x_offset}, {y_offset}) mm is out "
f"of bounds ±{RESERVOIR_X_MM/2:.1f} x ±{RESERVOIR_Y_MM/2:.1f}"
)
if not ALLOW_OUT_OF_BOUNDS:
continue
# --- Switch wells if needed ---
if remaining_volume < VOLUME_PER_DROP:
current_well_index += 1
if current_well_index >= len(source_wells):
raise RuntimeError(
f"Ran out of volume for {color['name']} "
f"(increase number of source wells)"
)
remaining_volume = WELL_CAPACITY
protocol.comment(
f"Switching to well {color['source_wells'][current_well_index]}"
)
source_well = source_wells[current_well_index]
# --- Aspirate ---
pipette.aspirate(VOLUME_PER_DROP, source_well)
remaining_volume -= VOLUME_PER_DROP
# --- Move & dispense ---
target = dispense_base.move(Point(x=x_offset, y=y_offset, z=0))
pipette.move_to(target)
pipette.dispense(VOLUME_PER_DROP, target)
# --- Tip handling ---
if DROP_TIP_IN_TRASH:
pipette.drop_tip()
else:
pipette.return_tip()