instrumentkit / InstrumentKit

Python package for interacting with laboratory equipment over various buses.
250 stars 71 forks source link

Fix hypothesis precision errors #380

Closed Gracecr closed 2 years ago

Gracecr commented 2 years ago

This fixes the failing tests related to updating hypothesis.

I didn't look too far into test_keithley580.py::test_measure, but increasing the threshold seemed to fix it.

For test_blu.py::test_format_eight_length_values hypothesis seems to have revealed a bug where values close to 0 with 3 digit exponents would get set to the wrong size. I simply forced those values to 0, which seems like an alright solution unless there's a need for such small values.

Also the function claims 1% error, but this is only true for positive numbers. For negative numbers, the error can be as high as 5%. I haven't done the math to figure out why this is, but I did make a plot showing near-5% error. Figure_1

scasagrande commented 2 years ago

Huh, very interesting

I'll accept this into my branch, and then I'll make a few more tweaks 😄 ty for the contribution