##// END OF EJS Templates
En jrodata.py no se considera el factor para el caso del filtro en alturas, por el momento solo se realiza la suma de los valores sin ninguna division o normalizacion de este resultado, verficar en jroprocessing.py....
Daniel Valdez -
r268:43faa0eea275
parent child
Show More
@@ -479,7 +479,7 class Spectra(JROData):
479 pwcode = 1
479 pwcode = 1
480 if self.flagDecodeData:
480 if self.flagDecodeData:
481 pwcode = numpy.sum(self.code[0]**2)
481 pwcode = numpy.sum(self.code[0]**2)
482 normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*self.windowOfFilter*pwcode
482 normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode
483
483
484 return normFactor
484 return normFactor
485
485
@@ -1032,7 +1032,7 class JRODataWriter(JRODataIO, Operation):
1032 if self.fp != None:
1032 if self.fp != None:
1033 self.fp.close()
1033 self.fp.close()
1034
1034
1035 timeTuple = time.localtime( self.dataOut.dataUtcTime)
1035 timeTuple = time.localtime( self.dataOut.utctime)
1036 subfolder = 'D%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday)
1036 subfolder = 'D%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday)
1037
1037
1038 fullpath = os.path.join( path, subfolder )
1038 fullpath = os.path.join( path, subfolder )
@@ -1382,7 +1382,7 class VoltageReader(JRODataReader):
1382 if not( self.readNextBlock() ):
1382 if not( self.readNextBlock() ):
1383 return 0
1383 return 0
1384
1384
1385 self.dataOut.dtype = self.dtype
1385 self.dataOut.dtype = numpy.dtype([('real','<f8'),('imag','<f8')]) #self.dtype
1386
1386
1387 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock
1387 self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock
1388
1388
@@ -1966,7 +1966,7 class SpectraReader(JRODataReader):
1966 #desplaza a la derecha en el eje 2 determinadas posiciones
1966 #desplaza a la derecha en el eje 2 determinadas posiciones
1967 cspc = numpy.roll( cspc, shift, axis=2 )
1967 cspc = numpy.roll( cspc, shift, axis=2 )
1968
1968
1969 self.processingHeaderObj.shif_fft = True
1969 # self.processingHeaderObj.shif_fft = True
1970
1970
1971 spc = numpy.transpose( spc, (0,2,1) )
1971 spc = numpy.transpose( spc, (0,2,1) )
1972 self.data_spc = spc
1972 self.data_spc = spc
@@ -2040,7 +2040,7 class SpectraReader(JRODataReader):
2040
2040
2041 self.dataOut.flagNoData = False
2041 self.dataOut.flagNoData = False
2042
2042
2043 self.dataOut.dtype = self.dtype
2043 self.dataOut.dtype = numpy.dtype([('real','<f8'),('imag','<f8')])#self.dtype
2044
2044
2045 # self.dataOut.nChannels = self.nRdChannels
2045 # self.dataOut.nChannels = self.nRdChannels
2046
2046
@@ -2280,9 +2280,9 class SpectraWriter(JRODataWriter):
2280 if self.flagIsNewFile == 0:
2280 if self.flagIsNewFile == 0:
2281 self.getBasicHeader()
2281 self.getBasicHeader()
2282
2282
2283 self.data_spc = self.dataOut.data_spc
2283 self.data_spc = self.dataOut.data_spc.copy()
2284 self.data_cspc = self.dataOut.data_cspc
2284 self.data_cspc = self.dataOut.data_cspc.copy()
2285 self.data_dc = self.dataOut.data_dc
2285 self.data_dc = self.dataOut.data_dc.copy()
2286
2286
2287 # #self.processingHeaderObj.dataBlocksPerFile)
2287 # #self.processingHeaderObj.dataBlocksPerFile)
2288 if self.hasAllDataInBuffer():
2288 if self.hasAllDataInBuffer():
@@ -89,6 +89,7 class BasicHeader(Header):
89 return 1
89 return 1
90
90
91 def write(self, fp):
91 def write(self, fp):
92 self.utc -= self.__LOCALTIME
92 headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount)
93 headerTuple = (self.size,self.version,self.dataBlock,self.utc,self.miliSecond,self.timeZone,self.dstFlag,self.errorCount)
93 header = numpy.array(headerTuple,self.struct)
94 header = numpy.array(headerTuple,self.struct)
94 header.tofile(fp)
95 header.tofile(fp)
@@ -390,7 +391,7 class ProcessingHeader(Header):
390 if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE):
391 if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE):
391 self.nCode = int(numpy.fromfile(fp,'<u4',1))
392 self.nCode = int(numpy.fromfile(fp,'<u4',1))
392 self.nBaud = int(numpy.fromfile(fp,'<u4',1))
393 self.nBaud = int(numpy.fromfile(fp,'<u4',1))
393 self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nBaud,self.nCode)
394 self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nCode,self.nBaud)
394
395
395 if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA):
396 if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA):
396 self.shif_fft = True
397 self.shif_fft = True
@@ -449,13 +450,14 class ProcessingHeader(Header):
449
450
450
451
451 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
452 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
452 nCode = self.nCode #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba
453 nCode = numpy.array([self.nCode], numpy.dtype('u4')) #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba
453 nCode.tofile(fp)
454 nCode.tofile(fp)
454
455
455 nBaud = self.nBaud
456 nBaud = numpy.array([self.nBaud], numpy.dtype('u4'))
456 nBaud.tofile(fp)
457 nBaud.tofile(fp)
457
458
458 code = self.code.reshape(nCode*nBaud)
459 code = self.code.reshape(self.nCode*self.nBaud)
460 code = code.astype(numpy.dtype('<f4'))
459 code.tofile(fp)
461 code.tofile(fp)
460
462
461 return 1
463 return 1
@@ -53,7 +53,7 class CrossSpectraPlot(Figure):
53 counter += 1
53 counter += 1
54
54
55 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
55 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
56 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
56 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, normalize=True,
57 save=False, figpath='./', figfile=None,
57 save=False, figpath='./', figfile=None,
58 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r'):
58 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r'):
59
59
@@ -87,11 +87,14 class CrossSpectraPlot(Figure):
87
87
88 if len(pairsIndexList) > 4:
88 if len(pairsIndexList) > 4:
89 pairsIndexList = pairsIndexList[0:4]
89 pairsIndexList = pairsIndexList[0:4]
90 factor = dataOut.normFactor
90
91 factor = 1
92 if normalize:
93 factor = dataOut.normFactor
91 x = dataOut.getVelRange(1)
94 x = dataOut.getVelRange(1)
92 y = dataOut.getHeiRange()
95 y = dataOut.getHeiRange()
93 z = dataOut.data_spc[:,:,:]/factor
96 z = dataOut.data_spc[:,:,:]/factor
94 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
97
95 avg = numpy.average(z, axis=1)
98 avg = numpy.average(z, axis=1)
96 noise = dataOut.getNoise()/factor
99 noise = dataOut.getNoise()/factor
97
100
@@ -238,7 +241,7 class RTIPlot(Figure):
238 counter += 1
241 counter += 1
239
242
240 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
243 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
241 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
244 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, normalize=True,
242 timerange=None,
245 timerange=None,
243 save=False, figpath='./', figfile=None):
246 save=False, figpath='./', figfile=None):
244
247
@@ -272,7 +275,9 class RTIPlot(Figure):
272
275
273 tmin = None
276 tmin = None
274 tmax = None
277 tmax = None
275 factor = dataOut.normFactor
278 factor = 1
279 if normalize:
280 factor = dataOut.normFactor
276 x = dataOut.getTimeRange()
281 x = dataOut.getTimeRange()
277 y = dataOut.getHeiRange()
282 y = dataOut.getHeiRange()
278
283
@@ -418,7 +423,7 class SpectraPlot(Figure):
418 counter += 1
423 counter += 1
419
424
420 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
425 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
421 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
426 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, normalize=True,
422 save=False, figpath='./', figfile=None):
427 save=False, figpath='./', figfile=None):
423
428
424 """
429 """
@@ -445,7 +450,9 class SpectraPlot(Figure):
445 if channel not in dataOut.channelList:
450 if channel not in dataOut.channelList:
446 raise ValueError, "Channel %d is not in dataOut.channelList"
451 raise ValueError, "Channel %d is not in dataOut.channelList"
447 channelIndexList.append(dataOut.channelList.index(channel))
452 channelIndexList.append(dataOut.channelList.index(channel))
448 factor = dataOut.normFactor
453 factor = 1
454 if normalize:
455 factor = dataOut.normFactor
449 x = dataOut.getVelRange(1)
456 x = dataOut.getVelRange(1)
450 y = dataOut.getHeiRange()
457 y = dataOut.getHeiRange()
451
458
@@ -651,7 +658,7 class ProfilePlot(Figure):
651 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
658 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
652
659
653 def run(self, dataOut, idfigure, wintitle="", channelList=None,
660 def run(self, dataOut, idfigure, wintitle="", channelList=None,
654 xmin=None, xmax=None, ymin=None, ymax=None,
661 xmin=None, xmax=None, ymin=None, ymax=None, normalize=True,
655 save=False, figpath='./', figfile=None):
662 save=False, figpath='./', figfile=None):
656
663
657 if channelList == None:
664 if channelList == None:
@@ -664,7 +671,9 class ProfilePlot(Figure):
664 raise ValueError, "Channel %d is not in dataOut.channelList"
671 raise ValueError, "Channel %d is not in dataOut.channelList"
665 channelIndexList.append(dataOut.channelList.index(channel))
672 channelIndexList.append(dataOut.channelList.index(channel))
666
673
667 factor = dataOut.normFactor
674 factor = 1
675 if normalize:
676 factor = dataOut.normFactor
668 y = dataOut.getHeiRange()
677 y = dataOut.getHeiRange()
669 x = dataOut.data_spc[channelIndexList,:,:]/factor
678 x = dataOut.data_spc[channelIndexList,:,:]/factor
670 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
679 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
@@ -954,7 +963,7 class RTIfromNoise(Figure):
954
963
955
964
956 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
965 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
957 xmin=None, xmax=None, ymin=None, ymax=None,
966 xmin=None, xmax=None, ymin=None, ymax=None, normalize=True,
958 timerange=None,
967 timerange=None,
959 save=False, figpath='./', figfile=None):
968 save=False, figpath='./', figfile=None):
960
969
@@ -975,7 +984,9 class RTIfromNoise(Figure):
975 tmax = None
984 tmax = None
976 x = dataOut.getTimeRange()
985 x = dataOut.getTimeRange()
977 y = dataOut.getHeiRange()
986 y = dataOut.getHeiRange()
978 factor = dataOut.normFactor
987 factor = 1
988 if normalize:
989 factor = dataOut.normFactor
979 noise = dataOut.getNoise()/factor
990 noise = dataOut.getNoise()/factor
980 noisedB = 10*numpy.log10(noise)
991 noisedB = 10*numpy.log10(noise)
981
992
General Comments 0
You need to be logged in to leave comments. Login now