From 8982fb2ed8f5b8f5feb533dca1589a40e8723b19 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Sun, 23 Apr 2023 21:02:53 +0200 Subject: [PATCH] Adds controller and soh in abstract hardware __init__ --- hardware/abstract_hardware.py | 1 - test_measure_with_ohmpi_card_3_15.py | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hardware/abstract_hardware.py b/hardware/abstract_hardware.py index d438dea6..a1845bc4 100644 --- a/hardware/abstract_hardware.py +++ b/hardware/abstract_hardware.py @@ -132,7 +132,6 @@ class TxAbstract(ABC): if self.soh_logger is None: self.soh_logger = create_stdout_logger('soh_tx') self.controller = kwargs.pop('controller', None) - #self._polarity = polarity self._inj_time = None self._dps_state = 'off' self._adc_gain = 1. diff --git a/test_measure_with_ohmpi_card_3_15.py b/test_measure_with_ohmpi_card_3_15.py index 511c54c3..c676f2d0 100644 --- a/test_measure_with_ohmpi_card_3_15.py +++ b/test_measure_with_ohmpi_card_3_15.py @@ -27,9 +27,9 @@ k.vab_square_wave(vab=12, cycle_length=cycle_length, sampling_rate=k.rx.sampling r = k.readings[:,4]/k.readings[:,3] print(f'Mean resistance: {np.mean(r):.3f} Ohms, Dev. {100*np.std(r)/np.mean(r):.1f} %') print(f'sampling rate: {k.rx.sampling_rate:.1f} ms, mean sample spacing: {np.mean(np.diff(k.readings[:,0]))*1000.:.1f} ms') -print(r) -print(f'length of array: {len(r)}, expected length: {cycle_length*cycles/k.rx.sampling_rate}') -print(k.readings) +print(f'length of array: {len(r)}, expected length: {cycle_length*cycles*1000./k.rx.sampling_rate}') + +# Plot graphs fig, ax = plt.subplots() ax.plot(k.readings[:,0], k.readings[:,3], '-r', marker='.', label='iab') ax.set_ylabel('Iab [mA]') @@ -38,14 +38,13 @@ ax2.plot(k.readings[:,0], k.readings[:,2]*k.readings[:,4], '-b', marker='.', lab ax2.set_ylabel('Vmn [mV]') fig.legend() plt.show() -# compute resistances corrected for SP + +# Compute resistances corrected for SP print(f'SP: {k.sp} mV') r = ((k.readings[:,4]-k.readings[:,2]*k.sp)/k.readings[:,3]) print(f'Mean resistance with sp correction : {np.mean(r):.3f} Ohms, Dev. {100*np.std(r)/np.mean(r):.1f} %') print('\nTesting with pulses') r = [np.abs((k.pulses[i]['polarity']*k.pulses[i]['vmn']-k.sp)/k.pulses[i]['iab']) for i in k.pulses.keys()] -print(r) for i in range(len(r)): print(f'Mean resistance with sp correction for pulse{i}: {np.mean(r[i]):.3f} Ohms, Dev. {100*np.std(r[i])/np.mean(r[i]):.1f} %') change_config('config_default.py', verbose=False) - -- GitLab