@@ -635,7 +635,9 class Project(Process): | |||||
635 | n = len(self.configurations) |
|
635 | n = len(self.configurations) | |
636 |
|
636 | |||
637 | while not err: |
|
637 | while not err: | |
|
638 | #print("STAR") | |||
638 | for conf in self.getUnits(): |
|
639 | for conf in self.getUnits(): | |
|
640 | #print("CONF: ",conf) | |||
639 | ok = conf.run() |
|
641 | ok = conf.run() | |
640 | if ok == 'Error': |
|
642 | if ok == 'Error': | |
641 | n -= 1 |
|
643 | n -= 1 |
@@ -57,13 +57,15 class ProcessingUnit(object): | |||||
57 | ''' |
|
57 | ''' | |
58 |
|
58 | |||
59 | try: |
|
59 | try: | |
60 | if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: |
|
60 | # if self.dataIn is not None and self.dataIn.flagNoData and not self.dataIn.error: | |
61 | return self.dataIn.isReady() |
|
61 | # return self.dataIn.isReady() | |
62 | elif self.dataIn is None or not self.dataIn.error: |
|
62 | #dataIn=None es unidades de Lectura, segunda parte unidades de procesamiento | |
|
63 | if self.dataIn is None or (not self.dataIn.error and not self.dataIn.flagNoData): | |||
63 | self.run(**kwargs) |
|
64 | self.run(**kwargs) | |
64 | elif self.dataIn.error: |
|
65 | elif self.dataIn.error: | |
65 | self.dataOut.error = self.dataIn.error |
|
66 | self.dataOut.error = self.dataIn.error | |
66 | self.dataOut.flagNoData = True |
|
67 | self.dataOut.flagNoData = True | |
|
68 | ||||
67 | except: |
|
69 | except: | |
68 |
|
70 | |||
69 | err = traceback.format_exc() |
|
71 | err = traceback.format_exc() | |
@@ -76,18 +78,19 class ProcessingUnit(object): | |||||
76 | self.dataOut.error = True |
|
78 | self.dataOut.error = True | |
77 |
|
79 | |||
78 | for op, optype, opkwargs in self.operations: |
|
80 | for op, optype, opkwargs in self.operations: | |
79 |
if optype == 'other' and |
|
81 | if optype == 'other' and self.dataOut.isReady(): | |
80 | try: |
|
82 | try: | |
81 | self.dataOut = op.run(self.dataOut, **opkwargs) |
|
83 | self.dataOut = op.run(self.dataOut, **opkwargs) | |
82 | except Exception as e: |
|
84 | except Exception as e: | |
|
85 | print(e) | |||
83 | self.dataOut.error = True |
|
86 | self.dataOut.error = True | |
84 | return 'Error' |
|
87 | return 'Error' | |
85 | elif optype == 'external' and self.dataOut.isReady() : |
|
88 | elif optype == 'external' and self.dataOut.isReady() : | |
86 | op.queue.put(copy.deepcopy(self.dataOut)) |
|
89 | op.queue.put(copy.deepcopy(self.dataOut)) | |
87 | elif optype == 'external' and self.dataOut.error: |
|
90 | elif optype == 'external' and self.dataOut.error: | |
88 | op.queue.put(self.dataOut) |
|
91 | op.queue.put(copy.deepcopy(self.dataOut)) | |
89 |
|
92 | |||
90 | return 'Error' if self.dataOut.error else self.dataOut.isReady() |
|
93 | return 'Error' if self.dataOut.error else True#self.dataOut.isReady() | |
91 |
|
94 | |||
92 | def setup(self): |
|
95 | def setup(self): | |
93 |
|
96 |
@@ -1663,7 +1663,7 class IncohInt(Operation): | |||||
1663 | dataOut.nIncohInt *= self.n |
|
1663 | dataOut.nIncohInt *= self.n | |
1664 | dataOut.utctime = avgdatatime |
|
1664 | dataOut.utctime = avgdatatime | |
1665 | dataOut.flagNoData = False |
|
1665 | dataOut.flagNoData = False | |
1666 |
|
1666 | |||
1667 | return dataOut |
|
1667 | return dataOut | |
1668 |
|
1668 | |||
1669 | class dopplerFlip(Operation): |
|
1669 | class dopplerFlip(Operation): |
@@ -5,7 +5,7 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecora | |||||
5 | from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon |
|
5 | from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon | |
6 | from schainpy.utils import log |
|
6 | from schainpy.utils import log | |
7 | from time import time |
|
7 | from time import time | |
8 |
|
8 | import numpy | ||
9 |
|
9 | |||
10 |
|
10 | |||
11 | class VoltageProc(ProcessingUnit): |
|
11 | class VoltageProc(ProcessingUnit): | |
@@ -61,16 +61,12 class selectChannels(Operation): | |||||
61 | print("Missing channelList") |
|
61 | print("Missing channelList") | |
62 | return dataOut |
|
62 | return dataOut | |
63 | channelIndexList = [] |
|
63 | channelIndexList = [] | |
64 | if type(self.channelList) is list: |
|
|||
65 | pass |
|
|||
66 | elif type(self.channelList) is tuple: |
|
|||
67 | self.channelList = list(self.channelList) |
|
|||
68 | else: |
|
|||
69 | self.channelList = self.channelList.tolist() |
|
|||
70 |
|
||||
71 | if type(dataOut.channelList) is not list: |
|
|||
72 | dataOut.channelList = dataOut.channelList.tolist() |
|
|||
73 |
|
64 | |||
|
65 | if type(dataOut.channelList) is not list: #leer array desde HDF5 | |||
|
66 | try: | |||
|
67 | dataOut.channelList = dataOut.channelList.tolist() | |||
|
68 | except Exception as e: | |||
|
69 | print("Select Channels: ",e) | |||
74 | for channel in self.channelList: |
|
70 | for channel in self.channelList: | |
75 | if channel not in dataOut.channelList: |
|
71 | if channel not in dataOut.channelList: | |
76 | raise ValueError("Channel %d is not in %s" %(channel, str(dataOut.channelList))) |
|
72 | raise ValueError("Channel %d is not in %s" %(channel, str(dataOut.channelList))) | |
@@ -98,7 +94,7 class selectChannels(Operation): | |||||
98 | Return: |
|
94 | Return: | |
99 | None |
|
95 | None | |
100 | """ |
|
96 | """ | |
101 |
|
97 | #print("selectChannelsByIndex") | ||
102 | # for channelIndex in channelIndexList: |
|
98 | # for channelIndex in channelIndexList: | |
103 | # if channelIndex not in dataOut.channelIndexList: |
|
99 | # if channelIndex not in dataOut.channelIndexList: | |
104 | # raise ValueError("The value %d in channelIndexList is not valid" %channelIndex) |
|
100 | # raise ValueError("The value %d in channelIndexList is not valid" %channelIndex) | |
@@ -117,11 +113,21 class selectChannels(Operation): | |||||
117 | dataOut.channelList = range(len(channelIndexList)) |
|
113 | dataOut.channelList = range(len(channelIndexList)) | |
118 |
|
114 | |||
119 | elif dataOut.type == 'Spectra': |
|
115 | elif dataOut.type == 'Spectra': | |
120 | data_spc = dataOut.data_spc[channelIndexList, :] |
|
116 | if hasattr(dataOut, 'data_spc'): | |
121 |
dataOut.data_spc |
|
117 | if dataOut.data_spc is None: | |
122 | if hasattr(dataOut, 'data_dc') and dataOut.data_dc != None: |
|
118 | raise ValueError("data_spc is None") | |
123 | data_dc = dataOut.data_dc[channelIndexList, :] |
|
119 | return dataOut | |
124 | dataOut.data_dc = data_dc |
|
120 | else: | |
|
121 | data_spc = dataOut.data_spc[channelIndexList, :] | |||
|
122 | dataOut.data_spc = data_spc | |||
|
123 | ||||
|
124 | # if hasattr(dataOut, 'data_dc') :# and | |||
|
125 | # if dataOut.data_dc is None: | |||
|
126 | # raise ValueError("data_dc is None") | |||
|
127 | # return dataOut | |||
|
128 | # else: | |||
|
129 | # data_dc = dataOut.data_dc[channelIndexList, :] | |||
|
130 | # dataOut.data_dc = data_dc | |||
125 | # dataOut.channelList = [dataOut.channelList[i] for i in channelIndexList] |
|
131 | # dataOut.channelList = [dataOut.channelList[i] for i in channelIndexList] | |
126 | dataOut.channelList = channelIndexList |
|
132 | dataOut.channelList = channelIndexList | |
127 | dataOut = self.__selectPairsByChannel(dataOut,channelIndexList) |
|
133 | dataOut = self.__selectPairsByChannel(dataOut,channelIndexList) | |
@@ -129,7 +135,7 class selectChannels(Operation): | |||||
129 | return dataOut |
|
135 | return dataOut | |
130 |
|
136 | |||
131 | def __selectPairsByChannel(self, dataOut, channelList=None): |
|
137 | def __selectPairsByChannel(self, dataOut, channelList=None): | |
132 |
|
138 | #print("__selectPairsByChannel") | ||
133 | if channelList == None: |
|
139 | if channelList == None: | |
134 | return |
|
140 | return | |
135 |
|
141 | |||
@@ -143,7 +149,6 class selectChannels(Operation): | |||||
143 | continue |
|
149 | continue | |
144 |
|
150 | |||
145 | pairsIndexListSelected.append(pairIndex) |
|
151 | pairsIndexListSelected.append(pairIndex) | |
146 |
|
||||
147 | if not pairsIndexListSelected: |
|
152 | if not pairsIndexListSelected: | |
148 | dataOut.data_cspc = None |
|
153 | dataOut.data_cspc = None | |
149 | dataOut.pairsList = [] |
|
154 | dataOut.pairsList = [] |
General Comments 0
You need to be logged in to leave comments.
Login now