Commit 86c2d13e authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Changes EVENT logging level

Showing with 6 additions and 1 deletion
+6 -1
......@@ -330,6 +330,7 @@ class RxAbstract(ABC):
self.exec_logger.debug(f'{self.board_name} RX initialization')
self._adc_gain = 1.
self._max_sampling_rate = np.inf
self._bias = 0.
@property
def adc_gain(self):
......
......@@ -254,6 +254,6 @@ class Rx(RxAbstract):
""" Gets the voltage VMN in Volts
"""
self.exec_logger.event(f'{self.board_name}\trx_voltage\tbegin\t{datetime.datetime.utcnow()}')
u = AnalogIn(self._ads_voltage, ads.P0, ads.P1).voltage * self._coef_p2 * 1000. # TODO: check if it should be negative
u = AnalogIn(self._ads_voltage, ads.P0, ads.P1).voltage * self._coef_p2 * 1000. - self._bias # TODO: check if it should be negated
self.exec_logger.event(f'{self.board_name}\trx_voltage\tend\t{datetime.datetime.utcnow()}')
return u
......@@ -318,6 +318,10 @@ class OhmPiHardware:
fig.legend()
plt.show()
def calibrate_rx_bias(self):
self.tx._bias = np.mean(self.readings[self.readings[:, 2] == 1, 4]) \
+ np.mean(self.readings[self.readings[:, 2] == -1, 4]) / 2.
def vab_square_wave(self, vab, cycle_length, sampling_rate=None, cycles=3, polarity=1, append=False):
self.exec_logger.event(f'OhmPiHardware\tvab_square_wave\tbegin\t{datetime.datetime.utcnow()}')
self.tx.polarity = polarity
......
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