Skip to content

Commit

Permalink
feat(hardware-testing): Photometric 96 first pass (#12855)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jun 5, 2023
1 parent 4d67fd6 commit b501450
Show file tree
Hide file tree
Showing 14 changed files with 855 additions and 153 deletions.
16 changes: 11 additions & 5 deletions hardware-testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ test:
test-cov:
$(pytest) $(tests) $(test_opts) $(cov_opts)

.PHONY: test-photometric
test-photometric:
$(python) -m hardware_testing.gravimetric --photometric --simulate --pipette 1000 --channels 96 --tip 50 --trials 1
$(python) -m hardware_testing.gravimetric --photometric --simulate --pipette 1000 --channels 96 --tip 200 --trials 1
$(python) -m hardware_testing.gravimetric --photometric --simulate --pipette 1000 --channels 96 --tip 1000 --trials 1

.PHONY: test-gravimetric-single
test-gravimetric-single:
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --tip 1000 --trials 1
Expand All @@ -88,7 +94,7 @@ test-gravimetric-multi:
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 8 --tip 50 --trials 1

.PHONY: test-gravimetric
test-gravimetric: patch-for-gravimetric test-gravimetric-single test-gravimetric-multi
test-gravimetric: apply-patches-gravimetric test-gravimetric-single test-gravimetric-multi

.PHONY: test-production-qc
test-production-qc:
Expand Down Expand Up @@ -224,19 +230,19 @@ sync-ot3: sync-sw-ot3 sync-fw-ot3

.PHONY: push-ot3-gravimetric
push-ot3-gravimetric:
-$(MAKE) patch-for-gravimetric
-$(MAKE) apply-patches-gravimetric
$(MAKE) sync-sw-ot3

.PHONY: apply-patches-gravimetric
patch-for-gravimetric:
apply-patches-gravimetric:
cd ../ && git apply ./hardware-testing/hardware_testing/gravimetric/overrides/*.patch --allow-empty

.PHONY: remove-patches-gravimetric
unpatch-for-gravimetric:
remove-patches-gravimetric:
cd ../ && git apply ./hardware-testing/hardware_testing/gravimetric/overrides/*.patch --reverse --allow-empty

.PHONY: update-patches-gravimetric
gen-patches-for-gravimetric:
update-patches-gravimetric:
rm ./hardware_testing/gravimetric/overrides/*.patch
cd ../ && git diff origin/edge ./hardware/** > ./hardware-testing/hardware_testing/gravimetric/overrides/hardware.patch
cd ../ && git diff origin/edge ./api/** > ./hardware-testing/hardware_testing/gravimetric/overrides/api.patch
Expand Down
98 changes: 81 additions & 17 deletions hardware-testing/hardware_testing/gravimetric/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
gravimetric_ot3_p1000_multi_50ul_tip,
gravimetric_ot3_p1000_multi_200ul_tip,
gravimetric_ot3_p1000_multi_1000ul_tip,
photometric_ot3_p1000_96_50ul_tip,
photometric_ot3_p1000_96_200ul_tip,
photometric_ot3_p1000_96_1000ul_tip,
)

from . import execute, helpers, workarounds
from .config import GravimetricConfig, GANTRY_MAX_SPEED
from . import execute, helpers, workarounds, execute_photometric
from .config import GravimetricConfig, GANTRY_MAX_SPEED, PhotometricConfig
from .measurement import DELAY_FOR_MEASUREMENT

LABWARE_OFFSETS: List[dict] = []
Expand All @@ -37,6 +40,11 @@
200: gravimetric_ot3_p1000_multi_200ul_tip,
1000: gravimetric_ot3_p1000_multi_1000ul_tip,
},
96: {
50: photometric_ot3_p1000_96_50ul_tip,
200: photometric_ot3_p1000_96_200ul_tip,
1000: photometric_ot3_p1000_96_1000ul_tip,
},
},
}

Expand Down Expand Up @@ -83,6 +91,45 @@ def run(
)


def run_pm(
protocol: ProtocolContext,
pipette_volume: int,
tip_volume: int,
trials: int,
return_tip: bool,
blank: bool,
mix: bool,
inspect: bool,
user_volumes: bool,
gantry_speed: int,
touch_tip: bool,
) -> None:
"""Run."""
protocol_cfg = PROTOCOL_CFG[pipette_volume][96][tip_volume]
execute_photometric.run(
protocol,
PhotometricConfig(
name=protocol_cfg.metadata["protocolName"], # type: ignore[attr-defined]
pipette_mount="left",
pipette_volume=pipette_volume,
tip_volume=tip_volume,
trials=trials,
labware_offsets=LABWARE_OFFSETS,
photoplate=protocol_cfg.PHOTOPLATE_LABWARE, # type: ignore[attr-defined]
photoplate_slot=protocol_cfg.SLOT_PLATE, # type: ignore[attr-defined]
reservoir=protocol_cfg.RESERVOIR_LABWARE, # type: ignore[attr-defined]
reservoir_slot=protocol_cfg.SLOT_RESERVOIR, # type: ignore[attr-defined]
slots_tiprack=protocol_cfg.SLOTS_TIPRACK[tip_volume], # type: ignore[attr-defined]
return_tip=return_tip,
mix=mix,
inspect=inspect,
user_volumes=user_volumes,
gantry_speed=gantry_speed,
touch_tip=touch_tip,
),
)


if __name__ == "__main__":
parser = argparse.ArgumentParser("Pipette Testing")
parser.add_argument("--simulate", action="store_true")
Expand All @@ -99,6 +146,8 @@ def run(
parser.add_argument("--user-volumes", action="store_true")
parser.add_argument("--gantry-speed", type=int, default=GANTRY_MAX_SPEED)
parser.add_argument("--scale-delay", type=int, default=DELAY_FOR_MEASUREMENT)
parser.add_argument("--photometric", action="store_true")
parser.add_argument("--touch-tip", action="store_true")
args = parser.parse_args()
if not args.simulate and not args.skip_labware_offsets:
# getting labware offsets must be done before creating the protocol context
Expand All @@ -117,18 +166,33 @@ def run(
_protocol.requirements["apiLevel"], # type: ignore[attr-defined]
is_simulating=args.simulate,
)
run(
_ctx,
args.pipette,
args.channels,
args.tip,
args.trials,
args.increment,
args.return_tip,
args.blank,
args.mix,
args.inspect,
args.user_volumes,
args.gantry_speed,
args.scale_delay,
)
if args.photometric:
run_pm(
_ctx,
args.pipette,
args.tip,
args.trials,
args.return_tip,
args.blank,
args.mix,
args.inspect,
args.user_volumes,
args.gantry_speed,
args.touch_tip,
)
else:
run(
_ctx,
args.pipette,
args.channels,
args.tip,
args.trials,
args.increment,
args.return_tip,
args.blank,
args.mix,
args.inspect,
args.user_volumes,
args.gantry_speed,
args.scale_delay,
)
24 changes: 24 additions & 0 deletions hardware-testing/hardware_testing/gravimetric/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,31 @@ class GravimetricConfig:
scale_delay: int


@dataclass
class PhotometricConfig:
"""Execute photometric Setup Config."""

name: str
pipette_volume: int
pipette_mount: str
tip_volume: int
trials: int
labware_offsets: List[dict]
photoplate: str
photoplate_slot: int
reservoir: str
reservoir_slot: int
slots_tiprack: List[int]
return_tip: bool
mix: bool
inspect: bool
user_volumes: bool
gantry_speed: int
touch_tip: bool


GRAV_CONFIG_EXCLUDE_FROM_REPORT = ["labware_offsets", "slots_tiprack"]
PHOTO_CONFIG_EXCLUDE_FROM_REPORT = ["labware_offsets", "slots_tiprack"]

NUM_BLANK_TRIALS: Final = 3
NUM_MIXES_BEFORE_ASPIRATE = 5
Expand Down
Loading

0 comments on commit b501450

Please sign in to comment.