Commit 6519600c authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Adds rx bias calibration

Showing with 2 additions and 2 deletions
+2 -2
...@@ -254,6 +254,6 @@ class Rx(RxAbstract): ...@@ -254,6 +254,6 @@ class Rx(RxAbstract):
""" Gets the voltage VMN in Volts """ Gets the voltage VMN in Volts
""" """
self.exec_logger.event(f'{self.board_name}\trx_voltage\tbegin\t{datetime.datetime.utcnow()}') 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. - self._bias # TODO: check if it should be negated 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()}') self.exec_logger.event(f'{self.board_name}\trx_voltage\tend\t{datetime.datetime.utcnow()}')
return u return u
...@@ -319,7 +319,7 @@ class OhmPiHardware: ...@@ -319,7 +319,7 @@ class OhmPiHardware:
plt.show() plt.show()
def calibrate_rx_bias(self): def calibrate_rx_bias(self):
self.tx._bias = np.mean(self.readings[self.readings[:, 2] == 1, 4]) \ self.rx._bias = np.mean(self.readings[self.readings[:, 2] == 1, 4]) \
+ np.mean(self.readings[self.readings[:, 2] == -1, 4]) / 2. + 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): def vab_square_wave(self, vab, cycle_length, sampling_rate=None, cycles=3, polarity=1, append=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