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

Changes _tx_compute_volt

Showing with 6 additions and 6 deletions
+6 -6
...@@ -235,7 +235,7 @@ class OhmPiHardware: ...@@ -235,7 +235,7 @@ class OhmPiHardware:
sp = np.mean(mean_vmn[np.ix_(polarity == 1)] - mean_vmn[np.ix_(polarity == -1)]) / 2 sp = np.mean(mean_vmn[np.ix_(polarity == 1)] - mean_vmn[np.ix_(polarity == -1)]) / 2
return sp return sp
def _compute_tx_volt(self, best_tx_injtime=0.1, strategy='vmax', tx_volt=5, def _compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5,
vab_max=voltage_max, vmn_min=voltage_min): vab_max=voltage_max, vmn_min=voltage_min):
"""Estimates best Tx voltage based on different strategies. """Estimates best Tx voltage based on different strategies.
At first a half-cycle is made for a short duration with a fixed At first a half-cycle is made for a short duration with a fixed
...@@ -250,8 +250,8 @@ class OhmPiHardware: ...@@ -250,8 +250,8 @@ class OhmPiHardware:
Parameters Parameters
---------- ----------
best_tx_injtime : float, optional pulse_duration : float, optional
Time in milliseconds for the half-cycle used to compute Rab. Time in seconds for the pulse used to compute Rab.
strategy : str, optional strategy : str, optional
Either: Either:
- vmax : compute Vab to reach a maximum Iab without exceeding vab_max - vmax : compute Vab to reach a maximum Iab without exceeding vab_max
...@@ -280,11 +280,11 @@ class OhmPiHardware: ...@@ -280,11 +280,11 @@ class OhmPiHardware:
vmn_min = np.abs(vmn_min) vmn_min = np.abs(vmn_min)
vab = np.min([np.abs(tx_volt), vab_max]) vab = np.min([np.abs(tx_volt), vab_max])
self.tx.turn_on() self.tx.turn_on()
if 1000 / self.rx.sampling_rate > best_tx_injtime: if 1. / self.rx.sampling_rate > pulse_duration:
sampling_rate = 1000.0 / best_tx_injtime # TODO: check this... sampling_rate = 1. / pulse_duration # TODO: check this...
else: else:
sampling_rate = self.tx.sampling_rate sampling_rate = self.tx.sampling_rate
self._vab_pulse(vab=vab, duration=best_tx_injtime, sampling_rate=sampling_rate) # TODO: use a square wave pulse? self._vab_pulse(vab=vab, duration=pulse_duration, sampling_rate=sampling_rate) # TODO: use a square wave pulse?
vmn = np.mean(self.readings[:, 4]) vmn = np.mean(self.readings[:, 4])
iab = np.mean(self.readings[:, 3]) iab = np.mean(self.readings[:, 3])
# if np.abs(vmn) is too small (smaller than voltage_min), strategy is not constant and vab < vab_max , # if np.abs(vmn) is too small (smaller than voltage_min), strategy is not constant and vab < vab_max ,
......
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