Beispiel #1
0
    def createWaveform(self, scale , binIndex):        
        ''' By default, will use the C library to create the waveform'''
        if self.useC:
            return parallelProjections.get_atom(int(scale) , int(binIndex))

        else:
            L = scale
            # Check whether coefficients are initialized
            if not scale in self.Windows:
                self.initialize(scale)
            K = L/2
            temp = zeros(2*L)
            temp[K + binIndex] = 1
            waveform = zeros(2*L)
    
            y = zeros(L, complex)
            x = zeros(L, complex)
            # we're note in Matlab anymore, loops are more straight than indexing
            for i in range(1,3):
                y[0:K] = temp[i*K : (i+1)*K]
    #
                # do the pre-twiddle 
                y = y *  self.PreTwidCoeffs[L];
    #            self.fftinputs[L] = y;
                
                # compute ifft
    #            self.fftplans[L].execute()
    #            x = self.fftoutputs[L];
                x = ifft(y)
    #
    #            # do the post-twiddle 
                x = x * self.PostTwidCoeff[L]
    #
                x = 2*math.sqrt(1/float(L))*L*x.real*self.Windows[L];  
    
    #            self.fftinputs[L][0:K] += temp[i*K : (i+1)*K]*self.PreTwidCoeffs[L]
                
                #compute fft
                
         
    #            # post-twiddle and store for max search          
    #            self.projectionMatrix[i*K : (i+1)*K] = normaCoeffs*(self.inputa[0:K]* self.post_twidVec).real
    
                # overlapp - add
    #            waveform[i*K : i*K +L] = waveform[i*K : i*K +L] + \
    #                     2*math.sqrt(1/float(L))*L*(self.fftoutputs[L]*self.PostTwidCoeff[L]).real*self.Windows[L] ;
                waveform[i*K : i*K +L] = waveform[i*K : i*K +L] +  x ;
    
            # scrap zeroes on the borders    
            return waveform[L/2:-L/2]
Beispiel #2
0
 def create_waveform(self, scale, binIndex):
     ''' By default, will use the C library to create the waveform'''
     if self.use_c_optim:
         return parallelProjections.get_atom(int(scale), int(binIndex))