import numpy from jroproc_base import ProcessingUnit, Operation from schainpy.model.data.jrodata import Correlation, hildebrand_sekhon class CorrelationProc(ProcessingUnit): pairsList = None data_cf = None def __init__(self, **kwargs): ProcessingUnit.__init__(self, **kwargs) self.objectDict = {} self.buffer = None self.firstdatatime = None self.profIndex = 0 self.dataOut = Correlation() def __updateObjFromVoltage(self): self.dataOut.timeZone = self.dataIn.timeZone self.dataOut.dstFlag = self.dataIn.dstFlag self.dataOut.errorCount = self.dataIn.errorCount self.dataOut.useLocalTime = self.dataIn.useLocalTime self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy() self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy() self.dataOut.channelList = self.dataIn.channelList self.dataOut.heightList = self.dataIn.heightList self.dataOut.dtype = numpy.dtype([('real','= 0: if mode == 'time': ccf0 = data_pre[ch0,:nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) #time else: ccf0 = data_pre[ch0,:,nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) #heights else: if mode == 'time': ccf0 = data_pre[ch0,-idx:,:]*numpy.conj(data_pre[ch1,:nProfiles+idx,:]) #time else: ccf0 = data_pre[ch0,:,-idx:]*numpy.conj(data_pre[ch1,:,:nHeights+idx]) #heights if fullBuffer: tmp[l,i,:ccf0.shape[0],:] = ccf0 else: tmp[l,i,:] = numpy.sum(ccf0, axis=0) #----------------------------------------------------------------- if fullBuffer: tmp = numpy.sum(numpy.reshape(tmp,(tmp.shape[0],tmp.shape[1],tmp.shape[2]/nAvg,nAvg,tmp.shape[3])),axis=3) self.dataOut.nAvg = nAvg self.dataOut.data_cf = tmp self.dataOut.mode = mode self.dataOut.nLags = len(lags) self.dataOut.pairsList = pairsList self.dataOut.nPairs = len(pairsList) #Se Calcula los factores de Normalizacion if mode == 'time': delta = self.dataIn.ippSeconds*self.dataIn.nCohInt else: delta = self.dataIn.heightList[1] - self.dataIn.heightList[0] self.dataOut.lagRange = numpy.array(lags)*delta # self.dataOut.nCohInt = self.dataIn.nCohInt*nAvg self.dataOut.flagNoData = False # a = self.dataOut.normFactor return