Skip to content

Commit

Permalink
chore(hardware-testing): Minor photometric changes (#12882)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Jun 17, 2023
1 parent 10923bf commit 4ad1b88
Show file tree
Hide file tree
Showing 25 changed files with 3,296 additions and 134 deletions.
26 changes: 16 additions & 10 deletions hardware-testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@ wheel: $(wheel_file)

.PHONY: test
test:
$(MAKE) apply-patches-gravimetric
-$(MAKE) apply-patches-gravimetric
$(pytest) $(tests) $(test_opts)
-$(MAKE) remove-patches-gravimetric

.PHONY: test-cov
test-cov:
$(MAKE) apply-patches-gravimetric
-$(MAKE) apply-patches-gravimetric
$(pytest) $(tests) $(test_opts) $(cov_opts)
-$(MAKE) remove-patches-gravimetric

.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
$(python) -m hardware_testing.gravimetric --photometric --simulate --pipette 1000 --channels 96 --tip 50 --trials 5
$(python) -m hardware_testing.gravimetric --photometric --simulate --pipette 1000 --channels 96 --tip 200 --trials 5

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

.PHONY: test-gravimetric
test-gravimetric: apply-patches-gravimetric test-gravimetric-single test-gravimetric-multi
test-gravimetric:
-$(MAKE) apply-patches-gravimetric
$(MAKE) test-gravimetric-single
$(MAKE) test-gravimetric-multi
-$(MAKE) remove-patches-gravimetric

.PHONY: test-production-qc
test-production-qc:
Expand All @@ -123,11 +128,11 @@ test-integration: test-production-qc test-examples test-scripts test-gravimetric

.PHONY: lint
lint:
$(MAKE) apply-patches-gravimetric
-$(MAKE) apply-patches-gravimetric
$(python) -m mypy hardware_testing tests
$(python) -m black --check hardware_testing tests setup.py
$(python) -m flake8 hardware_testing tests setup.py
$(MAKE) remove-patches-gravimetric
-$(MAKE) remove-patches-gravimetric

.PHONY: format
format:
Expand Down Expand Up @@ -234,8 +239,9 @@ sync-ot3: sync-sw-ot3 sync-fw-ot3

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

.PHONY: apply-patches-gravimetric
apply-patches-gravimetric:
Expand Down
49 changes: 29 additions & 20 deletions hardware-testing/hardware_testing/gravimetric/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@

from hardware_testing.data import ui
from hardware_testing.protocols import (
gravimetric_ot3_p50,
gravimetric_ot3_p50_single,
gravimetric_ot3_p50_multi_50ul_tip,
gravimetric_ot3_p1000,
gravimetric_ot3_p1000_single,
gravimetric_ot3_p1000_multi_50ul_tip,
gravimetric_ot3_p1000_multi_200ul_tip,
gravimetric_ot3_p1000_multi_1000ul_tip,
gravimetric_ot3_p1000_96_50ul_tip,
gravimetric_ot3_p1000_96_200ul_tip,
gravimetric_ot3_p1000_96_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, execute_photometric
Expand All @@ -27,32 +29,37 @@
LABWARE_OFFSETS: List[dict] = []

# Keyed by pipette volume, channel count, and tip volume in that order
PROTOCOL_CFG = {
GRAVIMETRIC_CFG = {
50: {
1: {50: gravimetric_ot3_p50},
1: {50: gravimetric_ot3_p50_single},
8: {50: gravimetric_ot3_p50_multi_50ul_tip},
},
1000: {
1: {
50: gravimetric_ot3_p1000,
200: gravimetric_ot3_p1000,
1000: gravimetric_ot3_p1000,
50: gravimetric_ot3_p1000_single,
200: gravimetric_ot3_p1000_single,
1000: gravimetric_ot3_p1000_single,
},
8: {
50: gravimetric_ot3_p1000_multi_50ul_tip,
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,
50: gravimetric_ot3_p1000_96_50ul_tip,
200: gravimetric_ot3_p1000_96_200ul_tip,
1000: gravimetric_ot3_p1000_96_1000ul_tip,
},
},
}

PHOTOMETRIC_CFG = {
50: photometric_ot3_p1000_96_50ul_tip,
200: photometric_ot3_p1000_96_200ul_tip,
}


def run(
def run_gravimetric(
protocol: ProtocolContext,
pipette_volume: int,
pipette_channels: int,
Expand All @@ -68,7 +75,7 @@ def run(
scale_delay: int,
) -> None:
"""Run."""
protocol_cfg = PROTOCOL_CFG[pipette_volume][pipette_channels][tip_volume]
protocol_cfg = GRAVIMETRIC_CFG[pipette_volume][pipette_channels][tip_volume]
execute.run(
protocol,
GravimetricConfig(
Expand All @@ -94,21 +101,21 @@ def run(
)


def run_pm(
def run_photometric(
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,
refill: bool,
) -> None:
"""Run."""
protocol_cfg = PROTOCOL_CFG[pipette_volume][96][tip_volume]
protocol_cfg = PHOTOMETRIC_CFG[tip_volume]
execute_photometric.run(
protocol,
PhotometricConfig(
Expand All @@ -129,6 +136,7 @@ def run_pm(
user_volumes=user_volumes,
gantry_speed=gantry_speed,
touch_tip=touch_tip,
refill=refill,
),
)

Expand All @@ -151,6 +159,7 @@ def run_pm(
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")
parser.add_argument("--refill", 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 @@ -164,28 +173,28 @@ def run_pm(
print(f"\t\t{offset['definitionUri']}")
print(f"\t\t{offset['vector']}")
LABWARE_OFFSETS.append(offset)
_protocol = PROTOCOL_CFG[args.pipette][args.channels][args.tip]
_protocol = GRAVIMETRIC_CFG[args.pipette][args.channels][args.tip]
_ctx = helpers.get_api_context(
API_LEVEL, # type: ignore[attr-defined]
is_simulating=args.simulate,
deck_version="2",
)
if args.photometric:
run_pm(
run_photometric(
_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,
args.refill,
)
else:
run(
run_gravimetric(
_ctx,
args.pipette,
args.channels,
Expand Down
1 change: 1 addition & 0 deletions hardware-testing/hardware_testing/gravimetric/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PhotometricConfig:
user_volumes: bool
gantry_speed: int
touch_tip: bool
refill: bool


GRAV_CONFIG_EXCLUDE_FROM_REPORT = ["labware_offsets", "slots_tiprack"]
Expand Down
2 changes: 1 addition & 1 deletion hardware-testing/hardware_testing/gravimetric/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
GravimetricRecorder,
GravimetricRecorderConfig,
)
from .radwag_pipette_calibration_vial import VIAL_DEFINITION
from .labware.radwag_pipette_calibration_vial import VIAL_DEFINITION
from .tips import get_tips, MULTI_CHANNEL_TEST_ORDER


Expand Down
Loading

0 comments on commit 4ad1b88

Please sign in to comment.