diff --git a/dev/test_2_mux_2024.py b/dev/test_2_mux_2024.py index d1516a9efcbf55c8f0f76d9bad8a01e1644cac6f..a9a541131a6d699773aa30e57dd85ac6e5803938 100644 --- a/dev/test_2_mux_2024.py +++ b/dev/test_2_mux_2024.py @@ -48,6 +48,7 @@ if within_ohmpi: k._hw.switch_mux([1, 4, 2, 3], state='on') k._hw.vab_square_wave(12,1) k._hw.switch_mux([1, 4, 2, 3], state='off') + print(f'Resistance: {k._hw.last_rho :.2f}, dev. {k._hw.last_dev:.2f} %') k._hw._plot_readings() plot_exec_log('ohmpi/logs/exec.log') change_config('../configs/config_default.py', verbose=False) \ No newline at end of file diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py index c7d45d44ec2f0dfe1af0bbd1e6e32b67521e83d3..96a71ae074dbfdc372e4cf09ba7d044d5b932f6d 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -172,7 +172,8 @@ class OhmPiHardware: sampling_rate = self.rx.sampling_rate sample = 0 self.exec_logger.info(f'values when starting pulse {self._pulse} : {self.tx.current} mA, {self.rx.voltage} mV') - self.rx.voltage + _ = self.rx.voltage + lap = datetime.datetime.utcnow() # just in case tx_sync is not set immediately after passing wait self.tx_sync.wait() # if not append or self._start_time is None: self._start_time = datetime.datetime.utcnow() @@ -196,12 +197,14 @@ class OhmPiHardware: self._pulse += 1 self.exec_logger.event(f'OhmPiHardware\tread_values\tend\t{datetime.datetime.utcnow()}') + @property def last_rho(self): if len(self.readings) > 1: return np.mean(self.readings[:, 2] * self.readings[:, 4] / self.readings[:, 3]) else: return np.nan + @property def last_dev(self): if len(self.readings) > 1: return 100. * np.std(self.readings[:, 2] * self.readings[:, 4] / self.readings[:, 3])/self.last_rho()