##// END OF EJS Templates
Bugs fixed selecting channels in jroplot_spectra.py
Miguel Valdez -
r731:32d522b0021b
parent child
Show More
@@ -24,7 +24,7 class SpectraPlot(Figure):
24 24 self.isConfig = False
25 25 self.__nsubplots = 1
26 26
27 self.WIDTH = 280
27 self.WIDTH = 250
28 28 self.HEIGHT = 250
29 29 self.WIDTHPROF = 120
30 30 self.HEIGHTPROF = 0
@@ -114,7 +114,7 class SpectraPlot(Figure):
114 114 channelIndexList = []
115 115 for channel in channelList:
116 116 if channel not in dataOut.channelList:
117 raise ValueError, "Channel %d is not in dataOut.channelList"
117 raise ValueError, "Channel %d is not in dataOut.channelList" %channel
118 118 channelIndexList.append(dataOut.channelList.index(channel))
119 119
120 120 factor = dataOut.normFactor
@@ -122,7 +122,7 class SpectraPlot(Figure):
122 122 x = dataOut.getVelRange(1)
123 123 y = dataOut.getHeiRange()
124 124
125 z = dataOut.data_spc[channelIndexList,:,:]/factor
125 z = dataOut.data_spc/factor
126 126 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
127 127 zdB = 10*numpy.log10(z)
128 128
@@ -167,26 +167,27 class SpectraPlot(Figure):
167 167 self.setWinTitle(title)
168 168
169 169 for i in range(self.nplots):
170 index = channelIndexList[i]
170 171 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
171 title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i], noisedB[i], str_datetime)
172 title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime)
172 173 if len(dataOut.beam.codeList) != 0:
173 title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[i]+1, noisedB[i], dataOut.beam.azimuthList[i], dataOut.beam.zenithList[i], str_datetime)
174 title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime)
174 175
175 176 axes = self.axesList[i*self.__nsubplots]
176 axes.pcolor(x, y, zdB[i,:,:],
177 axes.pcolor(x, y, zdB[index,:,:],
177 178 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
178 179 xlabel=xlabel, ylabel=ylabel, title=title,
179 180 ticksize=9, cblabel='')
180 181
181 182 if self.__showprofile:
182 183 axes = self.axesList[i*self.__nsubplots +1]
183 axes.pline(avgdB[i,:], y,
184 axes.pline(avgdB[index,:], y,
184 185 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
185 186 xlabel='dB', ylabel='', title='',
186 187 ytick_visible=False,
187 188 grid='x')
188 189
189 noiseline = numpy.repeat(noisedB[i], len(y))
190 noiseline = numpy.repeat(noisedB[index], len(y))
190 191 axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2)
191 192
192 193 self.draw()
@@ -423,7 +424,7 class RTIPlot(Figure):
423 424 self.__nsubplots = 1
424 425
425 426 self.WIDTH = 800
426 self.HEIGHT = 150
427 self.HEIGHT = 180
427 428 self.WIDTHPROF = 120
428 429 self.HEIGHTPROF = 0
429 430 self.counter_imagwr = 0
@@ -524,7 +525,7 class RTIPlot(Figure):
524 525 x = dataOut.getTimeRange()
525 526 y = dataOut.getHeiRange()
526 527
527 z = dataOut.data_spc[channelIndexList,:,:]/factor
528 z = dataOut.data_spc/factor
528 529 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
529 530 avg = numpy.average(z, axis=1)
530 531
@@ -575,11 +576,12 class RTIPlot(Figure):
575 576 x[1] = self.xmax
576 577
577 578 for i in range(self.nplots):
578 title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
579 index = channelIndexList[i]
580 title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
579 581 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
580 582 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
581 583 axes = self.axesList[i*self.__nsubplots]
582 zdB = avgdB[i].reshape((1,-1))
584 zdB = avgdB[index].reshape((1,-1))
583 585 axes.pcolorbuffer(x, y, zdB,
584 586 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
585 587 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
@@ -587,7 +589,7 class RTIPlot(Figure):
587 589
588 590 if self.__showprofile:
589 591 axes = self.axesList[i*self.__nsubplots +1]
590 axes.pline(avgdB[i], y,
592 axes.pline(avgdB[index], y,
591 593 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
592 594 xlabel='dB', ylabel='', title='',
593 595 ytick_visible=False,
@@ -622,7 +624,7 class CoherenceMap(Figure):
622 624 self.__nsubplots = 1
623 625
624 626 self.WIDTH = 800
625 self.HEIGHT = 150
627 self.HEIGHT = 180
626 628 self.WIDTHPROF = 120
627 629 self.HEIGHTPROF = 0
628 630 self.counter_imagwr = 0
@@ -673,7 +675,7 class CoherenceMap(Figure):
673 675
674 676 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
675 677 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
676 timerange=None,
678 timerange=None, phase_min=None, phase_max=None,
677 679 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
678 680 coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
679 681 server=None, folder=None, username=None, password=None,
@@ -693,6 +695,11 class CoherenceMap(Figure):
693 695
694 696 if len(pairsIndexList) > 4:
695 697 pairsIndexList = pairsIndexList[0:4]
698
699 if phase_min == None:
700 phase_min = -180
701 if phase_max == None:
702 phase_max = 180
696 703
697 704 # tmin = None
698 705 # tmax = None
@@ -778,7 +785,7 class CoherenceMap(Figure):
778 785 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
779 786 axes = self.axesList[i*self.__nsubplots*2 + counter]
780 787 axes.pcolorbuffer(x, y, z,
781 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
788 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
782 789 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
783 790 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
784 791
@@ -786,7 +793,7 class CoherenceMap(Figure):
786 793 counter += 1
787 794 axes = self.axesList[i*self.__nsubplots*2 + counter]
788 795 axes.pline(phase, y,
789 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
796 xmin=phase_min, xmax=phase_max, ymin=ymin, ymax=ymax,
790 797 xlabel='', ylabel='', title='', ticksize=7,
791 798 ytick_visible=False, nxticks=4,
792 799 grid='x')
@@ -1039,7 +1046,7 class Noise(Figure):
1039 1046 x = dataOut.getTimeRange()
1040 1047 #y = dataOut.getHeiRange()
1041 1048 factor = dataOut.normFactor
1042 noise = dataOut.noise/factor
1049 noise = dataOut.noise[channelIndexList]/factor
1043 1050 noisedB = 10*numpy.log10(noise)
1044 1051
1045 1052 #thisDatetime = dataOut.datatime
@@ -1094,9 +1101,9 class Noise(Figure):
1094 1101 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1095 1102
1096 1103 if len(self.ydata)==0:
1097 self.ydata = noisedB[channelIndexList].reshape(-1,1)
1104 self.ydata = noisedB.reshape(-1,1)
1098 1105 else:
1099 self.ydata = numpy.hstack((self.ydata, noisedB[channelIndexList].reshape(-1,1)))
1106 self.ydata = numpy.hstack((self.ydata, noisedB.reshape(-1,1)))
1100 1107
1101 1108
1102 1109 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
General Comments 0
You need to be logged in to leave comments. Login now