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