Commit 034baa3d authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Attemps to use the sampling_rate in _vab_pulse

Showing with 5 additions and 5 deletions
+5 -5
...@@ -17,7 +17,6 @@ class TxAbstract(ABC): ...@@ -17,7 +17,6 @@ class TxAbstract(ABC):
if polarity is None: if polarity is None:
polarity = 0 polarity = 0
self._polarity = polarity self._polarity = polarity
print(f'polarity: {polarity}') # TODO: delete me
inj_time = kwargs.pop('inj_time', 1.) inj_time = kwargs.pop('inj_time', 1.)
self.exec_logger = kwargs.pop('exec_logger', None) self.exec_logger = kwargs.pop('exec_logger', None)
if self.exec_logger is None: if self.exec_logger is None:
......
...@@ -58,7 +58,7 @@ class OhmPiHardware: ...@@ -58,7 +58,7 @@ class OhmPiHardware:
self.tx.voltage_pulse(length=duration) self.tx.voltage_pulse(length=duration)
self.tx_sync.clear() self.tx_sync.clear()
def read_values(self, sampling_rate): # noqa def read_values(self, data, sampling_rate): # noqa
_readings = [] _readings = []
self.tx_sync.wait() self.tx_sync.wait()
start_time = datetime.datetime.utcnow() start_time = datetime.datetime.utcnow()
...@@ -66,19 +66,20 @@ class OhmPiHardware: ...@@ -66,19 +66,20 @@ class OhmPiHardware:
lap = datetime.datetime.utcnow() lap = datetime.datetime.utcnow()
_readings.append([elapsed_seconds(start_time), self.tx.current, self.rx.voltage]) _readings.append([elapsed_seconds(start_time), self.tx.current, self.rx.voltage])
time.sleep(sampling_rate/1000.-elapsed_seconds(lap)) time.sleep(sampling_rate/1000.-elapsed_seconds(lap))
return np.array(_readings) data = np.array(_readings)
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:
self.tx.polarity = polarity self.tx.polarity = polarity
self.tx.voltage = vab self.tx.voltage = vab
data = np.ndarray()
injection = Thread(target=inject, args=[self], kwargs={'duration':length}) injection = Thread(target=inject, args=[self], kwargs={'duration':length})
readings = Thread(target=read_values, args=[self], kwargs={'sampling_rate': sampling_rate}) readings = Thread(target=read_values, args=[self, data], kwargs={'sampling_rate': sampling_rate})
# set gains automatically # set gains automatically
self.tx.adc_gain_auto() self.tx.adc_gain_auto()
self.rx.adc_gain_auto() self.rx.adc_gain_auto()
data = readings.start() readings.start()
injection.start() injection.start()
readings.join() readings.join()
injection.join() injection.join()
......
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