From d4a36a0028aed6ebe0a3f8b8de43a2cb15603a52 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Thu, 21 Sep 2023 14:44:09 +0200 Subject: [PATCH] Changes the way sp is taken into account in R computation within ohmpi --- 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 3bad797e..1996b5e9 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -220,7 +220,7 @@ class OhmPiHardware: return np.nan @property - def sp(self): # TODO: use a time window within pulses + def sp(self): # TODO: allow for different strategies for computing sp (i.e. when sp drift is not linear) if self.readings.shape == (0,) or len(self.readings[self.readings[:, 2] == 1, :]) < 1 or \ len(self.readings[self.readings[:, 2] == -1, :]) < 1: self.exec_logger.warning('Unable to compute sp: readings should at least contain one positive and one ' diff --git a/ohmpi/ohmpi.py b/ohmpi/ohmpi.py index b12b8dc1..725bc99d 100644 --- a/ohmpi/ohmpi.py +++ b/ohmpi/ohmpi.py @@ -460,8 +460,8 @@ class OhmPi(object): delay = 0. 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]) - 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 = np.mean((self._hw.readings[x, 2] * (self._hw.readings[x, 4] - self._hw.sp)) / self._hw.readings[x, 3]) + R_std = 100. * np.std((self._hw.readings[x, 2] * (self._hw.readings[x, 4] - self._hw.sp)) / self._hw.readings[x, 3]) / R d = { "time": datetime.now().isoformat(), "A": quad[0], -- GitLab