@@ -53,9 +53,8 class CrossSpectraPlot(Figure): | |||||
53 | counter += 1 |
|
53 | counter += 1 | |
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'): |
|
|||
59 |
|
58 | |||
60 | """ |
|
59 | """ | |
61 |
|
60 | |||
@@ -87,15 +86,12 class CrossSpectraPlot(Figure): | |||||
87 |
|
86 | |||
88 | if len(pairsIndexList) > 4: |
|
87 | if len(pairsIndexList) > 4: | |
89 | pairsIndexList = pairsIndexList[0:4] |
|
88 | pairsIndexList = pairsIndexList[0:4] | |
90 |
|
89 | factor = dataOut.normFactor | ||
91 | factor = 1 |
|
|||
92 | if normalize: |
|
|||
93 | factor = dataOut.normFactor |
|
|||
94 | x = dataOut.getVelRange(1) |
|
90 | x = dataOut.getVelRange(1) | |
95 | y = dataOut.getHeiRange() |
|
91 | y = dataOut.getHeiRange() | |
96 | z = dataOut.data_spc[:,:,:]/factor |
|
92 | z = dataOut.data_spc[:,:,:]/factor | |
97 |
|
93 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | ||
98 | avg = numpy.average(z, axis=1) |
|
94 | avg = numpy.average(numpy.abs(z), axis=1) | |
99 | noise = dataOut.getNoise()/factor |
|
95 | noise = dataOut.getNoise()/factor | |
100 |
|
96 | |||
101 | zdB = 10*numpy.log10(z) |
|
97 | zdB = 10*numpy.log10(z) | |
@@ -137,7 +133,7 class CrossSpectraPlot(Figure): | |||||
137 | axes0.pcolor(x, y, zdB, |
|
133 | axes0.pcolor(x, y, zdB, | |
138 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
134 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
139 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
135 | xlabel=xlabel, ylabel=ylabel, title=title, | |
140 |
ticksize=9 |
|
136 | ticksize=9, cblabel='') | |
141 |
|
137 | |||
142 | title = "Channel %d: %4.2fdB" %(pair[1], noisedB[pair[1]]) |
|
138 | title = "Channel %d: %4.2fdB" %(pair[1], noisedB[pair[1]]) | |
143 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) |
|
139 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) | |
@@ -145,26 +141,26 class CrossSpectraPlot(Figure): | |||||
145 | axes0.pcolor(x, y, zdB, |
|
141 | axes0.pcolor(x, y, zdB, | |
146 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
142 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
147 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
143 | xlabel=xlabel, ylabel=ylabel, title=title, | |
148 |
ticksize=9 |
|
144 | ticksize=9, cblabel='') | |
149 |
|
145 | |||
150 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:]) |
|
146 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:]) | |
151 | coherence = numpy.abs(coherenceComplex) |
|
147 | coherence = numpy.abs(coherenceComplex) | |
152 |
|
|
148 | phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi | |
153 | phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi |
|
149 | ||
154 |
|
150 | |||
155 | title = "Coherence %d%d" %(pair[0], pair[1]) |
|
151 | title = "Coherence %d%d" %(pair[0], pair[1]) | |
156 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
152 | axes0 = self.axesList[i*self.__nsubplots+2] | |
157 | axes0.pcolor(x, y, coherence, |
|
153 | axes0.pcolor(x, y, coherence, | |
158 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, |
|
154 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, | |
159 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
155 | xlabel=xlabel, ylabel=ylabel, title=title, | |
160 |
ticksize=9 |
|
156 | ticksize=9, cblabel='') | |
161 |
|
157 | |||
162 | title = "Phase %d%d" %(pair[0], pair[1]) |
|
158 | title = "Phase %d%d" %(pair[0], pair[1]) | |
163 | axes0 = self.axesList[i*self.__nsubplots+3] |
|
159 | axes0 = self.axesList[i*self.__nsubplots+3] | |
164 | axes0.pcolor(x, y, phase, |
|
160 | axes0.pcolor(x, y, phase, | |
165 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
161 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, | |
166 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
162 | xlabel=xlabel, ylabel=ylabel, title=title, | |
167 |
ticksize=9, |
|
163 | ticksize=9, cblabel='', colormap='RdBu_r') | |
168 |
|
164 | |||
169 |
|
165 | |||
170 |
|
166 | |||
@@ -182,7 +178,7 class RTIPlot(Figure): | |||||
182 |
|
178 | |||
183 | __isConfig = None |
|
179 | __isConfig = None | |
184 | __nsubplots = None |
|
180 | __nsubplots = None | |
185 | __missing = 1E30 |
|
181 | ||
186 | WIDTHPROF = None |
|
182 | WIDTHPROF = None | |
187 | HEIGHTPROF = None |
|
183 | HEIGHTPROF = None | |
188 | PREFIX = 'rti' |
|
184 | PREFIX = 'rti' | |
@@ -194,11 +190,9 class RTIPlot(Figure): | |||||
194 | self.__nsubplots = 1 |
|
190 | self.__nsubplots = 1 | |
195 |
|
191 | |||
196 | self.WIDTH = 800 |
|
192 | self.WIDTH = 800 | |
197 |
self.HEIGHT = |
|
193 | self.HEIGHT = 200 | |
198 | self.WIDTHPROF = 120 |
|
194 | self.WIDTHPROF = 120 | |
199 | self.HEIGHTPROF = 0 |
|
195 | self.HEIGHTPROF = 0 | |
200 | self.x_buffer = None |
|
|||
201 | self.avgdB_buffer = None |
|
|||
202 |
|
196 | |||
203 | def getSubplots(self): |
|
197 | def getSubplots(self): | |
204 |
|
198 | |||
@@ -214,19 +208,15 class RTIPlot(Figure): | |||||
214 |
|
208 | |||
215 | ncolspan = 1 |
|
209 | ncolspan = 1 | |
216 | colspan = 1 |
|
210 | colspan = 1 | |
217 | widthplot = self.WIDTH |
|
|||
218 | heightplot = self.HEIGHT |
|
|||
219 | if showprofile: |
|
211 | if showprofile: | |
220 | ncolspan = 7 |
|
212 | ncolspan = 7 | |
221 | colspan = 6 |
|
213 | colspan = 6 | |
222 | self.__nsubplots = 2 |
|
214 | self.__nsubplots = 2 | |
223 | widthplot += self.WIDTHPROF |
|
|||
224 | heightplot += self.HEIGHTPROF |
|
|||
225 |
|
215 | |||
226 | self.createFigure(idfigure = idfigure, |
|
216 | self.createFigure(idfigure = idfigure, | |
227 | wintitle = wintitle, |
|
217 | wintitle = wintitle, | |
228 |
widthplot = |
|
218 | widthplot = self.WIDTH + self.WIDTHPROF, | |
229 |
heightplot = |
|
219 | heightplot = self.HEIGHT + self.HEIGHTPROF) | |
230 |
|
220 | |||
231 | nrow, ncol = self.getSubplots() |
|
221 | nrow, ncol = self.getSubplots() | |
232 |
|
222 | |||
@@ -245,7 +235,7 class RTIPlot(Figure): | |||||
245 | counter += 1 |
|
235 | counter += 1 | |
246 |
|
236 | |||
247 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
237 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', | |
248 |
xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
238 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, | |
249 | timerange=None, |
|
239 | timerange=None, | |
250 | save=False, figpath='./', figfile=None): |
|
240 | save=False, figpath='./', figfile=None): | |
251 |
|
241 | |||
@@ -279,18 +269,18 class RTIPlot(Figure): | |||||
279 |
|
269 | |||
280 | tmin = None |
|
270 | tmin = None | |
281 | tmax = None |
|
271 | tmax = None | |
282 |
factor = |
|
272 | factor = dataOut.normFactor | |
283 | if normalize: |
|
|||
284 | factor = dataOut.normFactor |
|
|||
285 | x = dataOut.getTimeRange() |
|
273 | x = dataOut.getTimeRange() | |
286 | y = dataOut.getHeiRange() |
|
274 | y = dataOut.getHeiRange() | |
287 |
|
275 | |||
288 | z = dataOut.data_spc[channelIndexList,:,:]/factor |
|
276 | z = dataOut.data_spc[channelIndexList,:,:]/factor | |
289 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
277 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
290 | avg = numpy.average(z, axis=1) |
|
278 | avg = numpy.average(z, axis=1) | |
|
279 | noise = dataOut.getNoise()/factor | |||
291 |
|
280 | |||
|
281 | # zdB = 10.*numpy.log10(z) | |||
292 | avgdB = 10.*numpy.log10(avg) |
|
282 | avgdB = 10.*numpy.log10(avg) | |
293 |
|
283 | noisedB = 10.*numpy.log10(noise) | ||
294 |
|
284 | |||
295 | thisDatetime = dataOut.datatime |
|
285 | thisDatetime = dataOut.datatime | |
296 | title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
286 | title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) | |
@@ -313,36 +303,16 class RTIPlot(Figure): | |||||
313 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 |
|
303 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 | |
314 |
|
304 | |||
315 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
305 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
316 | self.x_buffer = numpy.array([]) |
|
|||
317 | self.avgdB_buffer = numpy.array([]) |
|
|||
318 | self.__isConfig = True |
|
306 | self.__isConfig = True | |
319 |
|
307 | |||
320 |
|
308 | |||
321 | self.setWinTitle(title) |
|
309 | self.setWinTitle(title) | |
322 |
|
||||
323 | if len(self.avgdB_buffer)==0: |
|
|||
324 | self.avgdB_buffer = avgdB |
|
|||
325 | newxdim = 1 |
|
|||
326 | newydim = -1 |
|
|||
327 | else: |
|
|||
328 | if x[0]>self.x_buffer[-1]: |
|
|||
329 | gap = avgdB.copy() |
|
|||
330 | gap[:] = self.__missing |
|
|||
331 | self.avgdB_buffer = numpy.hstack((self.avgdB_buffer, gap)) |
|
|||
332 |
|
310 | |||
333 | self.avgdB_buffer = numpy.hstack((self.avgdB_buffer, avgdB)) |
|
|||
334 | newxdim = -1 |
|
|||
335 | newydim = len(y) |
|
|||
336 |
|
||||
337 | self.x_buffer = numpy.hstack((self.x_buffer, x)) |
|
|||
338 |
|
||||
339 | self.avgdB_buffer = numpy.ma.masked_inside(self.avgdB_buffer,0.99*self.__missing,1.01*self.__missing) |
|
|||
340 |
|
||||
341 | for i in range(self.nplots): |
|
311 | for i in range(self.nplots): | |
342 | title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
312 | title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
343 | axes = self.axesList[i*self.__nsubplots] |
|
313 | axes = self.axesList[i*self.__nsubplots] | |
344 |
zdB = |
|
314 | zdB = avgdB[i].reshape((1,-1)) | |
345 |
axes.pcolor( |
|
315 | axes.pcolor(x, y, zdB, | |
346 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
316 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
347 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
317 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
348 | ticksize=9, cblabel='', cbsize="1%") |
|
318 | ticksize=9, cblabel='', cbsize="1%") | |
@@ -381,7 +351,7 class SpectraPlot(Figure): | |||||
381 | self.__isConfig = False |
|
351 | self.__isConfig = False | |
382 | self.__nsubplots = 1 |
|
352 | self.__nsubplots = 1 | |
383 |
|
353 | |||
384 |
self.WIDTH = 2 |
|
354 | self.WIDTH = 230 | |
385 | self.HEIGHT = 250 |
|
355 | self.HEIGHT = 250 | |
386 | self.WIDTHPROF = 120 |
|
356 | self.WIDTHPROF = 120 | |
387 | self.HEIGHTPROF = 0 |
|
357 | self.HEIGHTPROF = 0 | |
@@ -400,19 +370,15 class SpectraPlot(Figure): | |||||
400 |
|
370 | |||
401 | ncolspan = 1 |
|
371 | ncolspan = 1 | |
402 | colspan = 1 |
|
372 | colspan = 1 | |
403 | widthplot = self.WIDTH |
|
|||
404 | heightplot = self.HEIGHT |
|
|||
405 | if showprofile: |
|
373 | if showprofile: | |
406 | ncolspan = 3 |
|
374 | ncolspan = 3 | |
407 | colspan = 2 |
|
375 | colspan = 2 | |
408 | self.__nsubplots = 2 |
|
376 | self.__nsubplots = 2 | |
409 | widthplot += self.WIDTHPROF |
|
377 | ||
410 | heightplot += self.HEIGHTPROF |
|
|||
411 |
|
||||
412 | self.createFigure(idfigure = idfigure, |
|
378 | self.createFigure(idfigure = idfigure, | |
413 | wintitle = wintitle, |
|
379 | wintitle = wintitle, | |
414 |
widthplot = |
|
380 | widthplot = self.WIDTH + self.WIDTHPROF, | |
415 |
heightplot = |
|
381 | heightplot = self.HEIGHT + self.HEIGHTPROF) | |
416 |
|
382 | |||
417 | nrow, ncol = self.getSubplots() |
|
383 | nrow, ncol = self.getSubplots() | |
418 |
|
384 | |||
@@ -431,7 +397,7 class SpectraPlot(Figure): | |||||
431 | counter += 1 |
|
397 | counter += 1 | |
432 |
|
398 | |||
433 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
399 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', | |
434 |
xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
400 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, | |
435 | save=False, figpath='./', figfile=None): |
|
401 | save=False, figpath='./', figfile=None): | |
436 |
|
402 | |||
437 | """ |
|
403 | """ | |
@@ -458,9 +424,7 class SpectraPlot(Figure): | |||||
458 | if channel not in dataOut.channelList: |
|
424 | if channel not in dataOut.channelList: | |
459 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
425 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
460 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
426 | channelIndexList.append(dataOut.channelList.index(channel)) | |
461 |
factor = |
|
427 | factor = dataOut.normFactor | |
462 | if normalize: |
|
|||
463 | factor = dataOut.normFactor |
|
|||
464 | x = dataOut.getVelRange(1) |
|
428 | x = dataOut.getVelRange(1) | |
465 | y = dataOut.getHeiRange() |
|
429 | y = dataOut.getHeiRange() | |
466 |
|
430 | |||
@@ -666,7 +630,7 class ProfilePlot(Figure): | |||||
666 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
630 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) | |
667 |
|
631 | |||
668 | def run(self, dataOut, idfigure, wintitle="", channelList=None, |
|
632 | def run(self, dataOut, idfigure, wintitle="", channelList=None, | |
669 |
xmin=None, xmax=None, ymin=None, ymax=None, |
|
633 | xmin=None, xmax=None, ymin=None, ymax=None, | |
670 | save=False, figpath='./', figfile=None): |
|
634 | save=False, figpath='./', figfile=None): | |
671 |
|
635 | |||
672 | if channelList == None: |
|
636 | if channelList == None: | |
@@ -679,9 +643,7 class ProfilePlot(Figure): | |||||
679 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
643 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
680 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
644 | channelIndexList.append(dataOut.channelList.index(channel)) | |
681 |
|
645 | |||
682 |
factor = |
|
646 | factor = dataOut.normFactor | |
683 | if normalize: |
|
|||
684 | factor = dataOut.normFactor |
|
|||
685 | y = dataOut.getHeiRange() |
|
647 | y = dataOut.getHeiRange() | |
686 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
648 | x = dataOut.data_spc[channelIndexList,:,:]/factor | |
687 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
649 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) | |
@@ -737,8 +699,7 class CoherenceMap(Figure): | |||||
737 |
|
699 | |||
738 | WIDTHPROF = None |
|
700 | WIDTHPROF = None | |
739 | HEIGHTPROF = None |
|
701 | HEIGHTPROF = None | |
740 | PREFIX = 'cmap' |
|
702 | PREFIX = 'coherencemap' | |
741 | __missing = 1E30 |
|
|||
742 |
|
703 | |||
743 | def __init__(self): |
|
704 | def __init__(self): | |
744 | self.timerange = 2*60*60 |
|
705 | self.timerange = 2*60*60 | |
@@ -749,9 +710,6 class CoherenceMap(Figure): | |||||
749 | self.HEIGHT = 200 |
|
710 | self.HEIGHT = 200 | |
750 | self.WIDTHPROF = 120 |
|
711 | self.WIDTHPROF = 120 | |
751 | self.HEIGHTPROF = 0 |
|
712 | self.HEIGHTPROF = 0 | |
752 | self.x_buffer = None |
|
|||
753 | self.coherence_buffer = None |
|
|||
754 | self.phase_buffer = None |
|
|||
755 |
|
713 | |||
756 | def getSubplots(self): |
|
714 | def getSubplots(self): | |
757 | ncol = 1 |
|
715 | ncol = 1 | |
@@ -788,8 +746,7 class CoherenceMap(Figure): | |||||
788 | def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True', |
|
746 | def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True', | |
789 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
747 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, | |
790 | timerange=None, |
|
748 | timerange=None, | |
791 |
save=False, figpath='./', figfile=None |
|
749 | save=False, figpath='./', figfile=None): | |
792 | coherence_cmap='jet', phase_cmap='RdBu_r'): |
|
|||
793 |
|
750 | |||
794 | if pairsList == None: |
|
751 | if pairsList == None: | |
795 | pairsIndexList = dataOut.pairsIndexList |
|
752 | pairsIndexList = dataOut.pairsIndexList | |
@@ -831,82 +788,53 class CoherenceMap(Figure): | |||||
831 | if ymax == None: ymax = numpy.nanmax(y) |
|
788 | if ymax == None: ymax = numpy.nanmax(y) | |
832 |
|
789 | |||
833 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
790 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
834 | self.x_buffer = numpy.array([]) |
|
791 | ||
835 | self.coherence_buffer = numpy.array([]) |
|
|||
836 | self.phase_buffer = numpy.array([]) |
|
|||
837 | self.__isConfig = True |
|
792 | self.__isConfig = True | |
838 |
|
793 | |||
839 | self.setWinTitle(title) |
|
794 | self.setWinTitle(title) | |
840 |
|
795 | |||
|
796 | for i in range(self.nplots): | |||
|
797 | ||||
|
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],:,:]) | |||
|
800 | coherence = numpy.abs(coherenceComplex) | |||
|
801 | avg = numpy.average(coherence, axis=0) | |||
|
802 | z = avg.reshape((1,-1)) | |||
841 |
|
803 | |||
842 | pairArray = numpy.array(dataOut.pairsList) |
|
804 | counter = 0 | |
843 | pairArray = pairArray[pairsIndexList] |
|
|||
844 | pair0ids = pairArray[:,0] |
|
|||
845 | pair1ids = pairArray[:,1] |
|
|||
846 |
|
||||
847 | coherenceComplex = dataOut.data_cspc[pairsIndexList,:,:]/numpy.sqrt(dataOut.data_spc[pair0ids,:,:]*dataOut.data_spc[pair1ids,:,:]) |
|
|||
848 | avgcoherenceComplex = numpy.average(coherenceComplex, axis=1) |
|
|||
849 | coherence = numpy.abs(avgcoherenceComplex) |
|
|||
850 |
|
||||
851 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
|||
852 |
|
||||
853 | if len(self.coherence_buffer)==0: |
|
|||
854 | self.coherence_buffer = coherence |
|
|||
855 | self.phase_buffer = phase |
|
|||
856 | newxdim = 1 |
|
|||
857 | newydim = -1 |
|
|||
858 | else: |
|
|||
859 | if x[0]>self.x_buffer[-1]: |
|
|||
860 | gap = coherence.copy() |
|
|||
861 | gap[:] = self.__missing |
|
|||
862 | self.coherence_buffer = numpy.hstack((self.coherence_buffer, gap)) |
|
|||
863 | self.phase_buffer = numpy.hstack((self.phase_buffer, gap)) |
|
|||
864 |
|
805 | |||
865 | self.coherence_buffer = numpy.hstack((self.coherence_buffer, coherence)) |
|
806 | title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
866 | self.phase_buffer = numpy.hstack((self.phase_buffer, phase)) |
|
|||
867 | newxdim = -1 |
|
|||
868 | newydim = len(y) |
|
|||
869 |
|
||||
870 | self.x_buffer = numpy.hstack((self.x_buffer, x)) |
|
|||
871 |
|
||||
872 | self.coherence_buffer = numpy.ma.masked_inside(self.coherence_buffer,0.99*self.__missing,1.01*self.__missing) |
|
|||
873 | self.phase_buffer = numpy.ma.masked_inside(self.phase_buffer,0.99*self.__missing,1.01*self.__missing) |
|
|||
874 |
|
||||
875 |
|
||||
876 | for i in range(self.nplots): |
|
|||
877 | counter = 0 |
|
|||
878 | z = self.coherence_buffer[i,:].reshape((newxdim,newydim)) |
|
|||
879 | title = "Coherence %d%d: %s" %(pair0ids[i], pair1ids[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
|||
880 | axes = self.axesList[i*self.__nsubplots*2] |
|
807 | axes = self.axesList[i*self.__nsubplots*2] | |
881 |
axes.pcolor( |
|
808 | axes.pcolor(x, y, z, | |
882 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, |
|
809 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, | |
883 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
810 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
884 |
ticksize=9, cblabel='', |
|
811 | ticksize=9, cblabel='', cbsize="1%") | |
885 |
|
812 | |||
886 | if self.__showprofile: |
|
813 | if self.__showprofile: | |
887 | counter += 1 |
|
814 | counter += 1 | |
888 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
815 | axes = self.axesList[i*self.__nsubplots*2 + counter] | |
889 |
axes.pline( |
|
816 | axes.pline(avg, y, | |
890 | xmin=0, xmax=1, ymin=ymin, ymax=ymax, |
|
817 | xmin=0, xmax=1, ymin=ymin, ymax=ymax, | |
891 | xlabel='', ylabel='', title='', ticksize=7, |
|
818 | xlabel='', ylabel='', title='', ticksize=7, | |
892 | ytick_visible=False, nxticks=5, |
|
819 | ytick_visible=False, nxticks=5, | |
893 | grid='x') |
|
820 | grid='x') | |
894 |
|
821 | |||
895 | counter += 1 |
|
822 | counter += 1 | |
896 |
|
823 | phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi | ||
897 | z = self.phase_buffer[i,:].reshape((newxdim,newydim)) |
|
824 | avg = numpy.average(phase, axis=0) | |
|
825 | z = avg.reshape((1,-1)) | |||
898 |
|
826 | |||
899 |
title = "Phase %d%d: %s" %(pair |
|
827 | title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
900 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
828 | axes = self.axesList[i*self.__nsubplots*2 + counter] | |
901 |
axes.pcolor( |
|
829 | axes.pcolor(x, y, z, | |
902 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
830 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, | |
903 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
831 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
904 |
ticksize=9, cblabel='', colormap= |
|
832 | ticksize=9, cblabel='', colormap='RdBu', cbsize="1%") | |
905 |
|
833 | |||
906 | if self.__showprofile: |
|
834 | if self.__showprofile: | |
907 | counter += 1 |
|
835 | counter += 1 | |
908 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
836 | axes = self.axesList[i*self.__nsubplots*2 + counter] | |
909 |
axes.pline( |
|
837 | axes.pline(avg, y, | |
910 | xmin=-180, xmax=180, ymin=ymin, ymax=ymax, |
|
838 | xmin=-180, xmax=180, ymin=ymin, ymax=ymax, | |
911 | xlabel='', ylabel='', title='', ticksize=7, |
|
839 | xlabel='', ylabel='', title='', ticksize=7, | |
912 | ytick_visible=False, nxticks=4, |
|
840 | ytick_visible=False, nxticks=4, | |
@@ -971,7 +899,7 class RTIfromNoise(Figure): | |||||
971 |
|
899 | |||
972 |
|
900 | |||
973 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
901 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', | |
974 |
xmin=None, xmax=None, ymin=None, ymax=None, |
|
902 | xmin=None, xmax=None, ymin=None, ymax=None, | |
975 | timerange=None, |
|
903 | timerange=None, | |
976 | save=False, figpath='./', figfile=None): |
|
904 | save=False, figpath='./', figfile=None): | |
977 |
|
905 | |||
@@ -992,9 +920,7 class RTIfromNoise(Figure): | |||||
992 | tmax = None |
|
920 | tmax = None | |
993 | x = dataOut.getTimeRange() |
|
921 | x = dataOut.getTimeRange() | |
994 | y = dataOut.getHeiRange() |
|
922 | y = dataOut.getHeiRange() | |
995 |
factor = |
|
923 | factor = dataOut.normFactor | |
996 | if normalize: |
|
|||
997 | factor = dataOut.normFactor |
|
|||
998 | noise = dataOut.getNoise()/factor |
|
924 | noise = dataOut.getNoise()/factor | |
999 | noisedB = 10*numpy.log10(noise) |
|
925 | noisedB = 10*numpy.log10(noise) | |
1000 |
|
926 |
General Comments 0
You need to be logged in to leave comments.
Login now