diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-04-11 13:44:42 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-04-11 13:44:42 +0200 |
commit | f8e54de2258d24e107a5df08bdd20c7234312652 (patch) | |
tree | a8774e1a5cdd94fd113e47a6e4e934fd286f6d39 /lib | |
parent | 26e2bd1f6b008549186ce89726ec55c5024f24dc (diff) |
support low-voltage measurements with inaccurate energy data
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/dfatool.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py index 994f8a2..0939ed0 100755 --- a/lib/dfatool.py +++ b/lib/dfatool.py @@ -155,7 +155,12 @@ class MIMOSA: ua_r1 = self.voltage / self.r1 * 1000000 ua_r2 = self.voltage / self.r2 * 1000000 - b_lower = (ua_r2 - 0) / (cal_r2_mean - cal_0_mean) + if cal_r2_mean > cal_0_mean: + b_lower = (ua_r2 - 0) / (cal_r2_mean - cal_0_mean) + else: + print("WARNING: 0 uA == 33 uA during calibration") + b_lower = 0 + b_upper = (ua_r1 - ua_r2) / (cal_r1_mean - cal_r2_mean) b_total = (ua_r1 - 0) / (cal_r1_mean - cal_0_mean) |