##// END OF EJS Templates
A la clase CoherenceMap se le agrega un buffer para datos de coherencia, fase, tiempo(x), con esto se optimiza el uso de la memoria RAM, se realizaron pruebas con EWDrifts y Meteoros
Daniel Valdez -
r267:4392037fd4a3
parent child
Show More
@@ -92,7 +92,7 class CrossSpectraPlot(Figure):
92 92 y = dataOut.getHeiRange()
93 93 z = dataOut.data_spc[:,:,:]/factor
94 94 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
95 avg = numpy.abs(numpy.average(z, axis=1))
95 avg = numpy.average(z, axis=1)
96 96 noise = dataOut.getNoise()/factor
97 97
98 98 zdB = 10*numpy.log10(z)
@@ -721,6 +721,7 class CoherenceMap(Figure):
721 721 WIDTHPROF = None
722 722 HEIGHTPROF = None
723 723 PREFIX = 'cmap'
724 __missing = 1E30
724 725
725 726 def __init__(self):
726 727 self.timerange = 2*60*60
@@ -731,6 +732,9 class CoherenceMap(Figure):
731 732 self.HEIGHT = 200
732 733 self.WIDTHPROF = 120
733 734 self.HEIGHTPROF = 0
735 self.x_buffer = None
736 self.coherence_buffer = None
737 self.phase_buffer = None
734 738
735 739 def getSubplots(self):
736 740 ncol = 1
@@ -810,27 +814,54 class CoherenceMap(Figure):
810 814 if ymax == None: ymax = numpy.nanmax(y)
811 815
812 816 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
813
817 self.x_buffer = numpy.array([])
818 self.coherence_buffer = numpy.array([])
819 self.phase_buffer = numpy.array([])
814 820 self.__isConfig = True
815 821
816 822 self.setWinTitle(title)
817 823
818 for i in range(self.nplots):
819 824
820 pair = dataOut.pairsList[pairsIndexList[i]]
821 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
822 avgcoherenceComplex = numpy.average(coherenceComplex, axis=0)
825 pairArray = numpy.array(dataOut.pairsList)
826 pairArray = pairArray[pairsIndexList]
827 pair0ids = pairArray[:,0]
828 pair1ids = pairArray[:,1]
829
830 coherenceComplex = dataOut.data_cspc[pairsIndexList,:,:]/numpy.sqrt(dataOut.data_spc[pair0ids,:,:]*dataOut.data_spc[pair1ids,:,:])
831 avgcoherenceComplex = numpy.average(coherenceComplex, axis=1)
823 832 coherence = numpy.abs(avgcoherenceComplex)
824 # coherence = numpy.abs(coherenceComplex)
825 # avg = numpy.average(coherence, axis=0)
826 833
827 z = coherence.reshape((1,-1))
834 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
828 835
829 counter = 0
836 if len(self.coherence_buffer)==0:
837 self.coherence_buffer = coherence
838 self.phase_buffer = phase
839 newxdim = 1
840 newydim = -1
841 else:
842 if x[0]>self.x_buffer[-1]:
843 gap = coherence.copy()
844 gap[:] = self.__missing
845 self.coherence_buffer = numpy.hstack((self.coherence_buffer, gap))
846 self.phase_buffer = numpy.hstack((self.phase_buffer, gap))
847
848 self.coherence_buffer = numpy.hstack((self.coherence_buffer, coherence))
849 self.phase_buffer = numpy.hstack((self.phase_buffer, phase))
850 newxdim = -1
851 newydim = len(y)
852
853 self.x_buffer = numpy.hstack((self.x_buffer, x))
830 854
831 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
855 self.coherence_buffer = numpy.ma.masked_inside(self.coherence_buffer,0.99*self.__missing,1.01*self.__missing)
856 self.phase_buffer = numpy.ma.masked_inside(self.phase_buffer,0.99*self.__missing,1.01*self.__missing)
857
858
859 for i in range(self.nplots):
860 counter = 0
861 z = self.coherence_buffer[i,:].reshape((newxdim,newydim))
862 title = "Coherence %d%d: %s" %(pair0ids[i], pair1ids[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
832 863 axes = self.axesList[i*self.__nsubplots*2]
833 axes.pcolor(x, y, z,
864 axes.pcolor(self.x_buffer, y, z,
834 865 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
835 866 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
836 867 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
@@ -838,21 +869,19 class CoherenceMap(Figure):
838 869 if self.__showprofile:
839 870 counter += 1
840 871 axes = self.axesList[i*self.__nsubplots*2 + counter]
841 axes.pline(coherence, y,
872 axes.pline(coherence[i,:], y,
842 873 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
843 874 xlabel='', ylabel='', title='', ticksize=7,
844 875 ytick_visible=False, nxticks=5,
845 876 grid='x')
846 877
847 878 counter += 1
848 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
849 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
850 # avg = numpy.average(phase, axis=0)
851 z = phase.reshape((1,-1))
852 879
853 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
880 z = self.phase_buffer[i,:].reshape((newxdim,newydim))
881
882 title = "Phase %d%d: %s" %(pair0ids[i], pair1ids[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
854 883 axes = self.axesList[i*self.__nsubplots*2 + counter]
855 axes.pcolor(x, y, z,
884 axes.pcolor(self.x_buffer, y, z,
856 885 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
857 886 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
858 887 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
@@ -860,7 +889,7 class CoherenceMap(Figure):
860 889 if self.__showprofile:
861 890 counter += 1
862 891 axes = self.axesList[i*self.__nsubplots*2 + counter]
863 axes.pline(phase, y,
892 axes.pline(phase[i,:], y,
864 893 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
865 894 xlabel='', ylabel='', title='', ticksize=7,
866 895 ytick_visible=False, nxticks=4,
General Comments 0
You need to be logged in to leave comments. Login now