Commit 6a1e5e71 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Separates test_measure from Hardware system mux test -> moves mux tests to test_mux_2024

No related merge requests found
Showing with 20 additions and 7 deletions
+20 -7
...@@ -10,10 +10,6 @@ from OhmPi.hardware_system import OhmPiHardware ...@@ -10,10 +10,6 @@ from OhmPi.hardware_system import OhmPiHardware
k = OhmPiHardware() k = OhmPiHardware()
k.exec_logger.setLevel(logging.INFO) k.exec_logger.setLevel(logging.INFO)
# Test mux switching
k.reset_mux()
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='on')
# Test _vab_pulse: # Test _vab_pulse:
print('Testing positive _vab_pulse') print('Testing positive _vab_pulse')
k._vab_pulse(vab=12, length=1., sampling_rate=k.rx.sampling_rate, polarity=1) k._vab_pulse(vab=12, length=1., sampling_rate=k.rx.sampling_rate, polarity=1)
...@@ -55,7 +51,5 @@ r = [np.abs((k.pulses[i]['polarity']*k.pulses[i]['vmn']-k.sp)/k.pulses[i]['iab'] ...@@ -55,7 +51,5 @@ r = [np.abs((k.pulses[i]['polarity']*k.pulses[i]['vmn']-k.sp)/k.pulses[i]['iab']
for i in range(len(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} %') 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} %')
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='off')
k.reset_mux()
change_config('config_default.py', verbose=False) change_config('config_default.py', verbose=False)
import time import time
from utils import change_config from utils import change_config
import logging
change_config('config_mb_2023_mux_2024.py', verbose=False) change_config('config_mb_2023_mux_2024.py', verbose=False)
from OhmPi.hardware_components.mux_2024_rev_0_0 import Mux, MUX_CONFIG from OhmPi.hardware_components.mux_2024_rev_0_0 import Mux, MUX_CONFIG
from OhmPi.hardware_components import raspberry_pi as controller_module from OhmPi.hardware_components import raspberry_pi as controller_module
# Stand alone mux
MUX_CONFIG['controller'] = controller_module.Controller() MUX_CONFIG['controller'] = controller_module.Controller()
MUX_CONFIG['id'] = 'mux_1' MUX_CONFIG['id'] = 'mux_1'
MUX_CONFIG['default_mux_cabling'] = {(i+8, j) : ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)} MUX_CONFIG['default_mux_cabling'] = {(i+8, j) : ('mux_1', i) for j in ['A', 'B', 'M', 'N'] for i in range(1,9)}
...@@ -17,4 +20,20 @@ time.sleep(8) ...@@ -17,4 +20,20 @@ time.sleep(8)
mux.reset() mux.reset()
mux.test({'A': [9, 10, 11, 12, 13, 14, 15, 16], 'B': [9, 10, 11, 12, 13, 14, 15, 16], mux.test({'A': [9, 10, 11, 12, 13, 14, 15, 16], 'B': [9, 10, 11, 12, 13, 14, 15, 16],
'M': [9, 10, 11, 12, 13, 14, 15, 16], 'N': [9, 10, 11, 12, 13, 14, 15, 16]}) 'M': [9, 10, 11, 12, 13, 14, 15, 16], 'N': [9, 10, 11, 12, 13, 14, 15, 16]})
change_config('config_default.py', verbose=False)
# mux as part of a OhmPiHardware system
from utils import change_config
change_config('config_mb_2023_mux_2024.py', verbose=False)
from OhmPi.hardware_system import OhmPiHardware
print('Starting test of mux as part of a OhmPiHardware system.')
k = OhmPiHardware()
k.exec_logger.setLevel(logging.INFO)
# Test mux switching
k.reset_mux()
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='on')
time.sleep(1.)
k.switch_mux(electrodes=[9,10,11,12], roles=['A', 'B', 'M', 'N'], state='off')
change_config('config_default.py', verbose=False)
\ 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