Skip to content

Commit

Permalink
Merge branch 'hardware-testing-96ch-lowvol-lld' into EXEC-1055-96-cha…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Dec 11, 2024
2 parents 8c1fd54 + 8b91a85 commit 394365e
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 9 deletions.
25 changes: 17 additions & 8 deletions hardware-testing/hardware_testing/liquid_sense/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from hardware_testing.protocols.liquid_sense_lpc import (
liquid_sense_ot3_p50_single_vial,
liquid_sense_ot3_p50_multi_vial,
liquid_sense_ot3_p200_96_vial,
liquid_sense_ot3_p1000_96_vial,
liquid_sense_ot3_p1000_single_vial,
liquid_sense_ot3_p1000_multi_vial,
Expand All @@ -53,7 +54,7 @@

CREDENTIALS_PATH = "/var/lib/jupyter/notebooks/abr.json"

API_LEVEL = "2.18"
API_LEVEL = "2.21"

LABWARE_OFFSETS: List[LabwareOffset] = []

Expand All @@ -75,6 +76,9 @@
1: liquid_sense_ot3_p50_single_vial,
8: liquid_sense_ot3_p50_multi_vial,
},
200: {
96: liquid_sense_ot3_p200_96_vial,
},
1000: {
1: liquid_sense_ot3_p1000_single_vial,
8: liquid_sense_ot3_p1000_multi_vial,
Expand All @@ -92,6 +96,7 @@
8: "p1000_multi_flex",
96: "p1000_96_flex",
},
200: {96: "p200_96_flex"},
}


Expand Down Expand Up @@ -188,8 +193,10 @@ def build_run_args(cls, args: argparse.Namespace) -> "RunArgs":
if args.tip == 0:
if args.pipette == 1000:
tip_volumes: List[int] = [50, 200, 1000]
else:
elif args.pipette == 50:
tip_volumes = [50]
else:
tip_volumes = [50, 200]
else:
tip_volumes = [args.tip]

Expand Down Expand Up @@ -265,22 +272,24 @@ def build_run_args(cls, args: argparse.Namespace) -> "RunArgs":

parser = argparse.ArgumentParser("Pipette Testing")
parser.add_argument("--simulate", action="store_true")
parser.add_argument("--pipette", type=int, choices=[50, 1000], required=True)
parser.add_argument("--pipette", type=int, choices=[50, 200, 1000], required=True)
parser.add_argument("--mount", type=str, choices=["left", "right"], default="left")
parser.add_argument("--channels", type=int, choices=[1, 8, 96], default=1)
parser.add_argument("--tip", type=int, choices=[0, 50, 200, 1000], default=0)
parser.add_argument("--tip", type=int, choices=[0, 20, 50, 200, 1000], default=0)
parser.add_argument("--return-tip", action="store_true")
parser.add_argument("--trials", type=int, default=7)
parser.add_argument("--trials-before-jog", type=int, default=7)
parser.add_argument("--trials", type=int, default=10)
parser.add_argument("--trials-before-jog", type=int, default=10)
parser.add_argument("--z-speed", type=float, default=5)
parser.add_argument("--aspirate", action="store_true")
parser.add_argument("--plunger-speed", type=float, default=15)
parser.add_argument("--plunger-speed", type=float, default=5)
parser.add_argument("--no-multi-pass", action="store_true")
parser.add_argument("--wet", action="store_true")
parser.add_argument("--starting-tip", type=str, default="A1")
parser.add_argument("--test-well", type=str, default="A1")
parser.add_argument("--p-solo-time", type=float, default=0)
parser.add_argument("--google-sheet-name", type=str, default="LLD-Shared-Data")
parser.add_argument(
"--google-sheet-name", type=str, default="LLD-Shared-Data-96ch-200ul"
)
parser.add_argument(
"--gd-parent-folder", type=str, default="1b2V85fDPA0tNqjEhyHOGCWRZYgn8KsGf"
)
Expand Down
39 changes: 38 additions & 1 deletion hardware-testing/hardware_testing/liquid_sense/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
from hardware_testing.data import ui, get_testing_data_directory
from opentrons.hardware_control.types import (
InstrumentProbeType,
PipetteSensorId,
OT3Mount,
Axis,
top_types,
PipetteSensorResponseQueue,
)
from opentrons.hardware_control.dev_types import PipetteDict

