##// END OF EJS Templates
SpectraCutPlot added to jrospectra_plot....
Miguel Valdez -
r766:c5bdf5248909
parent child
Show More
@@ -119,7 +119,8 class SpectraPlot(Figure):
119
119
120 factor = dataOut.normFactor
120 factor = dataOut.normFactor
121
121
122 x = dataOut.getVelRange(1)
122 x = dataOut.getFreqRange(1)/1000
123 # x = dataOut.getVelRange(1)
123 y = dataOut.getHeiRange()
124 y = dataOut.getHeiRange()
124
125
125 z = dataOut.data_spc/factor
126 z = dataOut.data_spc/factor
@@ -137,7 +138,7 class SpectraPlot(Figure):
137 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
138 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
138 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
139 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
139
140
140 xlabel = "Velocity (m/s)"
141 xlabel = "Frequency (KHz)"
141 ylabel = "Range (Km)"
142 ylabel = "Range (Km)"
142
143
143 if not self.isConfig:
144 if not self.isConfig:
@@ -360,24 +361,28 class CrossSpectraPlot(Figure):
360
361
361 for i in range(self.nplots):
362 for i in range(self.nplots):
362 pair = dataOut.pairsList[pairsIndexList[i]]
363 pair = dataOut.pairsList[pairsIndexList[i]]
364
365 chan_index0 = dataOut.channelList.index(pair[0])
366 chan_index1 = dataOut.channelList.index(pair[1])
367
363 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
368 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
364 title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime)
369 title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[chan_index0], str_datetime)
365 zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]/factor)
370 zdB = 10.*numpy.log10(dataOut.data_spc[chan_index0,:,:]/factor)
366 axes0 = self.axesList[i*self.__nsubplots]
371 axes0 = self.axesList[i*self.__nsubplots]
367 axes0.pcolor(x, y, zdB,
372 axes0.pcolor(x, y, zdB,
368 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
373 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
369 xlabel=xlabel, ylabel=ylabel, title=title,
374 xlabel=xlabel, ylabel=ylabel, title=title,
370 ticksize=9, colormap=power_cmap, cblabel='')
375 ticksize=9, colormap=power_cmap, cblabel='')
371
376
372 title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime)
377 title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[chan_index1], str_datetime)
373 zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor)
378 zdB = 10.*numpy.log10(dataOut.data_spc[chan_index1,:,:]/factor)
374 axes0 = self.axesList[i*self.__nsubplots+1]
379 axes0 = self.axesList[i*self.__nsubplots+1]
375 axes0.pcolor(x, y, zdB,
380 axes0.pcolor(x, y, zdB,
376 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
381 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
377 xlabel=xlabel, ylabel=ylabel, title=title,
382 xlabel=xlabel, ylabel=ylabel, title=title,
378 ticksize=9, colormap=power_cmap, cblabel='')
383 ticksize=9, colormap=power_cmap, cblabel='')
379
384
380 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
385 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[chan_index0,:,:]*dataOut.data_spc[chan_index1,:,:])
381 coherence = numpy.abs(coherenceComplex)
386 coherence = numpy.abs(coherenceComplex)
382 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
387 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
383 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
388 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
@@ -933,6 +938,125 class PowerProfilePlot(Figure):
933 wr_period=wr_period,
938 wr_period=wr_period,
934 thisDatetime=thisDatetime)
939 thisDatetime=thisDatetime)
935
940
941 class SpectraCutPlot(Figure):
942
943 isConfig = None
944 __nsubplots = None
945
946 WIDTHPROF = None
947 HEIGHTPROF = None
948 PREFIX = 'spc_cut'
949
950 def __init__(self):
951 self.isConfig = False
952 self.__nsubplots = 1
953
954 self.PLOT_CODE = POWER_CODE
955
956 self.WIDTH = 700
957 self.HEIGHT = 500
958 self.counter_imagwr = 0
959
960 def getSubplots(self):
961 ncol = 1
962 nrow = 1
963
964 return nrow, ncol
965
966 def setup(self, id, nplots, wintitle, show):
967
968 self.nplots = nplots
969
970 ncolspan = 1
971 colspan = 1
972
973 self.createFigure(id = id,
974 wintitle = wintitle,
975 widthplot = self.WIDTH,
976 heightplot = self.HEIGHT,
977 show=show)
978
979 nrow, ncol = self.getSubplots()
980
981 counter = 0
982 for y in range(nrow):
983 for x in range(ncol):
984 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
985
986 def run(self, dataOut, id, wintitle="", channelList=None,
987 xmin=None, xmax=None, ymin=None, ymax=None,
988 save=False, figpath='./', figfile=None, show=True,
989 ftp=False, wr_period=1, server=None,
990 folder=None, username=None, password=None):
991
992
993 if channelList == None:
994 channelIndexList = dataOut.channelIndexList
995 channelList = dataOut.channelList
996 else:
997 channelIndexList = []
998 for channel in channelList:
999 if channel not in dataOut.channelList:
1000 raise ValueError, "Channel %d is not in dataOut.channelList"
1001 channelIndexList.append(dataOut.channelList.index(channel))
1002
1003 factor = dataOut.normFactor
1004
1005 x = dataOut.getFreqRangeTimeResponse()/1000
1006 y = dataOut.getHeiRange()
1007
1008 z = dataOut.data_spc/factor
1009 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
1010
1011 hei_index = numpy.arange(30)*4 + 60
1012
1013 zdB = 10*numpy.log10(z[0,:,hei_index])
1014 # zdB = numpy.swapaxes(zdB, 0, 1)
1015
1016
1017 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
1018 title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y"))
1019 xlabel = "Frequency (KHz)"
1020 ylabel = "Power (dB)"
1021
1022 if not self.isConfig:
1023
1024 nplots = 1
1025
1026 self.setup(id=id,
1027 nplots=nplots,
1028 wintitle=wintitle,
1029 show=show)
1030
1031 if xmin == None: xmin = numpy.nanmin(x)*0.9
1032 if xmax == None: xmax = numpy.nanmax(x)*1.1
1033 if ymin == None: ymin = numpy.nanmin(zdB)
1034 if ymax == None: ymax = numpy.nanmax(zdB)
1035
1036 self.isConfig = True
1037
1038 self.setWinTitle(title)
1039
1040 title = "Spectra Cuts: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1041 axes = self.axesList[0]
1042
1043 legendlabels = ["Range = %dKm" %y[i] for i in hei_index]
1044
1045 axes.pmultilineyaxis( x, zdB,
1046 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1047 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
1048 ytick_visible=True, nxticks=5,
1049 grid='x')
1050
1051 self.draw()
1052
1053 self.save(figpath=figpath,
1054 figfile=figfile,
1055 save=save,
1056 ftp=ftp,
1057 wr_period=wr_period,
1058 thisDatetime=thisDatetime)
1059
936 class Noise(Figure):
1060 class Noise(Figure):
937
1061
938 isConfig = None
1062 isConfig = None
General Comments 0
You need to be logged in to leave comments. Login now