@@ -420,6 +420,8 class Spectra(JROData): | |||||
420 | self.flagDeflipData = False #asumo q la data no esta sin flip |
|
420 | self.flagDeflipData = False #asumo q la data no esta sin flip | |
421 |
|
421 | |||
422 | self.flagShiftFFT = False |
|
422 | self.flagShiftFFT = False | |
|
423 | ||||
|
424 | self.ippFactor = 1 | |||
423 |
|
425 | |||
424 | def getNoisebyHildebrand(self): |
|
426 | def getNoisebyHildebrand(self): | |
425 | """ |
|
427 | """ | |
@@ -464,19 +466,19 class Spectra(JROData): | |||||
464 | return self.noise |
|
466 | return self.noise | |
465 |
|
467 | |||
466 | def getNoise(self, type = 1): |
|
468 | def getNoise(self, type = 1): | |
|
469 | if self.noise == None: | |||
|
470 | self.noise = numpy.zeros(self.nChannels) | |||
|
471 | ||||
|
472 | if type == 1: | |||
|
473 | self.noise = self.getNoisebyHildebrand() | |||
|
474 | ||||
|
475 | if type == 2: | |||
|
476 | self.noise = self.getNoisebySort() | |||
|
477 | ||||
|
478 | if type == 3: | |||
|
479 | self.noise = self.getNoisebyWindow() | |||
467 |
|
480 | |||
468 | self.noise = numpy.zeros(self.nChannels) |
|
481 | return self.noise | |
469 |
|
||||
470 | if type == 1: |
|
|||
471 | noise = self.getNoisebyHildebrand() |
|
|||
472 |
|
||||
473 | if type == 2: |
|
|||
474 | noise = self.getNoisebySort() |
|
|||
475 |
|
||||
476 | if type == 3: |
|
|||
477 | noise = self.getNoisebyWindow() |
|
|||
478 |
|
||||
479 | return noise |
|
|||
480 |
|
482 | |||
481 |
|
483 | |||
482 | def getFreqRange(self, extrapoints=0): |
|
484 | def getFreqRange(self, extrapoints=0): |
@@ -102,13 +102,13 class CrossSpectraPlot(Figure): | |||||
102 |
|
102 | |||
103 | if len(pairsIndexList) > 4: |
|
103 | if len(pairsIndexList) > 4: | |
104 | pairsIndexList = pairsIndexList[0:4] |
|
104 | pairsIndexList = pairsIndexList[0:4] | |
105 | factor = dataOut.normFactor |
|
105 | #factor = dataOut.normFactor | |
106 | x = dataOut.getVelRange(1) |
|
106 | x = dataOut.getVelRange(1) | |
107 | y = dataOut.getHeiRange() |
|
107 | y = dataOut.getHeiRange() | |
108 | z = dataOut.data_spc[:,:,:]/factor |
|
108 | z = dataOut.data_spc[:,:,:]#/factor | |
109 | # z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
109 | # z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
110 | avg = numpy.abs(numpy.average(z, axis=1)) |
|
110 | avg = numpy.abs(numpy.average(z, axis=1)) | |
111 | noise = dataOut.getNoise()/factor |
|
111 | noise = dataOut.getNoise()#/factor | |
112 |
|
112 | |||
113 | zdB = 10*numpy.log10(z) |
|
113 | zdB = 10*numpy.log10(z) | |
114 | avgdB = 10*numpy.log10(avg) |
|
114 | avgdB = 10*numpy.log10(avg) | |
@@ -151,7 +151,7 class CrossSpectraPlot(Figure): | |||||
151 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
151 | pair = dataOut.pairsList[pairsIndexList[i]] | |
152 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
152 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |
153 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime) |
|
153 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime) | |
154 |
zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:] |
|
154 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]) | |
155 | axes0 = self.axesList[i*self.__nsubplots] |
|
155 | axes0 = self.axesList[i*self.__nsubplots] | |
156 | axes0.pcolor(x, y, zdB, |
|
156 | axes0.pcolor(x, y, zdB, | |
157 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
157 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
@@ -159,7 +159,7 class CrossSpectraPlot(Figure): | |||||
159 | ticksize=9, colormap=power_cmap, cblabel='') |
|
159 | ticksize=9, colormap=power_cmap, cblabel='') | |
160 |
|
160 | |||
161 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime) |
|
161 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime) | |
162 |
zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:] |
|
162 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]) | |
163 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
163 | axes0 = self.axesList[i*self.__nsubplots+1] | |
164 | axes0.pcolor(x, y, zdB, |
|
164 | axes0.pcolor(x, y, zdB, | |
165 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
165 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
@@ -318,11 +318,11 class RTIPlot(Figure): | |||||
318 |
|
318 | |||
319 | tmin = None |
|
319 | tmin = None | |
320 | tmax = None |
|
320 | tmax = None | |
321 | factor = dataOut.normFactor |
|
321 | #factor = dataOut.normFactor | |
322 | x = dataOut.getTimeRange() |
|
322 | x = dataOut.getTimeRange() | |
323 | y = dataOut.getHeiRange() |
|
323 | y = dataOut.getHeiRange() | |
324 |
|
324 | |||
325 | z = dataOut.data_spc[channelIndexList,:,:]/factor |
|
325 | z = dataOut.data_spc[channelIndexList,:,:]#/factor | |
326 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
326 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
327 | avg = numpy.average(z, axis=1) |
|
327 | avg = numpy.average(z, axis=1) | |
328 |
|
328 | |||
@@ -506,14 +506,14 class SpectraPlot(Figure): | |||||
506 | if channel not in dataOut.channelList: |
|
506 | if channel not in dataOut.channelList: | |
507 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
507 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
508 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
508 | channelIndexList.append(dataOut.channelList.index(channel)) | |
509 | factor = dataOut.normFactor |
|
509 | #factor = dataOut.normFactor | |
510 | x = dataOut.getVelRange(1) |
|
510 | x = dataOut.getVelRange(1) | |
511 | y = dataOut.getHeiRange() |
|
511 | y = dataOut.getHeiRange() | |
512 |
|
512 | |||
513 | z = dataOut.data_spc[channelIndexList,:,:]/factor |
|
513 | z = dataOut.data_spc[channelIndexList,:,:]#/factor | |
514 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
514 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
515 | avg = numpy.average(z, axis=1) |
|
515 | avg = numpy.average(z, axis=1) | |
516 | noise = dataOut.getNoise()/factor |
|
516 | noise = dataOut.getNoise()#/factor | |
517 |
|
517 | |||
518 | zdB = 10*numpy.log10(z) |
|
518 | zdB = 10*numpy.log10(z) | |
519 | avgdB = 10*numpy.log10(avg) |
|
519 | avgdB = 10*numpy.log10(avg) | |
@@ -765,9 +765,9 class PowerProfilePlot(Figure): | |||||
765 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
765 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
766 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
766 | channelIndexList.append(dataOut.channelList.index(channel)) | |
767 |
|
767 | |||
768 | factor = dataOut.normFactor |
|
768 | #factor = dataOut.normFactor | |
769 | y = dataOut.getHeiRange() |
|
769 | y = dataOut.getHeiRange() | |
770 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
770 | x = dataOut.data_spc[channelIndexList,:,:]#/factor | |
771 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
771 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) | |
772 | avg = numpy.average(x, axis=1) |
|
772 | avg = numpy.average(x, axis=1) | |
773 |
|
773 | |||
@@ -1107,8 +1107,8 class Noise(Figure): | |||||
1107 | tmax = None |
|
1107 | tmax = None | |
1108 | x = dataOut.getTimeRange() |
|
1108 | x = dataOut.getTimeRange() | |
1109 | y = dataOut.getHeiRange() |
|
1109 | y = dataOut.getHeiRange() | |
1110 | factor = dataOut.normFactor |
|
1110 | #factor = dataOut.normFactor | |
1111 | noise = dataOut.getNoise()/factor |
|
1111 | noise = dataOut.getNoise()#/factor | |
1112 | noisedB = 10*numpy.log10(noise) |
|
1112 | noisedB = 10*numpy.log10(noise) | |
1113 |
|
1113 | |||
1114 | #thisDatetime = dataOut.datatime |
|
1114 | #thisDatetime = dataOut.datatime | |
@@ -1433,8 +1433,8 class RTIfromSpectraHeis(Figure): | |||||
1433 | x = dataOut.getTimeRange() |
|
1433 | x = dataOut.getTimeRange() | |
1434 | y = dataOut.getHeiRange() |
|
1434 | y = dataOut.getHeiRange() | |
1435 |
|
1435 | |||
1436 | factor = 1 |
|
1436 | #factor = 1 | |
1437 | data = dataOut.data_spc/factor |
|
1437 | data = dataOut.data_spc#/factor | |
1438 | data = numpy.average(data,axis=1) |
|
1438 | data = numpy.average(data,axis=1) | |
1439 | datadB = 10*numpy.log10(data) |
|
1439 | datadB = 10*numpy.log10(data) | |
1440 |
|
1440 |
@@ -1194,6 +1194,49 class SpectraProc(ProcessingUnit): | |||||
1194 | self.dataOut.frequency = frequency |
|
1194 | self.dataOut.frequency = frequency | |
1195 |
|
1195 | |||
1196 | return 1 |
|
1196 | return 1 | |
|
1197 | ||||
|
1198 | def getNoise(self, minHei, maxHei): | |||
|
1199 | ||||
|
1200 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |||
|
1201 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |||
|
1202 | ||||
|
1203 | if (maxHei > self.dataOut.heightList[-1]): | |||
|
1204 | maxHei = self.dataOut.heightList[-1] | |||
|
1205 | ||||
|
1206 | minIndex = 0 | |||
|
1207 | maxIndex = 0 | |||
|
1208 | heights = self.dataOut.heightList | |||
|
1209 | ||||
|
1210 | inda = numpy.where(heights >= minHei) | |||
|
1211 | indb = numpy.where(heights <= maxHei) | |||
|
1212 | ||||
|
1213 | try: | |||
|
1214 | minIndex = inda[0][0] | |||
|
1215 | except: | |||
|
1216 | minIndex = 0 | |||
|
1217 | ||||
|
1218 | try: | |||
|
1219 | maxIndex = indb[0][-1] | |||
|
1220 | except: | |||
|
1221 | maxIndex = len(heights) | |||
|
1222 | ||||
|
1223 | if (minIndex < 0) or (minIndex > maxIndex): | |||
|
1224 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |||
|
1225 | ||||
|
1226 | if (maxIndex >= self.dataOut.nHeights): | |||
|
1227 | maxIndex = self.dataOut.nHeights-1 | |||
|
1228 | ||||
|
1229 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] | |||
|
1230 | ||||
|
1231 | noise = numpy.zeros(self.dataOut.nChannels) | |||
|
1232 | ||||
|
1233 | for channel in range(self.dataOut.nChannels): | |||
|
1234 | daux = data_spc[channel,:,:] | |||
|
1235 | noise[channel] = hildebrand_sekhon(daux, self.dataOut.nIncohInt) | |||
|
1236 | ||||
|
1237 | self.dataOut.noise = noise.copy() | |||
|
1238 | ||||
|
1239 | return 1 | |||
1197 |
|
1240 | |||
1198 |
|
1241 | |||
1199 | class IncohInt(Operation): |
|
1242 | class IncohInt(Operation): |
General Comments 0
You need to be logged in to leave comments.
Login now