From 3cb0a1ca1022e48d000e6b549732bd495c3f11cc Mon Sep 17 00:00:00 2001
From: su530201 <olivier.kaufmann@umons.ac.be>
Date: Tue, 10 Oct 2023 16:45:46 +0200
Subject: [PATCH] Tries to implement VMN sign within mb_2023 and mb_2024

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

diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py
index 6c38b4a6..e6ebd5d1 100644
--- a/ohmpi/hardware_system.py
+++ b/ohmpi/hardware_system.py
@@ -377,7 +377,7 @@ class OhmPiHardware:
         fig, ax = plt.subplots(nrows=5, sharex=True)
         ax[0].plot(self.readings[:, 0], self.readings[:, 3], '-r', marker='.', label='iab')
         ax[0].set_ylabel('Iab [mA]')
-        ax[1].plot(self.readings[:, 0], self.readings[:, 2] * (self.readings[:, 4] - self.sp) , '-b', marker='.', label='vmn')
+        ax[1].plot(self.readings[:, 0], self.readings[:, 4] - self.sp , '-b', marker='.', label='vmn')
         ax[1].set_ylabel('Vmn [mV]')
         ax[2].plot(self.readings[:, 0], self.readings[:, 2], '-g', marker='.', label='polarity')
         ax[2].set_ylabel('polarity [-]')
diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py
index e9c49cc7..682b9a23 100644
--- a/ohmpi/ohmpi.py
+++ b/ohmpi/ohmpi.py
@@ -465,12 +465,12 @@ class OhmPi(object):
             x = np.where((self._hw.readings[:, 0] >= delay) & (self._hw.readings[:, 2] != 0))
             print(f'length of series: {len(x)}')
             # R = np.mean((self._hw.readings[x, 2] * (self._hw.readings[x, 4] - self._hw.sp)) / self._hw.readings[x, 3])
-            Vmn = np.mean(self._hw.readings[x, 2] * (self._hw.readings[x, 4])) # - self._hw.sp))
+            Vmn = np.mean(self._hw.readings[x, 2] * (self._hw.readings[x, 4] - self._hw.sp))
             Vmn_std = 100. * np.std(self._hw.readings[x, 2] * (self._hw.readings[x, 4])) # - self._hw.sp))
             I = np.mean(self._hw.readings[x, 3])
             I_std = 100. * np.std(self._hw.readings[x, 3])
             R = Vmn / I
-            R_std = 100. * np.std((self._hw.readings[x, 2] * (self._hw.readings[x, 4] - self._hw.sp)) / self._hw.readings[x, 3]) / R
+            R_std = 100. * np.std((self._hw.readings[x, 4] - self._hw.sp) / self._hw.readings[x, 3]) / R
 
             d = {
                 "time": datetime.now().isoformat(),
-- 
GitLab