From c7d6523d30eb4cb69adabae3c340bfc054ba727b Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Tue, 2 May 2023 16:19:24 +0200 Subject: [PATCH] Fixes bug in load_sequence --- hardware_components/abstract_hardware_components.py | 6 +++--- ohmpi.py | 13 ++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/hardware_components/abstract_hardware_components.py b/hardware_components/abstract_hardware_components.py index 44ecea2f..668cffb7 100644 --- a/hardware_components/abstract_hardware_components.py +++ b/hardware_components/abstract_hardware_components.py @@ -77,7 +77,7 @@ class MuxAbstract(ABC): @abstractmethod def reset(self): pass - def switch(self, elec_dict=None, state='on'): + def switch(self, elec_dict=None, state='on'): # TODO: generalize for other roles """Switch a given list of electrodes with different roles. Electrodes with a value of 0 will be ignored. @@ -119,8 +119,8 @@ class MuxAbstract(ABC): if (elec, role) in self.cabling.keys(): self.switch_one(elec, role, state) else: - self.exec_logger.debug(f'{self.board_id} skipping switching {(elec, role)} because it' - f'is not in board cabling {self.cabling}') + self.exec_logger.warning(f'{self.board_id} skipping switching {(elec, role)} because it ' + f'is not in board cabling.') self.exec_logger.debug(f'{self.board_id} switching done.') else: self.exec_logger.warning(f'Missing argument for {self.board_name}.switch: elec_dict is None.') diff --git a/ohmpi.py b/ohmpi.py index 54fef9d9..9b9a9671 100644 --- a/ohmpi.py +++ b/ohmpi.py @@ -38,7 +38,7 @@ except Exception as error: print(colored(f'Unexpected error: {error}', 'red')) arm64_imports = None -VERSION = '2.2.0-alpha' +VERSION = '3.0.0-alpha' class OhmPi(object): """ OhmPi class. @@ -301,19 +301,10 @@ class OhmPi(object): if sequence is not None: self.exec_logger.debug(f'Sequence of {sequence.shape[0]:d} quadrupoles read.') - # locate lines where the electrode index exceeds the maximum number of electrodes - test_index_elec = np.array(np.where(sequence > self.max_elec)) - # locate lines where electrode A == electrode B test_same_elec = self._find_identical_in_line(sequence) - # if statement with exit cases (TODO rajouter un else if pour le deuxième cas du ticket #2) - if test_index_elec.size != 0: - for i in range(len(test_index_elec[0, :])): - self.exec_logger.error(f'An electrode index at line {str(test_index_elec[0, i] + 1)} ' - f'exceeds the maximum number of electrodes') - sequence = None - elif len(test_same_elec) != 0: + if len(test_same_elec) != 0: for i in range(len(test_same_elec)): self.exec_logger.error(f'An electrode index A == B detected at line {str(test_same_elec[i] + 1)}') sequence = None -- GitLab