diff --git a/schainpy/controller.py b/schainpy/controller.py index 2870952..0ed7b6c 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -635,7 +635,9 @@ class Project(Process): n = len(self.configurations) while not err: + #print("STAR") for conf in self.getUnits(): + #print("CONF: ",conf) ok = conf.run() if ok == 'Error': n -= 1 diff --git a/schainpy/model/proc/jroproc_base.py b/schainpy/model/proc/jroproc_base.py index 58b71d5..f98e4fa 100644 --- a/schainpy/model/proc/jroproc_base.py +++ b/schainpy/model/proc/jroproc_base.py @@ -57,13 +57,15 @@ class ProcessingUnit(object): ''' try: - if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: - return self.dataIn.isReady() - elif self.dataIn is None or not self.dataIn.error: + # if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: + # return self.dataIn.isReady() + #dataIn=None es unidades de Lectura, segunda parte unidades de procesamiento + if self.dataIn is None or (not self.dataIn.error and not self.dataIn.flagNoData): self.run(**kwargs) elif self.dataIn.error: self.dataOut.error = self.dataIn.error self.dataOut.flagNoData = True + except: err = traceback.format_exc() @@ -76,18 +78,19 @@ class ProcessingUnit(object): self.dataOut.error = True for op, optype, opkwargs in self.operations: - if optype == 'other' and not self.dataOut.flagNoData: + if optype == 'other' and self.dataOut.isReady(): try: self.dataOut = op.run(self.dataOut, **opkwargs) except Exception as e: + print(e) self.dataOut.error = True return 'Error' elif optype == 'external' and self.dataOut.isReady() : op.queue.put(copy.deepcopy(self.dataOut)) elif optype == 'external' and self.dataOut.error: - op.queue.put(self.dataOut) + op.queue.put(copy.deepcopy(self.dataOut)) - return 'Error' if self.dataOut.error else self.dataOut.isReady() + return 'Error' if self.dataOut.error else True#self.dataOut.isReady() def setup(self): diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index 8fd7263..24a56de 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -1663,7 +1663,7 @@ class IncohInt(Operation): dataOut.nIncohInt *= self.n dataOut.utctime = avgdatatime dataOut.flagNoData = False - + return dataOut class dopplerFlip(Operation): diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 4d1c85d..acea65e 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -5,7 +5,7 @@ from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecora from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon from schainpy.utils import log from time import time - +import numpy class VoltageProc(ProcessingUnit): @@ -61,16 +61,12 @@ class selectChannels(Operation): print("Missing channelList") return dataOut channelIndexList = [] - if type(self.channelList) is list: - pass - elif type(self.channelList) is tuple: - self.channelList = list(self.channelList) - else: - self.channelList = self.channelList.tolist() - - if type(dataOut.channelList) is not list: - dataOut.channelList = dataOut.channelList.tolist() + if type(dataOut.channelList) is not list: #leer array desde HDF5 + try: + dataOut.channelList = dataOut.channelList.tolist() + except Exception as e: + print("Select Channels: ",e) for channel in self.channelList: if channel not in dataOut.channelList: raise ValueError("Channel %d is not in %s" %(channel, str(dataOut.channelList))) @@ -98,7 +94,7 @@ class selectChannels(Operation): Return: None """ - + #print("selectChannelsByIndex") # for channelIndex in channelIndexList: # if channelIndex not in dataOut.channelIndexList: # raise ValueError("The value %d in channelIndexList is not valid" %channelIndex) @@ -117,11 +113,21 @@ class selectChannels(Operation): dataOut.channelList = range(len(channelIndexList)) elif dataOut.type == 'Spectra': - data_spc = dataOut.data_spc[channelIndexList, :] - dataOut.data_spc = data_spc - if hasattr(dataOut, 'data_dc') and dataOut.data_dc != None: - data_dc = dataOut.data_dc[channelIndexList, :] - dataOut.data_dc = data_dc + if hasattr(dataOut, 'data_spc'): + if dataOut.data_spc is None: + raise ValueError("data_spc is None") + return dataOut + else: + data_spc = dataOut.data_spc[channelIndexList, :] + dataOut.data_spc = data_spc + + # if hasattr(dataOut, 'data_dc') :# and + # if dataOut.data_dc is None: + # raise ValueError("data_dc is None") + # return dataOut + # else: + # data_dc = dataOut.data_dc[channelIndexList, :] + # dataOut.data_dc = data_dc # dataOut.channelList = [dataOut.channelList[i] for i in channelIndexList] dataOut.channelList = channelIndexList dataOut = self.__selectPairsByChannel(dataOut,channelIndexList) @@ -129,7 +135,7 @@ class selectChannels(Operation): return dataOut def __selectPairsByChannel(self, dataOut, channelList=None): - + #print("__selectPairsByChannel") if channelList == None: return @@ -143,7 +149,6 @@ class selectChannels(Operation): continue pairsIndexListSelected.append(pairIndex) - if not pairsIndexListSelected: dataOut.data_cspc = None dataOut.pairsList = []