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