##// END OF EJS Templates
actualizacion para calculo de fase
Daniel Valdez -
r281:8db752314ca7
parent child
Show More
@@ -54,7 +54,8 class CrossSpectraPlot(Figure):
54
54
55 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
55 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
56 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
56 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
57 save=False, figpath='./', figfile=None):
57 save=False, figpath='./', figfile=None,
58 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r'):
58
59
59 """
60 """
60
61
@@ -90,8 +91,8 class CrossSpectraPlot(Figure):
90 x = dataOut.getVelRange(1)
91 x = dataOut.getVelRange(1)
91 y = dataOut.getHeiRange()
92 y = dataOut.getHeiRange()
92 z = dataOut.data_spc[:,:,:]/factor
93 z = dataOut.data_spc[:,:,:]/factor
93 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
94 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
94 avg = numpy.average(numpy.abs(z), axis=1)
95 avg = numpy.abs(numpy.average(z, axis=1))
95 noise = dataOut.getNoise()/factor
96 noise = dataOut.getNoise()/factor
96
97
97 zdB = 10*numpy.log10(z)
98 zdB = 10*numpy.log10(z)
@@ -133,7 +134,7 class CrossSpectraPlot(Figure):
133 axes0.pcolor(x, y, zdB,
134 axes0.pcolor(x, y, zdB,
134 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
135 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
135 xlabel=xlabel, ylabel=ylabel, title=title,
136 xlabel=xlabel, ylabel=ylabel, title=title,
136 ticksize=9, cblabel='')
137 ticksize=9, colormap=power_cmap, cblabel='')
137
138
138 title = "Channel %d: %4.2fdB" %(pair[1], noisedB[pair[1]])
139 title = "Channel %d: %4.2fdB" %(pair[1], noisedB[pair[1]])
139 zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor)
140 zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor)
@@ -141,26 +142,26 class CrossSpectraPlot(Figure):
141 axes0.pcolor(x, y, zdB,
142 axes0.pcolor(x, y, zdB,
142 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
143 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
143 xlabel=xlabel, ylabel=ylabel, title=title,
144 xlabel=xlabel, ylabel=ylabel, title=title,
144 ticksize=9, cblabel='')
145 ticksize=9, colormap=power_cmap, cblabel='')
145
146
146 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
147 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
147 coherence = numpy.abs(coherenceComplex)
148 coherence = numpy.abs(coherenceComplex)
148 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
149 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
149
150 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
150
151
151 title = "Coherence %d%d" %(pair[0], pair[1])
152 title = "Coherence %d%d" %(pair[0], pair[1])
152 axes0 = self.axesList[i*self.__nsubplots+2]
153 axes0 = self.axesList[i*self.__nsubplots+2]
153 axes0.pcolor(x, y, coherence,
154 axes0.pcolor(x, y, coherence,
154 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
155 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
155 xlabel=xlabel, ylabel=ylabel, title=title,
156 xlabel=xlabel, ylabel=ylabel, title=title,
156 ticksize=9, cblabel='')
157 ticksize=9, colormap=coherence_cmap, cblabel='')
157
158
158 title = "Phase %d%d" %(pair[0], pair[1])
159 title = "Phase %d%d" %(pair[0], pair[1])
159 axes0 = self.axesList[i*self.__nsubplots+3]
160 axes0 = self.axesList[i*self.__nsubplots+3]
160 axes0.pcolor(x, y, phase,
161 axes0.pcolor(x, y, phase,
161 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
162 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
162 xlabel=xlabel, ylabel=ylabel, title=title,
163 xlabel=xlabel, ylabel=ylabel, title=title,
163 ticksize=9, cblabel='', colormap='RdBu_r')
164 ticksize=9, colormap=phase_cmap, cblabel='')
164
165
165
166
166
167
@@ -190,7 +191,7 class RTIPlot(Figure):
190 self.__nsubplots = 1
191 self.__nsubplots = 1
191
192
192 self.WIDTH = 800
193 self.WIDTH = 800
193 self.HEIGHT = 200
194 self.HEIGHT = 180
194 self.WIDTHPROF = 120
195 self.WIDTHPROF = 120
195 self.HEIGHTPROF = 0
196 self.HEIGHTPROF = 0
196
197
@@ -276,11 +277,9 class RTIPlot(Figure):
276 z = dataOut.data_spc[channelIndexList,:,:]/factor
277 z = dataOut.data_spc[channelIndexList,:,:]/factor
277 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
278 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
278 avg = numpy.average(z, axis=1)
279 avg = numpy.average(z, axis=1)
279 noise = dataOut.getNoise()/factor
280
280
281 # zdB = 10.*numpy.log10(z)
282 avgdB = 10.*numpy.log10(avg)
281 avgdB = 10.*numpy.log10(avg)
283 noisedB = 10.*numpy.log10(noise)
282
284
283
285 thisDatetime = dataOut.datatime
284 thisDatetime = dataOut.datatime
286 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
285 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
@@ -699,7 +698,7 class CoherenceMap(Figure):
699
698
700 WIDTHPROF = None
699 WIDTHPROF = None
701 HEIGHTPROF = None
700 HEIGHTPROF = None
702 PREFIX = 'coherencemap'
701 PREFIX = 'cmap'
703
702
704 def __init__(self):
703 def __init__(self):
705 self.timerange = 2*60*60
704 self.timerange = 2*60*60
@@ -707,7 +706,7 class CoherenceMap(Figure):
707 self.__nsubplots = 1
706 self.__nsubplots = 1
708
707
709 self.WIDTH = 800
708 self.WIDTH = 800
710 self.HEIGHT = 200
709 self.HEIGHT = 180
711 self.WIDTHPROF = 120
710 self.WIDTHPROF = 120
712 self.HEIGHTPROF = 0
711 self.HEIGHTPROF = 0
713
712
@@ -746,7 +745,8 class CoherenceMap(Figure):
746 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
745 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
747 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
746 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
748 timerange=None,
747 timerange=None,
749 save=False, figpath='./', figfile=None):
748 save=False, figpath='./', figfile=None,
749 coherence_cmap='jet', phase_cmap='RdBu_r'):
750
750
751 if pairsList == None:
751 if pairsList == None:
752 pairsIndexList = dataOut.pairsIndexList
752 pairsIndexList = dataOut.pairsIndexList
@@ -797,9 +797,12 class CoherenceMap(Figure):
797
797
798 pair = dataOut.pairsList[pairsIndexList[i]]
798 pair = dataOut.pairsList[pairsIndexList[i]]
799 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
799 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
800 coherence = numpy.abs(coherenceComplex)
800 avgcoherenceComplex = numpy.average(coherenceComplex, axis=0)
801 avg = numpy.average(coherence, axis=0)
801 coherence = numpy.abs(avgcoherenceComplex)
802 z = avg.reshape((1,-1))
802 # coherence = numpy.abs(coherenceComplex)
803 # avg = numpy.average(coherence, axis=0)
804
805 z = coherence.reshape((1,-1))
803
806
804 counter = 0
807 counter = 0
805
808
@@ -808,33 +811,34 class CoherenceMap(Figure):
808 axes.pcolor(x, y, z,
811 axes.pcolor(x, y, z,
809 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
812 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
810 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
813 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
811 ticksize=9, cblabel='', cbsize="1%")
814 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
812
815
813 if self.__showprofile:
816 if self.__showprofile:
814 counter += 1
817 counter += 1
815 axes = self.axesList[i*self.__nsubplots*2 + counter]
818 axes = self.axesList[i*self.__nsubplots*2 + counter]
816 axes.pline(avg, y,
819 axes.pline(coherence, y,
817 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
820 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
818 xlabel='', ylabel='', title='', ticksize=7,
821 xlabel='', ylabel='', title='', ticksize=7,
819 ytick_visible=False, nxticks=5,
822 ytick_visible=False, nxticks=5,
820 grid='x')
823 grid='x')
821
824
822 counter += 1
825 counter += 1
823 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
826 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
824 avg = numpy.average(phase, axis=0)
827 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
825 z = avg.reshape((1,-1))
828 # avg = numpy.average(phase, axis=0)
829 z = phase.reshape((1,-1))
826
830
827 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
831 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
828 axes = self.axesList[i*self.__nsubplots*2 + counter]
832 axes = self.axesList[i*self.__nsubplots*2 + counter]
829 axes.pcolor(x, y, z,
833 axes.pcolor(x, y, z,
830 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
834 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
831 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
835 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
832 ticksize=9, cblabel='', colormap='RdBu', cbsize="1%")
836 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
833
837
834 if self.__showprofile:
838 if self.__showprofile:
835 counter += 1
839 counter += 1
836 axes = self.axesList[i*self.__nsubplots*2 + counter]
840 axes = self.axesList[i*self.__nsubplots*2 + counter]
837 axes.pline(avg, y,
841 axes.pline(phase, y,
838 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
842 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
839 xlabel='', ylabel='', title='', ticksize=7,
843 xlabel='', ylabel='', title='', ticksize=7,
840 ytick_visible=False, nxticks=4,
844 ytick_visible=False, nxticks=4,
General Comments 0
You need to be logged in to leave comments. Login now