Commit edaa2682 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Refactors test_mux in test_mux_one_relay in OhmpiHardware

Showing with 10 additions and 5 deletions
+10 -5
...@@ -51,6 +51,10 @@ if stand_alone: ...@@ -51,6 +51,10 @@ if stand_alone:
current = tx.current current = tx.current
mux.switch(elec_dict={'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='off') mux.switch(elec_dict={'A': [1], 'B': [4], 'M': [2], 'N': [3]}, state='off')
print(f'Resistance: {voltage / current :.2f} ohm, voltage: {voltage:.2f} mV, current: {current:.2f} mA') print(f'Resistance: {voltage / current :.2f} ohm, voltage: {voltage:.2f} mV, current: {current:.2f} mA')
mux.reset()
mux.test({'A': [i for i in range(1, 9)], 'B': [i for i in range(1, 9)],
'M': [i for i in range(1, 9)], 'N': [i for i in range(1, 9)]}, activation_time=.1)
mux.reset()
# mux as part of a OhmPiHardware system # mux as part of a OhmPiHardware system
if part_of_hardware_system: if part_of_hardware_system:
...@@ -65,8 +69,9 @@ if part_of_hardware_system: ...@@ -65,8 +69,9 @@ if part_of_hardware_system:
# time.sleep(1.) # time.sleep(1.)
# k.switch_mux(electrodes=[1, 4, 2, 3], roles=['A', 'B', 'M', 'N'], state='off') # k.switch_mux(electrodes=[1, 4, 2, 3], roles=['A', 'B', 'M', 'N'], state='off')
# k.mux_boards[mux_id].test(activation_time=.4) # k.mux_boards[mux_id].test(activation_time=.4)
k.test_mux((1,'A')) # k.test_mux_one_relay((1, 'A'))
if within_ohmpi: if within_ohmpi:
from ohmpi.ohmpi import OhmPi from ohmpi.ohmpi import OhmPi
# from ohmpi.plots import plot_exec_log # from ohmpi.plots import plot_exec_log
...@@ -75,7 +80,7 @@ if within_ohmpi: ...@@ -75,7 +80,7 @@ if within_ohmpi:
k = OhmPi() k = OhmPi()
# A, B, M, N = (32, 29, 31, 30) # A, B, M, N = (32, 29, 31, 30)
k.reset_mux() k.reset_mux()
k.test_mux(mux_id='mux_03') k.test_mux_one_relay(mux_id='mux_03')
# k._hw.switch_mux([A, B, M, N], state='on') # k._hw.switch_mux([A, B, M, N], state='on')
# k._hw.vab_square_wave(12.,1., cycles=2) # k._hw.vab_square_wave(12.,1., cycles=2)
# k._hw.switch_mux([A, B, M, N], state='off') # k._hw.switch_mux([A, B, M, N], state='off')
......
...@@ -502,7 +502,7 @@ class OhmPiHardware: ...@@ -502,7 +502,7 @@ class OhmPiHardware:
self.exec_logger.event(f'OhmPiHardware\tswitch_mux\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'OhmPiHardware\tswitch_mux\tend\t{datetime.datetime.utcnow()}')
return status return status
def test_mux(self, channel=None, activation_time=1.0): def test_mux_one_relay(self, channel=None, activation_time=1.0): #TODO: is this needed at OhmpiHardware level?
"""Interactive method to test the multiplexer. """Interactive method to test the multiplexer.
Parameters Parameters
......
...@@ -825,7 +825,7 @@ class OhmPi(object): ...@@ -825,7 +825,7 @@ class OhmPi(object):
""" """
self.reset_mux() # All mux boards should be reset even if we only want to test one otherwise we might create a shortcut self.reset_mux() # All mux boards should be reset even if we only want to test one otherwise we might create a shortcut
if mux_id is None: if mux_id is None:
self._hw.test_mux(activation_time=activation_time) self._hw.test_mux_one_relay(activation_time=activation_time)
else: else:
self._hw.mux_boards[mux_id].test(activation_time=activation_time) self._hw.mux_boards[mux_id].test(activation_time=activation_time)
......
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