diff --git a/schainpy/controller.py b/schainpy/controller.py index a4201e0..bddf750 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -573,7 +573,7 @@ class Controller(): #If every process unit finished so end process if not(finalSts): - print "Every process unit finished" + print "Every process units have finished" break if __name__ == '__main__': @@ -598,7 +598,7 @@ if __name__ == '__main__': procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) opObj10 = procUnitConfObj1.addOperation(name='selectChannels') - opObj10.addParameter(name='channelList', value='0,1', format='intlist') + opObj10.addParameter(name='channelList', value='0,1,3', format='intlist') opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') opObj11.addParameter(name='idfigure', value='1', format='int') diff --git a/schainpy/model/jrodata.py b/schainpy/model/jrodata.py index a3bab2a..4779b74 100644 --- a/schainpy/model/jrodata.py +++ b/schainpy/model/jrodata.py @@ -118,7 +118,7 @@ class JROData: dtype = None - nChannels = None +# nChannels = None nHeights = None @@ -128,8 +128,6 @@ class JROData: channelList = None - channelIndexList = None - flagNoData = True flagTimeBlock = False @@ -178,6 +176,17 @@ class JROData: return self.flagNoData + def getNChannels(self): + + return len(self.channelList) + + def getChannelIndexList(self): + + return range(self.nChannels) + + nChannels = property(getNChannels, "I'm the 'nChannel' property.") + channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") + class Voltage(JROData): #data es un numpy array de 2 dmensiones (canales, alturas) @@ -198,7 +207,7 @@ class Voltage(JROData): self.dtype = None - self.nChannels = 0 +# self.nChannels = 0 self.nHeights = 0 @@ -208,7 +217,7 @@ class Voltage(JROData): self.channelList = None - self.channelIndexList = None +# self.channelIndexList = None self.flagNoData = True @@ -281,7 +290,7 @@ class Spectra(JROData): self.dtype = None - self.nChannels = 0 +# self.nChannels = 0 self.nHeights = 0 @@ -291,7 +300,7 @@ class Spectra(JROData): self.channelList = None - self.channelIndexList = None +# self.channelIndexList = None self.flagNoData = True @@ -398,7 +407,7 @@ class SpectraHeis(JROData): self.dtype = None - self.nChannels = 0 +# self.nChannels = 0 self.nHeights = 0 @@ -408,7 +417,7 @@ class SpectraHeis(JROData): self.channelList = None - self.channelIndexList = None +# self.channelIndexList = None self.flagNoData = True diff --git a/schainpy/model/jrodataIO.py b/schainpy/model/jrodataIO.py index 4d99fcb..8da175e 100644 --- a/schainpy/model/jrodataIO.py +++ b/schainpy/model/jrodataIO.py @@ -1317,7 +1317,7 @@ class VoltageReader(JRODataReader): self.dataOut.dtype = self.dtype - self.dataOut.nChannels = self.systemHeaderObj.nChannels +# self.dataOut.nChannels = self.systemHeaderObj.nChannels self.dataOut.nHeights = self.processingHeaderObj.nHeights @@ -1329,7 +1329,7 @@ class VoltageReader(JRODataReader): self.dataOut.channelList = range(self.systemHeaderObj.nChannels) - self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels) +# self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels) self.dataOut.flagTimeBlock = self.flagTimeBlock @@ -1961,7 +1961,7 @@ class SpectraReader(JRODataReader): self.dataOut.dtype = self.dtype - self.dataOut.nChannels = self.nRdChannels +# self.dataOut.nChannels = self.nRdChannels self.dataOut.nPairs = self.nRdPairs @@ -1982,7 +1982,7 @@ class SpectraReader(JRODataReader): self.dataOut.channelList = range(self.systemHeaderObj.nChannels) - self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels) +# self.dataOut.channelIndexList = range(self.systemHeaderObj.nChannels) self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000.#+ self.profileIndex * self.ippSeconds diff --git a/schainpy/model/jroplot.py b/schainpy/model/jroplot.py index ae93d4f..3c7c06a 100644 --- a/schainpy/model/jroplot.py +++ b/schainpy/model/jroplot.py @@ -107,7 +107,7 @@ class SpectraPlot(Figure): xlabel = "m/s" for i in range(len(self.axesList)): - title = "Channel %d: %4.2fdB" %(i, noise[i]) + title = "Channel %d: %4.2fdB" %(channelList[i], noise[i]) axes = self.axesList[i] z2 = z[i,:,:] axes.pcolor(x, y, z2, self.xmin, self.xmax, self.ymin, self.ymax, self.zmin, self.zmax, xlabel, ylabel, title) diff --git a/schainpy/model/jroprocessing.py b/schainpy/model/jroprocessing.py index 074664e..909e981 100644 --- a/schainpy/model/jroprocessing.py +++ b/schainpy/model/jroprocessing.py @@ -225,7 +225,13 @@ class VoltageProc(ProcessingUnit): def selectChannels(self, channelList): - self.selectChannelsByIndex(channelList) + channelIndexList = [] + + for channel in channelList: + index = self.dataOut.channelList.index(channel) + channelIndexList.append(index) + + self.selectChannelsByIndex(channelIndexList) def selectChannelsByIndex(self, channelIndexList): """ @@ -246,19 +252,18 @@ class VoltageProc(ProcessingUnit): None """ - for channel in channelIndexList: - if channel not in self.dataOut.channelIndexList: + for channelIndex in channelIndexList: + if channelIndex not in self.dataOut.channelIndexList: print channelIndexList - raise ValueError, "The value %d in channelIndexList is not valid" %channel + raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex nChannels = len(channelIndexList) data = self.dataOut.data[channelIndexList,:] self.dataOut.data = data - self.dataOut.channelIndexList = channelIndexList self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] - self.dataOut.nChannels = nChannels +# self.dataOut.nChannels = nChannels return 1 @@ -475,12 +480,12 @@ class SpectraProc(ProcessingUnit): self.dataOut.heightList = self.dataIn.heightList self.dataOut.dtype = self.dataIn.dtype self.dataOut.nHeights = self.dataIn.nHeights - self.dataOut.nChannels = self.dataIn.nChannels +# self.dataOut.nChannels = self.dataIn.nChannels self.dataOut.nBaud = self.dataIn.nBaud self.dataOut.nCode = self.dataIn.nCode self.dataOut.code = self.dataIn.code self.dataOut.nProfiles = self.dataOut.nFFTPoints - self.dataOut.channelIndexList = self.dataIn.channelIndexList +# self.dataOut.channelIndexList = self.dataIn.channelIndexList self.dataOut.flagTimeBlock = self.dataIn.flagTimeBlock self.dataOut.utctime = self.firstdatatime self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada @@ -594,7 +599,13 @@ class SpectraProc(ProcessingUnit): def selectChannels(self, channelList): - self.selectChannelsByIndex(channelList) + channelIndexList = [] + + for channel in channelList: + index = self.dataOut.channelList.index(channel) + channelIndexList.append(index) + + self.selectChannelsByIndex(channelIndexList) def selectChannelsByIndex(self, channelIndexList): """ @@ -615,19 +626,18 @@ class SpectraProc(ProcessingUnit): None """ - for channel in channelIndexList: - if channel not in self.dataOut.channelIndexList: + for channelIndex in channelIndexList: + if channelIndex not in self.dataOut.channelIndexList: print channelIndexList - raise ValueError, "The value %d in channelIndexList is not valid" %channel + raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex nChannels = len(channelIndexList) data = self.dataOut.data_spc[channelIndexList,:] - self.dataOut.data_spc = data - self.dataOut.channelIndexList = channelIndexList + self.dataOut.data = data self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] - self.dataOut.nChannels = nChannels +# self.dataOut.nChannels = nChannels return 1