Commit ebb7e725 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Fix negative sleep_times

Showing with 2 additions and 3 deletions
+2 -3
...@@ -65,14 +65,13 @@ class OhmPiHardware: ...@@ -65,14 +65,13 @@ class OhmPiHardware:
sample+=1 sample+=1
sleep_time = start_time + datetime.timedelta(seconds = sample * sampling_rate / 1000) - lap sleep_time = start_time + datetime.timedelta(seconds = sample * sampling_rate / 1000) - lap
print(f'sleep_time: {sleep_time.total_seconds()} seconds') print(f'sleep_time: {sleep_time.total_seconds()} seconds')
time.sleep(sleep_time.total_seconds()) time.sleep(np.min([0, np.abs(sleep_time.total_seconds())]))
self.readings = np.array(_readings) self.readings = np.array(_readings)
def _vab_pulse(self, vab, length, sampling_rate=None, polarity=None): def _vab_pulse(self, vab, length, sampling_rate=None, polarity=None):
""" Gets VMN and IAB from a single voltage pulse """ Gets VMN and IAB from a single voltage pulse
""" """
if sampling_rate is None: if sampling_rate is None:
sampling_rate = RX_CONFIG['sampling_rate'] sampling_rate = RX_CONFIG['sampling_rate']
if polarity is not None and polarity != self.tx.polarity: if polarity is not None and polarity != self.tx.polarity:
......
...@@ -3,5 +3,5 @@ change_config('config_ohmpi_card_3_15.py', verbose=False) ...@@ -3,5 +3,5 @@ change_config('config_ohmpi_card_3_15.py', verbose=False)
from OhmPi.measure import OhmPiHardware from OhmPi.measure import OhmPiHardware
k = OhmPiHardware() k = OhmPiHardware()
k._vab_pulse(vab=12, length=1., sampling_rate=10., polarity=1) k._vab_pulse(vab=12, length=1., sampling_rate=20., polarity=1)
change_config('config_default.py', verbose=False) change_config('config_default.py', verbose=False)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment