From 63108f64c1ab2e3615b3e3d49a9855d5c1f71911 Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Wed, 18 Oct 2023 23:13:51 +0200
Subject: [PATCH] Fixes bug in _compute_tx_volt

---
 dev/test_mb_2024_4_mux_2024.py | 4 ++--
 ohmpi/hardware_system.py       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dev/test_mb_2024_4_mux_2024.py b/dev/test_mb_2024_4_mux_2024.py
index f25c5d58..d243e1de 100644
--- a/dev/test_mb_2024_4_mux_2024.py
+++ b/dev/test_mb_2024_4_mux_2024.py
@@ -106,13 +106,13 @@ if within_ohmpi:
     # print(f'OhmPiHardware Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
     # k._hw._plot_readings()
     k.load_sequence('sequences/9991_GRAD_16_s1_a1.txt')
-    k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5)
+    k.run_sequence(tx_volt=5., injection_duration=1., nb_stack=2, duty_cycle=0.5)
     print('using OhmPi')
     #d = k.run_measurement([A, B, M, N], injection_duration=1., nb_stack=2, duty_cycle=0.5)
     # print(d)
     # k._hw._plot_readings()
     print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV')
-    print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
+    print(f'OhmPi: Resistance: {d["R [Ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
     # k._hw._plot_readings(save_fig=False)
     # plot_exec_log('ohmpi/logs/exec.log')
 change_config('../configs/config_default.py', verbose=False)
diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index a1a7db8e..0bd38d40 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -494,7 +494,7 @@ class OhmPiHardware:
                 readings.join()
                 injection.join()
                 v = np.where((self.readings[:, 0] > delay) & (self.readings[:, 2] != 0))[0]  # NOTE : discard data aquired in the first x ms
-                iab = self.readings[v, 3]
+                iab = self.readings[v, 3]/1000.
                 vmn = self.readings[v, 4]/1000. * self.readings[v, 2]
                 iab_mean = np.mean(iab)
                 iab_std = np.std(iab)
-- 
GitLab