Skip to content

Commit

Permalink
protocol for offset testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rclarke0 committed Oct 23, 2024
1 parent d5b3493 commit ee87963
Showing 1 changed file with 55 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)


metadata = {"protocolName": "Tough Auto Seal Lid to Thermocycler - with z offset change"}
metadata = {"protocolName": "Tough Auto Seal Lid to Thermocycler with offset params"}
requirements = {"robotType": "Flex", "apiLevel": "2.20"}


Expand All @@ -20,7 +20,7 @@ def add_parameters(parameters: ParameterContext) -> None:
variable_name="num_of_stack_ups",
display_name="Number of Stack Ups",
choices=[
{"display_name": "1", "value": 1},
{"display_name": "1", "value": 2},
{"display_name": "5", "value": 5},
{"display_name": "20", "value": 20},
{"display_name": "30", "value": 30},
Expand All @@ -29,27 +29,39 @@ def add_parameters(parameters: ParameterContext) -> None:
default=20,
)
parameters.add_int(
variable_name="z_offset",
display_name="Z Offset",
variable_name="max_offset",
display_name="Max Offset (+)",
minimum=0,
maximum=10,
default=0,
)
parameters.add_int(
variable_name="min_offset",
display_name="Max Offset (-)",
minimum=0,
maximum=10,
default=0,
)
parameters.add_str(
variable_name="axis_to_test",
display_name="Axis to Test",
choices=[
{"display_name": "-1", "value": -1},
{"display_name": "-0.5", "value": -0.5},
{"display_name": "0.5", "value": 0.5},
{"display_name": "1", "value": 1},
{"display_name": "1.5", "value": 1.5},
{"display_name": "2", "value": 2.5},
{"display_name": "2.5", "value": 2.5},
{"display_name": "3", "value": 3},
{"display_name": "X", "value": "x"},
{"display_name": "Y", "value": "y"},
{"display_name": "Z", "value": "z"},
],
default=-1,
default="x",
)


def run(protocol: ProtocolContext) -> None:
"""Runs protocol that moves lids and stacks them."""
# Load Parameters
iterations = protocol.params.num_of_stack_ups # type: ignore[attr-defined]
z_offset = protocol.params.z_offset # type: ignore[attr-defined]
axis_for_offset = protocol.params.axis_to_test # type: ignore[attr-defined]
min_offset = protocol.params.min_offset # type: ignore[attr-defined]
neg_min_offset = int(min_offset) * -1
max_offset = protocol.params.max_offset # type: ignore[attr-defined]
# Thermocycler
thermocycler: ThermocyclerContext = protocol.load_module(
"thermocyclerModuleV2"
Expand All @@ -65,22 +77,35 @@ def run(protocol: ProtocolContext) -> None:
for i in range(4):
lids.append(lids[-1].load_labware("opentrons_tough_pcr_auto_sealing_lid"))
lids.reverse()

stack_locations = ["C2", "D2"]
slot = 0
offsets = [neg_min_offset, neg_min_offset + 1, max_offset - 1, max_offset]

for iteration in range(iterations - 1):
loc = 0
for lid in lids:
protocol.comment(f"Stack up {iteration}")
# move lid to plate in thermocycler
protocol.move_labware(lid, plate_in_cycler, use_gripper=True)
# move lid to deck slot
if loc == 0:
protocol.move_labware(lid, stack_locations[slot], use_gripper=True, drop_offset = {"x": 0, "y":0, "z": z_offset})
prev_moved_lid: Labware = lid
else:
protocol.move_labware(lid, prev_moved_lid, use_gripper=True)
prev_moved_lid = lid
loc += 1
slot = (slot + 1) % 2 # Switch between 0 and 1 to rotate stack locations
lids.reverse()
for offset in offsets:
offset_dict = {
"x": {"x": offset, "y": 0, "z": 0},
"y": {"x": 0, "y": offset, "z": 0},
"z": {"x": 0, "y": 0, "z": offset},
}
offset_to_use = offset_dict[axis_for_offset]
loc = 0
for lid in lids:
protocol.comment(
f"Stack up {iteration}. Offset {offset_to_use}, Lid # {loc+1}"
)
# move lid to plate in thermocycler
protocol.move_labware(
lid, plate_in_cycler, use_gripper=True, drop_offset=offset_to_use
)
# move lid to deck slot
if loc == 0:
protocol.move_labware(lid, stack_locations[slot], use_gripper=True)
prev_moved_lid: Labware = lid
else:
protocol.move_labware(lid, prev_moved_lid, use_gripper=True)
prev_moved_lid = lid
loc += 1
slot = (slot + 1) % 2 # Switch between 0 and 1 to rotate stack locations
lids.reverse()

0 comments on commit ee87963

Please sign in to comment.