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