Skip to content

Commit

Permalink
feat(hardware-testing): add upgrades for improved 8 channel QC tests (#…
Browse files Browse the repository at this point in the history
…13261)

* Collect all user input at the begining of a multi-tip run

* combine the p1k multip QC tests into a single protocol

* fix the get-tip-per-channel for the 8 channel

* add code to read serial from asair sensor

* make the driver return the correct type values

* temp

* move more things into the shared section of main

* pass around the recorder

* get the report into shared resources

* fixups

* make user messages better

* use labware's tiptracker to track unused tips

* more fixups for 8 channel

* pack the %d cv standards into the trials

* raise an error if the channel doesn't pass

* get liquid probe working

* we no longer need the alert user ready call

* run the 8 channel with 10 trials instead of 8

* add list of calls to the read me

* lint

* fix CI taking too long and format .md file

* add ability to turn off liquid probe. and add paramaterization for liquid probe

* use the tested liquid probe values

* set the spec dictionary to the advertised spec, then add saftey factor as a seperate variable

* style fixes

* fix liquid probe in simulator and remove unneeded print statements

* fix the asair driver tests to match how the device actually responds

* force a 2cm max distance on liquid probe
  • Loading branch information
ryanthecoder committed Aug 21, 2023
1 parent 58e9ec0 commit 5144fec
Show file tree
Hide file tree
Showing 19 changed files with 1,019 additions and 418 deletions.
16 changes: 11 additions & 5 deletions hardware-testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,18 @@ test-photometric:

.PHONY: test-gravimetric-single
test-gravimetric-single:
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --trials 1
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --extra --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 1 --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --trials 1 --increment --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --extra --no-blank --trials 1
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 1 --no-blank --trials 1
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 1 --no-blank --trials 1 --increment --tip 50
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --trials 1 --increment --no-blank --tip 50
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --trials 1 --increment --no-blank --tip 200
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 1 --trials 1 --increment --no-blank --tip 1000

.PHONY: test-gravimetric-multi
test-gravimetric-multi:
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 8 --tip 50 --trials 1 --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 8 --tip 50
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 8 --tip 50 --trials 1 --no-blank --extra
$(python) -m hardware_testing.gravimetric --simulate --pipette 50 --channels 8 --tip 50 --trials 1 --increment --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 8 --tip 1000 --trials 1 --no-blank
$(python) -m hardware_testing.gravimetric --simulate --pipette 1000 --channels 8 --tip 200 --trials 1 --extra --no-blank
Expand All @@ -117,6 +121,8 @@ test-gravimetric:
-$(MAKE) apply-patches-gravimetric
$(MAKE) test-gravimetric-single
$(MAKE) test-gravimetric-multi
$(MAKE) test-gravimetric-96
$(MAKE) test-photometric
-$(MAKE) remove-patches-gravimetric

.PHONY: test-production-qc
Expand Down
40 changes: 38 additions & 2 deletions hardware-testing/hardware_testing/drivers/asair_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"08": "C492",
"09": "C543",
"10": "C74A",
"0A": "48d9",
}


Expand Down Expand Up @@ -65,6 +66,11 @@ def get_reading(self) -> Reading:
"""Get a temp and humidity reading."""
...

@abc.abstractmethod
def get_serial(self) -> str:
"""Read the device ID register."""
...


def BuildAsairSensor(simulate: bool) -> AsairSensorBase:
"""Try to find and return an Asair sensor, if not found return a simulator."""
Expand Down Expand Up @@ -144,8 +150,8 @@ def get_reading(self) -> Reading:
log.debug(f"received {res}")

res = codecs.encode(res, "hex")
temp = res[6:10]
relative_hum = res[10:14]
relative_hum = res[6:10]
temp = res[10:14]
log.info(f"Temp: {temp}, RelativeHum: {relative_hum}")

temp = float(int(temp, 16)) / 10
Expand All @@ -160,10 +166,40 @@ def get_reading(self) -> Reading:
error_msg = "Asair Sensor not connected. Check if port number is correct."
raise AsairSensorError(error_msg)

def get_serial(self) -> str:
"""Read the device ID register."""
serial_addr = "0A"
data_packet = "{}0300000002{}".format(serial_addr, addrs[serial_addr])
log.debug(f"sending {data_packet}")
command_bytes = codecs.decode(data_packet.encode(), "hex")
try:
self._th_sensor.flushInput()
self._th_sensor.flushOutput()
self._th_sensor.write(command_bytes)
time.sleep(0.1)

length = self._th_sensor.inWaiting()
res = self._th_sensor.read(length)
log.debug(f"received {res}")
dev_id = res[6:14]
return dev_id.decode()

except (IndexError, ValueError) as e:
log.exception("Bad value read")
raise AsairSensorError(str(e))
except SerialException:
log.exception("Communication error")
error_msg = "Asair Sensor not connected. Check if port number is correct."
raise AsairSensorError(error_msg)


class SimAsairSensor(AsairSensorBase):
"""Simulating Asair sensor driver."""

def get_serial(self) -> str:
"""Read the device ID register."""
return "0102030405060708"

def get_reading(self) -> Reading:
"""Get a reading."""
temp = 25.0
Expand Down
27 changes: 27 additions & 0 deletions hardware-testing/hardware_testing/gravimetric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,31 @@ and substitute `internal-release` for whatever branch you're merging in to.

## Photometric tests

python3 -m hardware_testing.gravimetric --pipette 1000 --channels 96 --photometric --tip 50
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 96 --photometric --tip 200

## Gravimetric tests

###P1000 single channel QC
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 1
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 1 --extra
###P1000 multi channel QC
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 8
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 8 --extra
###P1000 96 channel QC
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 96
###P50 single channel QC
python3 -m hardware_testing.gravimetric --pipette 50 --channels 1
python3 -m hardware_testing.gravimetric --pipette 50 --channels 1 --extra
###P50 multi channel QC
python3 -m hardware_testing.gravimetric --pipette 50 --channels 8
python3 -m hardware_testing.gravimetric --pipette 50 --channels 8 --extra
###Increment tests
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 1 --increment --tip 50
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 1 --increment --tip 200
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 1 --increment --tip 1000
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 8 --increment --tip 50
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 8 --increment --tip 200
python3 -m hardware_testing.gravimetric --pipette 1000 --channels 8 --increment --tip 1000
python3 -m hardware_testing.gravimetric --pipette 50 --channels 1 --increment --tip 50
python3 -m hardware_testing.gravimetric --pipette 50 --channels 8 --increment --tip 50
Loading

0 comments on commit 5144fec

Please sign in to comment.