diff --git a/bdaq53/system/scan_base.py b/bdaq53/system/scan_base.py index 2bd1fb6fbd669bf1efcdd93289bf6e5f707a6db2..e49a38a55f9066b34917374d687b18a1f13654ca 100755 --- a/bdaq53/system/scan_base.py +++ b/bdaq53/system/scan_base.py @@ -260,20 +260,21 @@ class ScanBase(object): raise e def configure(self): + ret_values = [None] * self.n_chips() try: if not self.initialized: raise RuntimeError('Cannot call configure() before init() is called!') # Deactivate receiver to prevent recording useless data for _ in self.iterate_chips(): self._set_receiver_enabled(receiver=self.chip.receiver, enabled=False) - for _ in self.iterate_chips(): + for i, _ in enumerate(self.iterate_chips()): with self._logging_through_handler(self.log_fh): self.log.info('Configuring chip {0}...'.format(self.chip.get_sn())) # Load masks from config self._set_receiver_enabled(receiver=self.chip.receiver, enabled=True) self._configure_masks() # Scan dependent configuration step before actual scan can be started (set enable masks etc.) - self._configure(**self.scan_config) + ret_values[i] = self._configure(**self.scan_config) self.periphery.get_module_power(module=self.module_settings['name'], log=True) self._set_receiver_enabled(receiver=self.chip.receiver, enabled=False) @@ -282,6 +283,8 @@ class ScanBase(object): # Make sure monitor filter is blocking for all receivers before starting scan self.bdaq.set_monitor_filter(mode='block') + + return ret_values except Exception as e: self._on_exception() raise e @@ -294,6 +297,7 @@ class ScanBase(object): if self.chip_settings['use_ptot']: self.chip.enable_ptot() + ret_values = [None] * self.n_chips() try: if not self.initialized: raise RuntimeError('Cannot call scan() before init() is called!') @@ -311,11 +315,11 @@ class ScanBase(object): for _ in self.iterate_chips(): self._set_receiver_enabled(receiver=self.chip.receiver, enabled=False) else: - for _ in self.iterate_chips(): + for i, _ in enumerate(self.iterate_chips()): with self._logging_through_handler(self.log_fh): self.periphery.get_module_power(module=self.module_settings['name'], log=True) self._set_receiver_enabled(receiver=self.chip.receiver, enabled=True) - self._scan(**self.scan_config) + ret_values[i] = self._scan(**self.scan_config) self._set_receiver_enabled(receiver=self.chip.receiver, enabled=False) # Finalize scan # Disable tlu module in case it was enabled. @@ -334,6 +338,8 @@ class ScanBase(object): self._write_config_h5(self.h5_file, node) self._store_scan_par_values(self.h5_file) # store scan params in out node, since it is defined during scan step self.h5_file.close() + + return ret_values except Exception as e: self._on_exception() raise e @@ -343,16 +349,16 @@ class ScanBase(object): Loop over all chips in testbench and for each perform the analysis routine of the scan: - Analyze raw data, plotting ''' - + ret_values = [None] * self.n_chips() try: if self.configuration['bench']['analysis'].get('skip', False): return - for _ in self.iterate_chips(): + for i, _ in enumerate(self.iterate_chips()): with self._logging_through_handler(self.log_fh): # Perform actual analysis self.log.info('Starting analysis for ' + self.name + ' (' + self.chip_settings['chip_sn'] + ')') if self.configuration['bench']['analysis'].get('blocking', True): - self._analyze() + ret_values[i] = self._analyze() else: def analyze_and_close_file(): @@ -366,6 +372,7 @@ class ScanBase(object): self.ana_proc.start() if self.configuration['bench']['analysis'].get('module_plotting', True): self._run_module_plotting() + return ret_values except Exception as e: self._on_exception() raise e @@ -461,6 +468,9 @@ class ScanBase(object): self.set_chip_handles(c) yield c + def n_chips(self): + return len(self.chips) + def set_chip_handles(self, chip): ''' Add the chip properties that are kept in the chip container to this class.