##// END OF EJS Templates
-Se modificó el atributo nChannels de la clase JROData y derivadas por la propiedad nChannels (llamada a la funcion self.getNChannels)...
Miguel Valdez -
r200:ac28b7810bcd
parent child
Show More
@@ -573,7 +573,7 class Controller():
573 573
574 574 #If every process unit finished so end process
575 575 if not(finalSts):
576 print "Every process unit finished"
576 print "Every process units have finished"
577 577 break
578 578
579 579 if __name__ == '__main__':
@@ -598,7 +598,7 if __name__ == '__main__':
598 598 procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId())
599 599
600 600 opObj10 = procUnitConfObj1.addOperation(name='selectChannels')
601 opObj10.addParameter(name='channelList', value='0,1', format='intlist')
601 opObj10.addParameter(name='channelList', value='0,1,3', format='intlist')
602 602
603 603 opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other')
604 604 opObj11.addParameter(name='idfigure', value='1', format='int')
@@ -118,7 +118,7 class JROData:
118 118
119 119 dtype = None
120 120
121 nChannels = None
121 # nChannels = None
122 122
123 123 nHeights = None
124 124
@@ -128,8 +128,6 class JROData:
128 128
129 129 channelList = None
130 130
131 channelIndexList = None
132
133 131 flagNoData = True
134 132
135 133 flagTimeBlock = False
@@ -178,6 +176,17 class JROData:
178 176
179 177 return self.flagNoData
180 178
179 def getNChannels(self):
180
181 return len(self.channelList)
182
183 def getChannelIndexList(self):
184
185 return range(self.nChannels)
186
187 nChannels = property(getNChannels, "I'm the 'nChannel' property.")
188 channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.")
189
181 190 class Voltage(JROData):
182 191
183 192 #data es un numpy array de 2 dmensiones (canales, alturas)
@@ -198,7 +207,7 class Voltage(JROData):
198 207
199 208 self.dtype = None
200 209
201 self.nChannels = 0
210 # self.nChannels = 0
202 211
203 212 self.nHeights = 0
204 213
@@ -208,7 +217,7 class Voltage(JROData):
208 217
209 218 self.channelList = None
210 219
211 self.channelIndexList = None
220 # self.channelIndexList = None
212 221
213 222 self.flagNoData = True
214 223
@@ -281,7 +290,7 class Spectra(JROData):
281 290
282 291 self.dtype = None
283 292
284 self.nChannels = 0
293 # self.nChannels = 0
285 294
286 295 self.nHeights = 0
287 296
@@ -291,7 +300,7 class Spectra(JROData):
291 300
292 301 self.channelList = None
293 302
294 self.channelIndexList = None
303 # self.channelIndexList = None
295 304
296 305 self.flagNoData = True
297 306
@@ -398,7 +407,7 class SpectraHeis(JROData):
398 407
399 408 self.dtype = None
400 409
401 self.nChannels = 0
410 # self.nChannels = 0
402 411
403 412 self.nHeights = 0
404 413
@@ -408,7 +417,7 class SpectraHeis(JROData):
408 417
409 418 self.channelList = None
410 419
411 self.channelIndexList = None
420 # self.channelIndexList = None
412 421
413 422 self.flagNoData = True
414 423
@@ -1317,7 +1317,7 class VoltageReader(JRODataReader):
1317 1317
1318 1318 self.dataOut.dtype = self.dtype
1319 1319
1320 self.dataOut.nChannels = self.systemHeaderObj.nChannels
1320 # self.dataOut.nChannels = self.systemHeaderObj.nChannels
1321 1321
1322 1322 self.dataOut.nHeights = self.processingHeaderObj.nHeights
1323 1323
@@ -1329,7 +1329,7 class VoltageReader(JRODataReader):
1329 1329
1330 1330 self.dataOut.channelList = range(self.systemHeaderObj.nChannels)
1331 1331
1332 self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1332 # self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1333 1333
1334 1334 self.dataOut.flagTimeBlock = self.flagTimeBlock
1335 1335
@@ -1961,7 +1961,7 class SpectraReader(JRODataReader):
1961 1961
1962 1962 self.dataOut.dtype = self.dtype
1963 1963
1964 self.dataOut.nChannels = self.nRdChannels
1964 # self.dataOut.nChannels = self.nRdChannels
1965 1965
1966 1966 self.dataOut.nPairs = self.nRdPairs
1967 1967
@@ -1982,7 +1982,7 class SpectraReader(JRODataReader):
1982 1982
1983 1983 self.dataOut.channelList = range(self.systemHeaderObj.nChannels)
1984 1984
1985 self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1985 # self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels)
1986 1986
1987 1987 self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000.#+ self.profileIndex * self.ippSeconds
1988 1988
@@ -107,7 +107,7 class SpectraPlot(Figure):
107 107 xlabel = "m/s"
108 108
109 109 for i in range(len(self.axesList)):
110 title = "Channel %d: %4.2fdB" %(i, noise[i])
110 title = "Channel %d: %4.2fdB" %(channelList[i], noise[i])
111 111 axes = self.axesList[i]
112 112 z2 = z[i,:,:]
113 113 axes.pcolor(x, y, z2, self.xmin, self.xmax, self.ymin, self.ymax, self.zmin, self.zmax, xlabel, ylabel, title)
@@ -225,7 +225,13 class VoltageProc(ProcessingUnit):
225 225
226 226 def selectChannels(self, channelList):
227 227
228 self.selectChannelsByIndex(channelList)
228 channelIndexList = []
229
230 for channel in channelList:
231 index = self.dataOut.channelList.index(channel)
232 channelIndexList.append(index)
233
234 self.selectChannelsByIndex(channelIndexList)
229 235
230 236 def selectChannelsByIndex(self, channelIndexList):
231 237 """
@@ -246,19 +252,18 class VoltageProc(ProcessingUnit):
246 252 None
247 253 """
248 254
249 for channel in channelIndexList:
250 if channel not in self.dataOut.channelIndexList:
255 for channelIndex in channelIndexList:
256 if channelIndex not in self.dataOut.channelIndexList:
251 257 print channelIndexList
252 raise ValueError, "The value %d in channelIndexList is not valid" %channel
258 raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex
253 259
254 260 nChannels = len(channelIndexList)
255 261
256 262 data = self.dataOut.data[channelIndexList,:]
257 263
258 264 self.dataOut.data = data
259 self.dataOut.channelIndexList = channelIndexList
260 265 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
261 self.dataOut.nChannels = nChannels
266 # self.dataOut.nChannels = nChannels
262 267
263 268 return 1
264 269
@@ -475,12 +480,12 class SpectraProc(ProcessingUnit):
475 480 self.dataOut.heightList = self.dataIn.heightList
476 481 self.dataOut.dtype = self.dataIn.dtype
477 482 self.dataOut.nHeights = self.dataIn.nHeights
478 self.dataOut.nChannels = self.dataIn.nChannels
483 # self.dataOut.nChannels = self.dataIn.nChannels
479 484 self.dataOut.nBaud = self.dataIn.nBaud
480 485 self.dataOut.nCode = self.dataIn.nCode
481 486 self.dataOut.code = self.dataIn.code
482 487 self.dataOut.nProfiles = self.dataOut.nFFTPoints
483 self.dataOut.channelIndexList = self.dataIn.channelIndexList
488 # self.dataOut.channelIndexList = self.dataIn.channelIndexList
484 489 self.dataOut.flagTimeBlock = self.dataIn.flagTimeBlock
485 490 self.dataOut.utctime = self.firstdatatime
486 491 self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada
@@ -594,7 +599,13 class SpectraProc(ProcessingUnit):
594 599
595 600 def selectChannels(self, channelList):
596 601
597 self.selectChannelsByIndex(channelList)
602 channelIndexList = []
603
604 for channel in channelList:
605 index = self.dataOut.channelList.index(channel)
606 channelIndexList.append(index)
607
608 self.selectChannelsByIndex(channelIndexList)
598 609
599 610 def selectChannelsByIndex(self, channelIndexList):
600 611 """
@@ -615,19 +626,18 class SpectraProc(ProcessingUnit):
615 626 None
616 627 """
617 628
618 for channel in channelIndexList:
619 if channel not in self.dataOut.channelIndexList:
629 for channelIndex in channelIndexList:
630 if channelIndex not in self.dataOut.channelIndexList:
620 631 print channelIndexList
621 raise ValueError, "The value %d in channelIndexList is not valid" %channel
632 raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex
622 633
623 634 nChannels = len(channelIndexList)
624 635
625 636 data = self.dataOut.data_spc[channelIndexList,:]
626 637
627 self.dataOut.data_spc = data
628 self.dataOut.channelIndexList = channelIndexList
638 self.dataOut.data = data
629 639 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
630 self.dataOut.nChannels = nChannels
640 # self.dataOut.nChannels = nChannels
631 641
632 642 return 1
633 643
General Comments 0
You need to be logged in to leave comments. Login now