##// END OF EJS Templates
Bugs Fixed
Daniel Valdez -
r392:5ce42ab4da33
parent child
Show More
@@ -376,56 +376,56 class ProcessingHeader(Header):
376 self.flag_cspc = False
376 self.flag_cspc = False
377
377
378 def read(self, fp):
378 def read(self, fp):
379 try:
379 # try:
380 header = numpy.fromfile(fp,self.struct,1)
380 header = numpy.fromfile(fp,self.struct,1)
381 self.size = int(header['nSize'][0])
381 self.size = int(header['nSize'][0])
382 self.dtype = int(header['nDataType'][0])
382 self.dtype = int(header['nDataType'][0])
383 self.blockSize = int(header['nSizeOfDataBlock'][0])
383 self.blockSize = int(header['nSizeOfDataBlock'][0])
384 self.profilesPerBlock = int(header['nProfilesperBlock'][0])
384 self.profilesPerBlock = int(header['nProfilesperBlock'][0])
385 self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0])
385 self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0])
386 self.nWindows = int(header['nNumWindows'][0])
386 self.nWindows = int(header['nNumWindows'][0])
387 self.processFlags = header['nProcessFlags']
387 self.processFlags = header['nProcessFlags']
388 self.nCohInt = int(header['nCoherentIntegrations'][0])
388 self.nCohInt = int(header['nCoherentIntegrations'][0])
389 self.nIncohInt = int(header['nIncoherentIntegrations'][0])
389 self.nIncohInt = int(header['nIncoherentIntegrations'][0])
390 self.totalSpectra = int(header['nTotalSpectra'][0])
390 self.totalSpectra = int(header['nTotalSpectra'][0])
391 self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows)
391 self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows)
392 self.nHeights = int(numpy.sum(self.samplingWindow['nsa']))
392 self.nHeights = int(numpy.sum(self.samplingWindow['nsa']))
393 self.firstHeight = float(self.samplingWindow['h0'][0])
393 self.firstHeight = float(self.samplingWindow['h0'][0])
394 self.deltaHeight = float(self.samplingWindow['dh'][0])
394 self.deltaHeight = float(self.samplingWindow['dh'][0])
395 self.samplesWin = self.samplingWindow['nsa']
395 self.samplesWin = self.samplingWindow['nsa']
396 self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra)
396 self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra)
397
397
398 if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE):
398 # if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE):
399 self.nCode = int(numpy.fromfile(fp,'<u4',1))
399 # self.nCode = int(numpy.fromfile(fp,'<u4',1))
400 self.nBaud = int(numpy.fromfile(fp,'<u4',1))
400 # self.nBaud = int(numpy.fromfile(fp,'<u4',1))
401 self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nCode,self.nBaud)
401 # self.code = numpy.fromfile(fp,'<f4',self.nCode*self.nBaud).reshape(self.nCode,self.nBaud)
402
403 if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA):
404 self.shif_fft = True
405 else:
406 self.shif_fft = False
402
407
403 if ((self.processFlags & PROCFLAG.SHIFT_FFT_DATA) == PROCFLAG.SHIFT_FFT_DATA):
408 if ((self.processFlags & PROCFLAG.SAVE_CHANNELS_DC) == PROCFLAG.SAVE_CHANNELS_DC):
404 self.shif_fft = True
409 self.flag_dc = True
410
411 nChannels = 0
412 nPairs = 0
413 pairList = []
414
415 for i in range( 0, self.totalSpectra*2, 2 ):
416 if self.spectraComb[i] == self.spectraComb[i+1]:
417 nChannels = nChannels + 1 #par de canales iguales
405 else:
418 else:
406 self.shif_fft = False
419 nPairs = nPairs + 1 #par de canales diferentes
407
420 pairList.append( (self.spectraComb[i], self.spectraComb[i+1]) )
408 if ((self.processFlags & PROCFLAG.SAVE_CHANNELS_DC) == PROCFLAG.SAVE_CHANNELS_DC):
421
409 self.flag_dc = True
422 self.flag_cspc = False
410
423 if nPairs > 0:
411 nChannels = 0
424 self.flag_cspc = True
412 nPairs = 0
413 pairList = []
414
415 for i in range( 0, self.totalSpectra*2, 2 ):
416 if self.spectraComb[i] == self.spectraComb[i+1]:
417 nChannels = nChannels + 1 #par de canales iguales
418 else:
419 nPairs = nPairs + 1 #par de canales diferentes
420 pairList.append( (self.spectraComb[i], self.spectraComb[i+1]) )
421
422 self.flag_cspc = False
423 if nPairs > 0:
424 self.flag_cspc = True
425
425
426 except Exception, e:
426 # except Exception, e:
427 print "ProcessingHeader: " + e
427 # print "Error ProcessingHeader: "
428 return 0
428 # return 0
429
429
430 return 1
430 return 1
431
431
@@ -107,8 +107,9 class CrossSpectraPlot(Figure):
107 noisedB = 10*numpy.log10(noise)
107 noisedB = 10*numpy.log10(noise)
108
108
109
109
110 thisDatetime = dataOut.datatime
110 #thisDatetime = dataOut.datatime
111 title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
111 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
112 title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
112 xlabel = "Velocity (m/s)"
113 xlabel = "Velocity (m/s)"
113 ylabel = "Range (Km)"
114 ylabel = "Range (Km)"
114
115
@@ -293,7 +294,7 class RTIPlot(Figure):
293
294
294 # thisDatetime = dataOut.datatime
295 # thisDatetime = dataOut.datatime
295 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
296 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
296 title = wintitle+' ' + "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
297 title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
297 xlabel = ""
298 xlabel = ""
298 ylabel = "Range (Km)"
299 ylabel = "Range (Km)"
299
300
@@ -455,8 +456,9 class SpectraPlot(Figure):
455 avgdB = 10*numpy.log10(avg)
456 avgdB = 10*numpy.log10(avg)
456 noisedB = 10*numpy.log10(noise)
457 noisedB = 10*numpy.log10(noise)
457
458
458 thisDatetime = dataOut.datatime
459 #thisDatetime = dataOut.datatime
459 title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
460 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
461 title = wintitle + " Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
460 xlabel = "Velocity (m/s)"
462 xlabel = "Velocity (m/s)"
461 ylabel = "Range (Km)"
463 ylabel = "Range (Km)"
462
464
@@ -572,8 +574,9 class Scope(Figure):
572 y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
574 y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
573 y = y.real
575 y = y.real
574
576
575 thisDatetime = dataOut.datatime
577 #thisDatetime = dataOut.datatime
576 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
578 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
579 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
577 xlabel = "Range (Km)"
580 xlabel = "Range (Km)"
578 ylabel = "Intensity"
581 ylabel = "Intensity"
579
582
@@ -674,8 +677,9 class PowerProfilePlot(Figure):
674
677
675 avgdB = 10*numpy.log10(avg)
678 avgdB = 10*numpy.log10(avg)
676
679
677 thisDatetime = dataOut.datatime
680 #thisDatetime = dataOut.datatime
678 title = "Power Profile"
681 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
682 title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y"))
679 xlabel = "dB"
683 xlabel = "dB"
680 ylabel = "Range (Km)"
684 ylabel = "Range (Km)"
681
685
@@ -798,8 +802,9 class CoherenceMap(Figure):
798 x = dataOut.getTimeRange()
802 x = dataOut.getTimeRange()
799 y = dataOut.getHeiRange()
803 y = dataOut.getHeiRange()
800
804
801 thisDatetime = dataOut.datatime
805 #thisDatetime = dataOut.datatime
802 title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
806 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
807 title = wintitle + " CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
803 xlabel = ""
808 xlabel = ""
804 ylabel = "Range (Km)"
809 ylabel = "Range (Km)"
805
810
@@ -963,8 +968,9 class RTIfromNoise(Figure):
963 noise = dataOut.getNoise()/factor
968 noise = dataOut.getNoise()/factor
964 noisedB = 10*numpy.log10(noise)
969 noisedB = 10*numpy.log10(noise)
965
970
966 thisDatetime = dataOut.datatime
971 #thisDatetime = dataOut.datatime
967 title = "RTI Noise: %s" %(thisDatetime.strftime("%d-%b-%Y"))
972 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
973 title = wintitle + " RTI Noise: %s" %(thisDatetime.strftime("%d-%b-%Y"))
968 xlabel = ""
974 xlabel = ""
969 ylabel = "Range (Km)"
975 ylabel = "Range (Km)"
970
976
@@ -1156,8 +1162,9 class SpectraHeisScope(Figure):
1156 datadB = 10.*numpy.log10(dataOut.data_spc)
1162 datadB = 10.*numpy.log10(dataOut.data_spc)
1157 y = datadB
1163 y = datadB
1158
1164
1159 thisDatetime = dataOut.datatime
1165 #thisDatetime = dataOut.datatime
1160 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1166 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1167 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1161 xlabel = "Frequency x 10000"
1168 xlabel = "Frequency x 10000"
1162 ylabel = "Intensity (dB)"
1169 ylabel = "Intensity (dB)"
1163
1170
@@ -1283,8 +1290,9 class RTIfromSpectraHeis(Figure):
1283 # noise = dataOut.getNoise()/factor
1290 # noise = dataOut.getNoise()/factor
1284 # noisedB = 10*numpy.log10(noise)
1291 # noisedB = 10*numpy.log10(noise)
1285
1292
1286 thisDatetime = dataOut.datatime
1293 #thisDatetime = dataOut.datatime
1287 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
1294 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1295 title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
1288 xlabel = "Local Time"
1296 xlabel = "Local Time"
1289 ylabel = "Intensity (dB)"
1297 ylabel = "Intensity (dB)"
1290
1298
@@ -273,7 +273,7 class VoltageProc(ProcessingUnit):
273
273
274 return 1
274 return 1
275
275
276 def selectHeights(self, minHei, maxHei):
276 def selectHeights(self, minHei=None, maxHei=None):
277 """
277 """
278 Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango
278 Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango
279 minHei <= height <= maxHei
279 minHei <= height <= maxHei
@@ -288,9 +288,17 class VoltageProc(ProcessingUnit):
288 Return:
288 Return:
289 1 si el metodo se ejecuto con exito caso contrario devuelve 0
289 1 si el metodo se ejecuto con exito caso contrario devuelve 0
290 """
290 """
291
292 if minHei == None:
293 minHei = self.dataOut.heightList[0]
294
295 if maxHei == None:
296 maxHei = self.dataOut.heightList[-1]
297
291 if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei):
298 if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei):
292 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
299 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
293
300
301
294 if (maxHei > self.dataOut.heightList[-1]):
302 if (maxHei > self.dataOut.heightList[-1]):
295 maxHei = self.dataOut.heightList[-1]
303 maxHei = self.dataOut.heightList[-1]
296 # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
304 # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
@@ -358,7 +366,7 class VoltageProc(ProcessingUnit):
358 deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0]
366 deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0]
359
367
360 if window == None:
368 if window == None:
361 window = self.dataOut.radarControllerHeaderObj.txA / deltaHeight
369 window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight
362
370
363 newdelta = deltaHeight * window
371 newdelta = deltaHeight * window
364 r = self.dataOut.data.shape[1] % window
372 r = self.dataOut.data.shape[1] % window
@@ -366,7 +374,7 class VoltageProc(ProcessingUnit):
366 buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window)
374 buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window)
367 buffer = numpy.sum(buffer,2)
375 buffer = numpy.sum(buffer,2)
368 self.dataOut.data = buffer
376 self.dataOut.data = buffer
369 self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window,newdelta)
377 self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*(self.dataOut.nHeights-r)/window,newdelta)
370 self.dataOut.windowOfFilter = window
378 self.dataOut.windowOfFilter = window
371
379
372 def deFlip(self):
380 def deFlip(self):
General Comments 0
You need to be logged in to leave comments. Login now