Closed AsCress closed 1 month ago
@bessman Can I get some guidance regarding the failed CI ? Thanks.
I'm travelling today and won't be able to look this over properly until tonight. But regarding the CI, the tests fail because the recorded serial traffic no longer matches the calls made to the device.
The traffic needs to be re-recorded. To do this, you need to install pytest
, and then check if the relevant tests pass when run against a real device. Do this by running pytest --integration tests/test_multimeter.py
.
If the tests pass, record the serial traffic with pytest --record tests/test_multimeter.py
. Then commit the updated traffic logs.
If the tests don't pass, we can take a look at it together tomorrow.
The linting fails because the file multimeter.py does not adhere to the project style, which is black. Install black
and run black pslab/instrument/multimeter.py
, which will automatically format the file to the correct style.
Also, note the docstring at the top of test_multimeter.py:
"""Tests for PSL.multimeter.
When integration testing, connect:
PV1 -> 10K resistor -> VOL
RES -> 10K resistor -> GND
CAP -> 1 nF capacitor -> GND
"""
@bessman Thank you so much !! I'll surely do this things.
@bessman Done everything you said. The tests were passing ! I have recorded the data and commited. The CI passes now. It can also be noted in test_capacitance_measurement.json
that we now require much less iterations for the measuring job.
@bessman Tested this today thoroughly. I tried some other improvements / workarounds but this one seems the best to me. I guess this is now ready for a final review from your side.
@bessman I have done all the changes and re-recorded the tests.
Thanks!
Fixes #226 Improves the algorithm for measuring capacitance, making it akin to the one implemented in pslab-android.
Changes
meaure_capacitance
is modified to setcurrent_range
and calculatecharge_time
directly from the voltage output of_measure_capacitance
.binary_search_capacitance
is removed as it is unused now.stray_capacitance
is adjusted accordingly to the algorithm.Screenshots / Recordings
I tested with a PSLab V6 device, with the library installed on Windows. Here are the results:
Unfortunately, I couldn't test further due to the limited availability of capacitors.
@bessman I noticed that the time the PSLab device takes to calculate capacitance has now reduced. I haven't touched
_measure_rc_capacitance
. You were right, it doesn't work quite well, and the same issue exists in Android. I'll sort that out in Android first, and then address it here. Also, this is my first time writing something in Python :)). I have tried to observe the files and followed a similar pattern. Do inform me if I have done something wrong (not followed conventions of the language or something).