Expand Down Expand Up @@ -420,6 +422,7 @@ def _run_trial(
probes.append(InstrumentProbeType.SECONDARY)
probe_target = InstrumentProbeType.BOTH
data_files: Dict[InstrumentProbeType, str] = {}
data_capture: PipetteSensorResponseQueue = PipetteSensorResponseQueue()
for probe in probes:
data_filename = f"pressure_sensor_data-trial{trial}-tip{tip}-{probe.name}.csv"
data_file = f"{data_dir}/{run_args.name}/{run_args.run_id}/{data_filename}"
Expand Down Expand Up @@ -456,8 +459,42 @@ def _run_trial(
run_args.recorder.set_sample_tag(f"trial-{trial}-{tip}ul")
# TODO add in stuff for secondary probe
try:
height = hw_api.liquid_probe(hw_mount, z_distance, lps, probe_target)
height = hw_api.liquid_probe(
hw_mount, z_distance, lps, probe_target, response_queue=data_capture
)
result: LLDResult = LLDResult.success
# write the data files that used to be made automatically
if not run_args.ctx.is_simulating():
for probe in probes:
sensor_id = (
PipetteSensorId.S0
if probe == InstrumentProbeType.PRIMARY
else PipetteSensorId.S1
)
as_dict = data_capture.get_nowait()
data = [d.to_float() for d in as_dict[sensor_id]]
with open(data_files[probe], "w") as d_file:
writer = csv.writer(d_file)
writer.writerow(
[
"time(s)",
"Pressure(pascals)",
"z_velocity(mm/s)",
"plunger_velocity(mm/s)",
"threshold(pascals)",
]
)
writer.writerow(
[
"0",
"0",
f"{run_args.z_speed}",
f"{plunger_speed}",
f"{lqid_cfg['sensor_threshold_pascals']}",
]
)
for i in range(len(data)):
writer.writerow([f"{i*0.004}", f"{data[i]}"])
if not run_args.ctx.is_simulating():
for probe in data_files:
if _test_for_blockage(data_files[probe], lps.sensor_threshold_pascals):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""lld OT3 P200."""
from opentrons.protocol_api import ProtocolContext, OFF_DECK

metadata = {"protocolName": "liquid-sense-ot3-p200-96-vial"}
requirements = {"robotType": "Flex", "apiLevel": "2.21"}

SLOT_SCALE = 1
SLOT_DIAL = 9

SLOTS_TIPRACK = {
50: [3],
200: [3],
}

LABWARE_ON_SCALE = "radwag_pipette_calibration_vial"


def run(ctx: ProtocolContext) -> None:
"""Run."""
trash = ctx.load_trash_bin("A3")
vial = ctx.load_labware(LABWARE_ON_SCALE, SLOT_SCALE)
dial = ctx.load_labware("dial_indicator", SLOT_DIAL)
pipette = ctx.load_instrument("flex_96channel_200", "left")
adapters = [
ctx.load_adapter("opentrons_flex_96_tiprack_adapter", slot)
for slot in SLOTS_TIPRACK[50]
]
for size, slots in SLOTS_TIPRACK.items():
tipracks = [
adapter.load_labware(f"opentrons_flex_96_tiprack_{size}uL")
for adapter in adapters
]
for rack in tipracks:
pipette.pick_up_tip(rack["A1"])
pipette.aspirate(10, vial["A1"].top())
pipette.dispense(10, vial["A1"].top())
pipette.aspirate(10, dial["A1"].top())
pipette.dispense(10, dial["A1"].top())
pipette.drop_tip(trash)
ctx.move_labware(rack, OFF_DECK)

0 comments on commit 394365e

Please sign in to comment.