summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-04-11 13:44:42 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-04-11 13:44:42 +0200
commitf8e54de2258d24e107a5df08bdd20c7234312652 (patch)
treea8774e1a5cdd94fd113e47a6e4e934fd286f6d39 /lib
parent26e2bd1f6b008549186ce89726ec55c5024f24dc (diff)
support low-voltage measurements with inaccurate energy data
Diffstat (limited to 'lib')
-rwxr-xr-xlib/dfatool.py7
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)