def computeTransform(self, startingFrame=1 , endFrame = -1): if self.wLong is None: self.initialize() # due to later time-shift optimizations , need to ensure nothing is selected too close to the borders!! if endFrame <0 or endFrame>self.frameNumber -3: endFrame = self.frameNumber -3 if startingFrame<2: startingFrame = 2 # new version: C binding if self.useC: parallelProjections.project_mclt(self.enframedDataMatrix, self.bestScoreTree, self.projectionMatrix , self.locCoeff , self.post_twidVec , startingFrame, endFrame, self.scale ) else: L = self.scale K = L/2 T = K/2 normaCoeffs = sqrt(2/float(K)) locenframedDataMat = self.enframedDataMatrix # locfftMat = self.fftMat # locprojMat = self.projectionMatrix preTwidCoeff = self.locCoeff postTwidCoeff = self.post_twidVec # Bottleneck here !! need to fasten this loop : do it by Matrix technique? or bind to a C++ file? for i in range(startingFrame , endFrame): x = locenframedDataMat[i*K - T: i*K + L - T] if len(x) !=L: x =zeros(L , complex) # do the pre-twiddle x = x * preTwidCoeff # compute fft # locfftMat[: , i] = fft(x , L) # post-twiddle # y = locfftMat[0:K , i] * postTwidCoeff y = (fft(x , L)[0:K]) * postTwidCoeff # y = self.doPretwid(locfftMat[0:K , i], postTwidCoeff) # we work with MCLT now self.projectionMatrix[i*K : (i+1)*K] = normaCoeffs*y # store new max score in tree self.bestScoreTree[i] = abs(self.projectionMatrix[i*K : (i+1)*K]).max()
print " ---Testing good call" parallelProjections.project(input_data, scoreTree, projectionMatrix_real, pre_twidVec, post_twidVec, i, j, L, 0) # if parallelFFT.clean_plans() != 1: # print "Cleaning Stage Failed" ### ##print projectionMatrix_real print scoreTree print "--- OK" # # # if computeMCLT.initialize_plans(np.array([L])) != 1: # print "Initiliazing Stage Failed" print "---Testing good call: complex" res = parallelProjections.project_mclt(input_data, scoreTree, projectionMatrix_comp, pre_twidVec, post_twidVec, i, j, L) print scoreTree if res is not None: print "--- Ok" else: print "ERROR" # print "---Testing good call: complex set" res = parallelProjections.project_mclt_set( input_data, scoreTree, projectionMatrix_comp, pre_twidVec, post_twidVec, i, j, L, 1 ) if res is not None: print "--- Ok" else: print "ERRRORRRR"