Commit 13f39f3d authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Tests event logging

Showing with 5 additions and 1 deletion
+5 -1
......@@ -233,18 +233,22 @@ class Rx(RxAbstract):
self.exec_logger.debug(f'Setting RX ADC gain to {value}')
def adc_gain_auto(self):
self.exec_logger.event(f'{self.board_name}\tAuto_Gain_RX\tbegin\t{datetime.datetime.utcnow()}')
gain_0 = _gain_auto(AnalogIn(self._ads_voltage, ads.P0))
gain_2 = _gain_auto(AnalogIn(self._ads_voltage, ads.P2))
gain = np.min([gain_0, gain_2])
self.exec_logger.debug(f'Setting RX ADC gain automatically to {gain}')
self.adc_gain = gain
self.exec_logger.event(f'{self.board_name}\tAuto_Gain_RX\tend\t{datetime.datetime.utcnow()}')
@property
def voltage(self):
""" Gets the voltage VMN in Volts
"""
self.exec_logger.event(f'{self.board_name}\Measure_Voltage_RX\tbegin\t{datetime.datetime.utcnow()}')
u0 = AnalogIn(self._ads_voltage, ads.P0).voltage * 1000.
u2 = AnalogIn(self._ads_voltage, ads.P2).voltage * 1000.
u = np.max([u0,u2]) * (np.heaviside(u0-u2, 1.) * 2 - 1.) # gets the max between u0 & u2 and set the sign
u = np.max([u0, u2]) * (np.heaviside(u0-u2, 1.) * 2 - 1.) # gets the max between u0 & u2 and set the sign
self.exec_logger.debug(f'Reading voltages {u0} mV and {u2} mV on RX. Returning {u} mV')
self.exec_logger.event(f'{self.board_name}\Measure_Voltage_RX\tend\t{datetime.datetime.utcnow()}')
return u
\ No newline at end of file
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