Skip to content

Commit ddb9772

Browse files
authored
fix(hardware-testing): updates to the hardware-testing package for the new QC protocol (#18601)
<!-- Thanks for taking the time to open a Pull Request (PR)! Please make sure you've read the "Opening Pull Requests" section of our Contributing Guide: https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md#opening-pull-requests GitHub provides robust markdown to format your PR. Links, diagrams, pictures, and videos along with text formatting make it possible to create a rich and informative PR. For more information on GitHub markdown, see: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax To ensure your code is reviewed quickly and thoroughly, please fill out the sections below to the best of your ability! --> # Overview We needed a few more updates to the hardware-testing repository to make the gravimetric fixture work. Due to the way that it pulls in the hardware-testing package that is tagged with the release, even though we don't distribute hardware-testing with the normal distribution we need keep the updates in sync with the release tag. This PR is mainly focused at getting the changes to ui.py in so that we can have access to the output from hardware-testing package for a particular run put together with the results of that script run. This also adds an overloaded setter to TipPosition in _liquid_properites.py so that we can maintain type consistency for linting, and continue to have an argument option for customers so they don't need to import a specific type. <!-- Describe your PR at a high level. State acceptance criteria and how this PR fits into other work. Link issues, PRs, and other relevant resources. --> ## Test Plan and Hands on Testing <!-- Describe your testing of the PR. Emphasize testing not reflected in the code. Attach protocols, logs, screenshots and any other assets that support your testing. --> ## Changelog <!-- List changes introduced by this PR considering future developers and the end user. Give careful thought and clear documentation to breaking changes. --> ## Review requests <!-- - What do you need from reviewers to feel confident this PR is ready to merge? - Ask questions. --> ## Risk assessment <!-- - Indicate the level of attention this PR needs. - Provide context to guide reviewers. - Discuss trade-offs, coupling, and side effects. - Look for the possibility, even if you think it's small, that your change may affect some other part of the system. - For instance, changing return tip behavior may also change the behavior of labware calibration. - How do your unit tests and on hands on testing mitigate this PR's risks and the risk of future regressions? - Especially in high risk PRs, explain how you know your testing is enough. -->
1 parent 3b203fb commit ddb9772

File tree

6 files changed

+172
-65
lines changed

6 files changed

+172
-65
lines changed

api/src/opentrons/protocol_api/_liquid_properties.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,28 @@ def position_reference(self) -> PositionReference:
115115
return self._position_reference
116116

117117
@position_reference.setter
118-
def position_reference(self, new_position: str) -> None:
119-
self._position_reference = PositionReference(new_position)
118+
def position_reference(self, new_position: Union[str, PositionReference]) -> None:
119+
self._position_reference = (
120+
new_position
121+
if isinstance(new_position, PositionReference)
122+
else PositionReference(new_position)
123+
)
120124

121125
@property
122126
def offset(self) -> Coordinate:
123127
return self._offset
124128

125129
@offset.setter
126-
def offset(self, new_offset: Sequence[float]) -> None:
127-
x, y, z = validation.validate_coordinates(new_offset)
130+
def offset(self, new_offset: Union[Sequence[float], Coordinate]) -> None:
131+
if isinstance(new_offset, Coordinate):
132+
new_coordinate: Sequence[Union[int, float]] = [
133+
new_offset.x,
134+
new_offset.y,
135+
new_offset.z,
136+
]
137+
else:
138+
new_coordinate = new_offset
139+
x, y, z = validation.validate_coordinates(new_coordinate)
128140
self._offset = Coordinate(x=x, y=y, z=z)
129141

130142
def as_shared_data_model(self) -> SharedDataTipPosition:

hardware-testing/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ push-ot3:
216216
$(MAKE) push-plot-webpage-ot3
217217
$(MAKE) push-description-ot3
218218
$(MAKE) push-labware-ot3
219-
cd ../ && $(MAKE) -C shared-data push-ot3
219+
#cd ../ && $(MAKE) -C shared-data push-ot3
220220

221221
.PHONE: open-dev-app
222222
open-dev-app:

hardware-testing/hardware_testing/data/ui.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
"""Production QC User Interface."""
22
from opentrons.hardware_control import SyncHardwareAPI
33
from opentrons.hardware_control.types import StatusBarState
4+
from typing import Optional
45

56
PRINT_HEADER_NUM_SPACES = 4
67
PRINT_HEADER_DASHES = "-" * PRINT_HEADER_NUM_SPACES
78
PRINT_TITLE_POUNDS = "#" * PRINT_HEADER_NUM_SPACES
89
PRINT_HEADER_SPACES = " " * (PRINT_HEADER_NUM_SPACES - 1)
910
PRINT_HEADER_ASTERISK = "*"
1011

12+
outfile: Optional[str] = None
13+
14+
15+
def set_output_file(new_outfile: Optional[str]) -> None:
16+
"""Change the output location of the UI output.
17+
18+
If it is a string it will output to that as a file.
19+
if it is None it will default back to stdout
20+
"""
21+
global outfile
22+
outfile = new_outfile
23+
_output(f"Setting UI output to file {outfile}")
24+
25+
26+
def _output(msg: str) -> None:
27+
global outfile
28+
if outfile:
29+
with open(outfile, "a") as f:
30+
f.write(f"{msg}\n")
31+
else:
32+
print(msg)
33+
1134

1235
def get_user_answer(question: str) -> bool:
1336
"""Get user answer."""
@@ -23,7 +46,9 @@ def get_user_answer(question: str) -> bool:
2346

2447
def get_user_ready(message: str) -> None:
2548
"""Get user ready."""
26-
input(f"WAIT: {message}, press ENTER when ready: ")
49+
global outfile
50+
if not outfile:
51+
input(f"WAIT: {message}, press ENTER when ready: ")
2752

2853

2954
def alert_user_ready(message: str, hw: SyncHardwareAPI) -> None:
@@ -43,7 +68,7 @@ def print_title(title: str) -> None:
4368
length = len(title)
4469
pounds = PRINT_TITLE_POUNDS + ("#" * length) + PRINT_TITLE_POUNDS
4570
middle = f"#{PRINT_HEADER_SPACES}" f"{title}" f"{PRINT_HEADER_SPACES}#"
46-
print(f"\n{pounds}\n{middle}\n{pounds}\n")
71+
_output(f"\n{pounds}\n{middle}\n{pounds}\n")
4772

4873

4974
def print_header(header: str) -> None:
@@ -56,19 +81,19 @@ def print_header(header: str) -> None:
5681
length = len(header)
5782
dashes = PRINT_HEADER_DASHES + ("-" * length) + PRINT_HEADER_DASHES
5883
middle = f"|{PRINT_HEADER_SPACES}{header}{PRINT_HEADER_SPACES}|"
59-
print(f"\n{dashes}\n{middle}\n{dashes}\n")
84+
_output(f"\n{dashes}\n{middle}\n{dashes}\n")
6085

6186

6287
def print_error(message: str) -> None:
6388
"""Print error."""
64-
print(f"ERROR: {message}")
89+
_output(f"ERROR: {message}")
6590

6691

6792
def print_warning(message: str) -> None:
6893
"""Print warning."""
69-
print(f"WARNING: {message}")
94+
_output(f"WARNING: {message}")
7095

7196

7297
def print_info(message: str) -> None:
7398
"""Print information."""
74-
print(message)
99+
_output(message)

hardware-testing/hardware_testing/gravimetric/protocol_replacement/96ch1000.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tipracks_50ul,D2
1212
tipracks_200ul,,,,,,,,,
1313
tipracks_1000ul,,,,,,,,,
1414
labware_on_scale,nest_1_reservoir_195ml,A1,,,,,,,
15-
slot_scale,B1,,,,,,,,
15+
slot_scale,C1,,,,,,,,
1616
volumes_to_test_20ul,,,,,,,,,
1717
volumes_to_test_50ul,50,,,,,,,,
1818
volumes_to_test_200ul,,,,,,,,,

hardware-testing/hardware_testing/gravimetric/protocol_replacement/96ch200.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tipracks_50ul,D2,D3,C2,C3,B1,B2,B3,A1,A2
1212
tipracks_200ul,,,,,,,,,
1313
tipracks_1000ul,,,,,,,,,
1414
labware_on_scale,nest_1_reservoir_195ml,A1,,,,,,,
15-
slot_scale,B1,,,,,,,,
15+
slot_scale,C1,,,,,,,,
1616
volumes_to_test_20ul,,,,,,,,,
1717
volumes_to_test_50ul,50,,,,,,,,
1818
volumes_to_test_200ul,,,,,,,,,

0 commit comments

Comments
 (0)