##// END OF EJS Templates
-Bug fixed: selecting channels and cross pairs...
Miguel Valdez -
r612:d0a641be5ae3
parent child
Show More
@@ -424,7 +424,7 class WindProfilerPlot(Figure):
424 424 raise ValueError, "Channel %d is not in dataOut.channelList"
425 425 channelIndexList.append(dataOut.channelList.index(channel))
426 426
427 # if timerange != None:
427 # if timerange is not None:
428 428 # self.timerange = timerange
429 429 #
430 430 # tmin = None
@@ -439,7 +439,7 class WindProfilerPlot(Figure):
439 439 nplotsw = nplots
440 440
441 441 #If there is a SNR function defined
442 if dataOut.data_SNR != None:
442 if dataOut.data_SNR is not None:
443 443 nplots += 1
444 444 SNR = dataOut.data_SNR
445 445 SNRavg = numpy.average(SNR, axis=0)
@@ -469,7 +469,7 class WindProfilerPlot(Figure):
469 469 showprofile=showprofile,
470 470 show=show)
471 471
472 if timerange != None:
472 if timerange is not None:
473 473 self.timerange = timerange
474 474
475 475 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
@@ -485,7 +485,7 class WindProfilerPlot(Figure):
485 485 if zmax_ver == None: zmax_ver = numpy.nanmax(abs(z[2,:]))
486 486 if zmin_ver == None: zmin_ver = -zmax_ver
487 487
488 if dataOut.data_SNR != None:
488 if dataOut.data_SNR is not None:
489 489 if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB)
490 490 if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB)
491 491
@@ -522,7 +522,7 class WindProfilerPlot(Figure):
522 522 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
523 523 ticksize=9, cblabel=strCb[i], cbsize="1%", colormap="RdBu_r" )
524 524
525 if dataOut.data_SNR != None:
525 if dataOut.data_SNR is not None:
526 526 i += 1
527 527 title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
528 528 axes = self.axesList[i*self.__nsubplots]
@@ -672,7 +672,7 class ParametersPlot(Figure):
672 672
673 673 nplots = nGraphsByChannel*nchan
674 674
675 if timerange != None:
675 if timerange is not None:
676 676 self.timerange = timerange
677 677
678 678 #tmin = None
@@ -688,7 +688,7 class ParametersPlot(Figure):
688 688 # nChannels = z.shape[0] #Number of wind dimensions estimated
689 689 # thisDatetime = dataOut.datatime
690 690
691 if dataOut.data_SNR != None:
691 if dataOut.data_SNR is not None:
692 692 SNRarray = dataOut.data_SNR[channelIndexList,:]
693 693 SNRdB = 10*numpy.log10(SNRarray)
694 694 # SNRavgdB = 10*numpy.log10(SNRavg)
@@ -1067,7 +1067,7 class EWDriftsPlot(Figure):
1067 1067 zmax : None
1068 1068 """
1069 1069
1070 if timerange != None:
1070 if timerange is not None:
1071 1071 self.timerange = timerange
1072 1072
1073 1073 tmin = None
@@ -1082,7 +1082,7 class EWDriftsPlot(Figure):
1082 1082 nplotsw = nplots
1083 1083
1084 1084 #If there is a SNR function defined
1085 if dataOut.data_SNR != None:
1085 if dataOut.data_SNR is not None:
1086 1086 nplots += 1
1087 1087 SNR = dataOut.data_SNR
1088 1088
@@ -1125,7 +1125,7 class EWDriftsPlot(Figure):
1125 1125 if zmaxVertical == None: zmaxVertical = numpy.nanmax(abs(z[1,:]))
1126 1126 if zminVertical == None: zminVertical = -zmaxVertical
1127 1127
1128 if dataOut.data_SNR != None:
1128 if dataOut.data_SNR is not None:
1129 1129 if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB)
1130 1130 if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB)
1131 1131
@@ -1160,7 +1160,7 class EWDriftsPlot(Figure):
1160 1160 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
1161 1161 ticksize=9, cblabel=strCb, cbsize="1%", colormap="RdBu_r")
1162 1162
1163 if dataOut.data_SNR != None:
1163 if dataOut.data_SNR is not None:
1164 1164 i += 1
1165 1165 if SNR_1:
1166 1166 title = "Signal Noise Ratio + 1 (SNR+1): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
@@ -1278,7 +1278,7 class PhasePlot(Figure):
1278 1278 showprofile=showprofile,
1279 1279 show=show)
1280 1280
1281 if timerange != None:
1281 if timerange is not None:
1282 1282 self.timerange = timerange
1283 1283
1284 1284 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
@@ -332,7 +332,7 class SpectraReader(JRODataReader, ProcessingUnit):
332 332
333 333 self.dataOut.flagDeflipData = False #asumo q la data esta sin flip
334 334
335 if self.radarControllerHeaderObj.code != None:
335 if self.radarControllerHeaderObj.code is not None:
336 336
337 337 # self.dataOut.nCode = self.radarControllerHeaderObj.nCode
338 338 #
@@ -377,7 +377,7 class SpectraReader(JRODataReader, ProcessingUnit):
377 377
378 378 #data es un numpy array de 3 dmensiones (perfiles, alturas y canales)
379 379
380 if self.data_dc == None:
380 if self.data_dc is None:
381 381 self.dataOut.flagNoData = True
382 382 return 0
383 383
@@ -525,7 +525,7 class SpectraWriter(JRODataWriter, Operation):
525 525 data = data.astype(self.dtype[0])
526 526 data.tofile(self.fp)
527 527
528 if self.data_cspc != None:
528 if self.data_cspc is not None:
529 529 data = numpy.zeros( self.shape_cspc_Buffer, self.dtype )
530 530 cspc = numpy.transpose( self.data_cspc, (0,2,1) )
531 531 if not( self.processingHeaderObj.shif_fft ):
@@ -535,7 +535,7 class SpectraWriter(JRODataWriter, Operation):
535 535 data = data.reshape((-1))
536 536 data.tofile(self.fp)
537 537
538 if self.data_dc != None:
538 if self.data_dc is not None:
539 539 data = numpy.zeros( self.shape_dc_Buffer, self.dtype )
540 540 dc = self.data_dc
541 541 data['real'] = dc.real
@@ -545,10 +545,10 class SpectraWriter(JRODataWriter, Operation):
545 545
546 546 self.data_spc.fill(0)
547 547
548 if self.data_dc != None:
548 if self.data_dc is not None:
549 549 self.data_dc.fill(0)
550 550
551 if self.data_cspc != None:
551 if self.data_cspc is not None:
552 552 self.data_cspc.fill(0)
553 553
554 554 self.flagIsNewFile = 0
@@ -588,7 +588,7 class SpectraWriter(JRODataWriter, Operation):
588 588 self.setBasicHeader()
589 589
590 590 self.data_spc = self.dataOut.data_spc.copy()
591 if self.dataOut.data_cspc != None:
591 if self.dataOut.data_cspc is not None:
592 592 self.data_cspc = self.dataOut.data_cspc.copy()
593 593 self.data_dc = self.dataOut.data_dc.copy()
594 594
@@ -636,13 +636,13 class SpectraWriter(JRODataWriter, Operation):
636 636 if self.dataOut.flagDeflipData:
637 637 processFlags += PROCFLAG.DEFLIP_DATA
638 638
639 if self.dataOut.code != None:
639 if self.dataOut.code is not None:
640 640 processFlags += PROCFLAG.DEFINE_PROCESS_CODE
641 641
642 642 if self.dataOut.nIncohInt > 1:
643 643 processFlags += PROCFLAG.INCOHERENT_INTEGRATION
644 644
645 if self.dataOut.data_dc != None:
645 if self.dataOut.data_dc is not None:
646 646 processFlags += PROCFLAG.SAVE_CHANNELS_DC
647 647
648 648 return processFlags
@@ -673,11 +673,11 class SpectraWriter(JRODataWriter, Operation):
673 673 pts2write_SelfSpectra = int(self.dataOut.nChannels * pts2write)
674 674 blocksize = (pts2write_SelfSpectra*datatypeValue)
675 675
676 if self.dataOut.data_cspc != None:
676 if self.dataOut.data_cspc is not None:
677 677 pts2write_CrossSpectra = int(self.dataOut.nPairs * pts2write)
678 678 blocksize += (pts2write_CrossSpectra*datatypeValue*2)
679 679
680 if self.dataOut.data_dc != None:
680 if self.dataOut.data_dc is not None:
681 681 pts2write_DCchannels = int(self.dataOut.nChannels * self.dataOut.nHeights)
682 682 blocksize += (pts2write_DCchannels*datatypeValue*2)
683 683
@@ -739,7 +739,7 class SpectraWriter(JRODataWriter, Operation):
739 739 processingHeaderSize += sizeOfSpcComb
740 740
741 741 # The processing header should not have information about code
742 # if self.dataOut.code != None:
742 # if self.dataOut.code is not None:
743 743 # self.processingHeaderObj.code = self.dataOut.code
744 744 # self.processingHeaderObj.nCode = self.dataOut.nCode
745 745 # self.processingHeaderObj.nBaud = self.dataOut.nBaud
@@ -249,7 +249,7 class VoltageReader(JRODataReader, ProcessingUnit):
249 249
250 250 # self.dataOut.timeInterval = self.radarControllerHeaderObj.ippSeconds * self.processingHeaderObj.nCohInt
251 251 #
252 # if self.radarControllerHeaderObj.code != None:
252 # if self.radarControllerHeaderObj.code is not None:
253 253 #
254 254 # self.dataOut.nCode = self.radarControllerHeaderObj.nCode
255 255 #
@@ -572,7 +572,7 class VoltageWriter(JRODataWriter, Operation):
572 572 if self.dataOut.flagDeflipData:
573 573 processFlags += PROCFLAG.DEFLIP_DATA
574 574
575 if self.dataOut.code != None:
575 if self.dataOut.code is not None:
576 576 processFlags += PROCFLAG.DEFINE_PROCESS_CODE
577 577
578 578 if self.dataOut.nCohInt > 1:
@@ -635,7 +635,7 class VoltageWriter(JRODataWriter, Operation):
635 635 self.processingHeaderObj.nIncohInt = 1 # Cuando la data de origen es de tipo Voltage
636 636 self.processingHeaderObj.totalSpectra = 0 # Cuando la data de origen es de tipo Voltage
637 637
638 # if self.dataOut.code != None:
638 # if self.dataOut.code is not None:
639 639 # self.processingHeaderObj.code = self.dataOut.code
640 640 # self.processingHeaderObj.nCode = self.dataOut.nCode
641 641 # self.processingHeaderObj.nBaud = self.dataOut.nBaud
@@ -195,8 +195,8 class SpectraProc(ProcessingUnit):
195 195 return
196 196
197 197 self.dataOut.data_cspc = self.dataOut.data_cspc[pairsIndexListSelected]
198 self.dataOut.pairsList = self.dataOut.pairsList[pairsIndexListSelected]
199
198 self.dataOut.pairsList = [self.dataOut.pairsList[i] for i in pairsIndexListSelected]
199
200 200 return
201 201
202 202 def selectChannels(self, channelList):
@@ -316,12 +316,12 class SpectraProc(ProcessingUnit):
316 316
317 317 #data_spc = data_spc[:,:,beacon_heiIndexList]
318 318 data_cspc = None
319 if self.dataOut.data_cspc != None:
319 if self.dataOut.data_cspc is not None:
320 320 data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1]
321 321 #data_cspc = data_cspc[:,:,beacon_heiIndexList]
322 322
323 323 data_dc = None
324 if self.dataOut.data_dc != None:
324 if self.dataOut.data_dc is not None:
325 325 data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1]
326 326 #data_dc = data_dc[:,beacon_heiIndexList]
327 327
@@ -366,11 +366,11 class SpectraProc(ProcessingUnit):
366 366 data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1]
367 367
368 368 data_cspc = None
369 if self.dataOut.data_cspc != None:
369 if self.dataOut.data_cspc is not None:
370 370 data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1]
371 371
372 372 data_dc = None
373 if self.dataOut.data_dc != None:
373 if self.dataOut.data_dc is not None:
374 374 data_dc = self.dataOut.data_dc[:,minIndex:maxIndex+1]
375 375
376 376 self.dataOut.data_spc = data_spc
@@ -389,7 +389,7 class SpectraProc(ProcessingUnit):
389 389 num_chan = jspectra.shape[0]
390 390 num_hei = jspectra.shape[2]
391 391
392 if jcspectra != None:
392 if jcspectra is not None:
393 393 jcspectraExist = True
394 394 num_pairs = jcspectra.shape[0]
395 395 else: jcspectraExist = False
@@ -450,7 +450,7 class SpectraProc(ProcessingUnit):
450 450 num_hei = jspectra.shape[2]
451 451
452 452 #hei_interf
453 if hei_interf == None:
453 if hei_interf is None:
454 454 count_hei = num_hei/2 #Como es entero no importa
455 455 hei_interf = numpy.asmatrix(range(count_hei)) + num_hei - count_hei
456 456 hei_interf = numpy.asarray(hei_interf)[0]
@@ -552,7 +552,7 class SpectraProc(ProcessingUnit):
552 552 jspectra[ich,indAux[0],indAux[1]] = tmp_noise * (1 - 1/math.sqrt(num_incoh))
553 553
554 554 #Remocion de Interferencia en el Cross Spectra
555 if jcspectra == None: return jspectra, jcspectra
555 if jcspectra is None: return jspectra, jcspectra
556 556 num_pairs = jcspectra.size/(num_prof*num_hei)
557 557 jcspectra = jcspectra.reshape(num_pairs, num_prof, num_hei)
558 558
@@ -792,9 +792,9 class IncohInt(Operation):
792 792 #Overlapping data
793 793 nChannels, nFFTPoints, nHeis = data_spc.shape
794 794 data_spc = numpy.reshape(data_spc, (1, nChannels, nFFTPoints, nHeis))
795 if data_cspc != None:
795 if data_cspc is not None:
796 796 data_cspc = numpy.reshape(data_cspc, (1, -1, nFFTPoints, nHeis))
797 if data_dc != None:
797 if data_dc is not None:
798 798 data_dc = numpy.reshape(data_dc, (1, -1, nHeis))
799 799
800 800 #If the buffer is empty then it takes the data value
@@ -818,10 +818,10 class IncohInt(Operation):
818 818 if self.__profIndex < self.n:
819 819 self.__buffer_spc = numpy.vstack((self.__buffer_spc, data_spc))
820 820
821 if data_cspc != None:
821 if data_cspc is not None:
822 822 self.__buffer_cspc = numpy.vstack((self.__buffer_cspc, data_cspc))
823 823
824 if data_dc != None:
824 if data_dc is not None:
825 825 self.__buffer_dc = numpy.vstack((self.__buffer_dc, data_dc))
826 826
827 827 self.__profIndex += 1
@@ -831,11 +831,11 class IncohInt(Operation):
831 831 self.__buffer_spc = numpy.roll(self.__buffer_spc, -1, axis=0)
832 832 self.__buffer_spc[self.n-1] = data_spc
833 833
834 if data_cspc != None:
834 if data_cspc is not None:
835 835 self.__buffer_cspc = numpy.roll(self.__buffer_cspc, -1, axis=0)
836 836 self.__buffer_cspc[self.n-1] = data_cspc
837 837
838 if data_dc != None:
838 if data_dc is not None:
839 839 self.__buffer_dc = numpy.roll(self.__buffer_dc, -1, axis=0)
840 840 self.__buffer_dc[self.n-1] = data_dc
841 841
@@ -873,10 +873,10 class IncohInt(Operation):
873 873 #Integration with Overlapping
874 874 data_spc = numpy.sum(self.__buffer_spc, axis=0)
875 875
876 if self.__buffer_cspc != None:
876 if self.__buffer_cspc is not None:
877 877 data_cspc = numpy.sum(self.__buffer_cspc, axis=0)
878 878
879 if self.__buffer_dc != None:
879 if self.__buffer_dc is not None:
880 880 data_dc = numpy.sum(self.__buffer_dc, axis=0)
881 881
882 882 n = self.__profIndex
@@ -7,7 +7,7 Created on Jul 16, 2014
7 7 from distutils.core import setup, Extension
8 8
9 9 setup(name="schainpy",
10 version="2.0",
10 version="2.1.0",
11 11 description="Python tools to read, write and process Jicamarca data",
12 12 author="Miguel Urco",
13 13 author_email="miguel.urco@jro.igp.gob.pe",
General Comments 0
You need to be logged in to leave comments. Login now