Commit 219f7e45 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Computes last_rho and last dev on strictly positive or negative pulses

Showing with 7 additions and 5 deletions
+7 -5
......@@ -49,8 +49,8 @@ if within_ohmpi:
k._hw.vab_square_wave(3.,1)
k._hw.switch_mux([1, 4, 2, 3], state='off')
k._hw.calibrate_rx_bias() # electrodes 1 4 2 3 should be connected to a reference circuit
print(f'Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
k._hw._plot_readings()
# print(f'Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
# k._hw._plot_readings()
k._hw.switch_mux([1, 4, 2, 3], state='on')
k._hw.vab_square_wave(3.,1)
k._hw.switch_mux([1, 4, 2, 3], state='off')
......
......@@ -204,15 +204,17 @@ class OhmPiHardware:
@property
def last_rho(self):
if len(self.readings) > 1:
return np.mean(np.abs(self.readings[:, 4] - self.sp) / self.readings[:, 3])
v = self.readings[:, 2] != 0
if len(v) > 1:
return np.mean(np.abs(self.readings[v, 4] - self.sp) / self.readings[v, 3])
else:
return np.nan
@property
def last_dev(self):
if len(self.readings) > 1:
return 100. * np.std(self.readings[:, 2] * (self.readings[:, 4] - self.sp) / self.readings[:, 3])/self.last_rho
v = self.readings[:,2] != 0
return 100. * np.std(self.readings[v, 2] * (self.readings[v, 4] - self.sp) / self.readings[v, 3])/self.last_rho
else:
return np.nan
......
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