diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 47cd06a..12364eb 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -933,7 +933,7 @@ class ProfileSelector(Operation): rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256)) """ - + print "HOLA MUNDO CRUEL" if rangeList is not None: if type(rangeList[0]) not in (tuple, list): rangeList = [rangeList] @@ -1357,9 +1357,11 @@ class voltACFLags(Operation): def setup(self,dataOut ,lags = None,mode =None, fullBuffer= None ,pairsList = None,nAvg = 1): self.lags = lags + print self.lags self.mode = mode self.fullBuffer= fullBuffer self.nAvg = nAvg + self.pairsList = pairsList nChannels = dataOut.nChannels nProfiles = dataOut.nProfiles nHeights = dataOut.nHeights @@ -1372,16 +1374,16 @@ class voltACFLags(Operation): print "Mode lags equal height." if pairsList == None: - print "Pairs list selected by default (1,0)" - pairsList = [(0,1)] - pairList= pairsList + print "Pairs list selected by default (1,0)" + pairsList = [(0,1)] + self.pairsList= pairsList if lags == None: - if mode=='time': - self.lags = numpy.arange(0,nProfiles)# -nProfiles+1, nProfiles - print "self.lags", len(self.lags) - if mode=='height': - self.lags = numpy.arange(0,nHeights)# -nHeights+1, nHeights + if mode=='time': + self.lags = numpy.arange(0,nProfiles)# -nProfiles+1, nProfiles + print "self.lags", len(self.lags) + if mode=='height': + self.lags = numpy.arange(0,nHeights)# -nHeights+1, nHeights if fullBuffer: self.tmp = numpy.zeros((len(pairsList), len(self.lags), nProfiles, nHeights), dtype = 'complex')*numpy.nan @@ -1390,12 +1392,12 @@ class voltACFLags(Operation): elif mode =='height': self.tmp = numpy.zeros(len(pairsList), (len(self.lags), nProfiles),dtype='complex') - print "lags", len(self.lags) + print "lags", len(self.lags),self.lags print "mode",self.mode print "nChannels", nChannels print "nProfiles", nProfiles print "nHeights" , nHeights - print "pairsList", pairsList + print "pairsList", pairsList,len(self.pairsList) print "fullBuffer", fullBuffer #print "type(pairsList)",type(pairsList) print "tmp.shape",self.tmp.shape @@ -1403,36 +1405,31 @@ class voltACFLags(Operation): def run(self, dataOut, lags =None,mode ='time',fullBuffer= False ,pairsList = None,nAvg = 1): - dataOut.flagNoData = True + dataOut.flagNoData = True if not self.isConfig: self.setup(dataOut, lags = lags,mode = mode, fullBuffer= fullBuffer ,pairsList = pairsList,nAvg=nAvg) self.isConfig = True - - if dataOut.type == "Voltage": - + if dataOut.type == "Voltage": data_pre = dataOut.data #data - - - # Here is the loop :D - for l in range(len(pairsList)): - ch0 = pairsList[l][0] - ch1 = pairsList[l][1] - - for i in range(len(self.lags)): - idx = self.lags[i] - if self.mode == 'time': - acf0 = data_pre[ch0,:self.__nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) # pair,lag,height - else: - acf0 = data_pre[ch0,:,:self.__nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) # pair,lag,profile - - if self.fullBuffer: - self.tmp[l,i,:acf0.shape[0],:]= acf0 - else: - self.tmp[l,i,:]= numpy.sum(acf0,axis=0) - + print "size",data_pre.shape + # Here is the loop :D + for l in range(len(self.pairsList)): + ch0 = self.pairsList[l][0] + ch1 = self.pairsList[l][1] + for i in range(len(self.lags)): + print i,"hola dios" + idx = self.lags[i] + if self.mode == 'time': + acf0 = data_pre[ch0,:self.__nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) # pair,lag,height + else: + acf0 = data_pre[ch0,:,:self.__nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) # pair,lag,profile + + if self.fullBuffer: + self.tmp[l,i,:acf0.shape[0],:]= acf0 + else: + self.tmp[l,i,:]= numpy.sum(acf0,axis=0) if self.fullBuffer: - self.tmp = numpy.sum(numpy.reshape(self.tmp,(self.tmp.shape[0],self.tmp.shape[1],self.tmp.shape[2]/self.nAvg,self.nAvg,self.tmp.shape[3])),axis=3) dataOut.nAvg = self.nAvg @@ -1447,7 +1444,6 @@ class voltACFLags(Operation): for j in range(shape[2]): self.tmp[i,:,j]= self.tmp[i,:,j].real / numpy.max(numpy.abs(self.tmp[i,:,j])) - #import matplotlib.pyplot as plt #print "test",self.tmp.shape #print self.tmp[0,0,0] @@ -1467,7 +1463,7 @@ class voltACFLags(Operation): dataOut.nPairs = len(pairsList) dataOut.lagRange = numpy.array(self.lags)*delta dataOut.flagDataAsBlock = True - dataOut.flagNoData = False + dataOut.flagNoData = False import time #################################################