fft
index
fft.py


Fast Fourier Transform module - wrapper for FFTPACK
 
The following functions are defined
 
  
  fft(v)      - return the complex FFT of v
  fft_inv(v)  - return the complex inverse FFT of
  
  rfft(v)     - return the real FFT of v
  rfft_inv(v) - return the real inverse FFT of v
  
These functions call methods of the following objects default_fft
and default_rfft, which are instances of FFT_CLASS and RFFT_CLASS
classes, respectively. Initialization for a particular length fft is
performed when a different size sequence v is supplied. If taking FFTs
of sequences with differing sizes, instantiate separate FFT_CLASS
objects for each size. The transforms are not normalized. To obtain a
normalized transform the output must be divided by len(v).
 
The algorithms used are:
 
N=len(v)
 
--> forward complex transform 
 
      for j=0,...,N-1
 
             c[j]=the sum from k=0,...,N-1 of
 
                   v[k]*exp(-i*j*k*2*pi/N)
 
                         where i=sqrt(-1)
 
--> inverse complex transform 
 
      for j=0,...,N-1
 
             c[j]=the sum from k=0,...,N-1 of
 
                   v[k]*exp(i*j*k*2*pi/N)
 
                         where i=sqrt(-1)
 
--> forward real transform 
 
      r[0] = the sum from n=0 to n=N-1 of v[n]
 
          if N is even set L = N/2-1   , if N is odd set L = (N-1)/2
 
            then for m = 1,...,L
 
               r[2*m-1] = the sum from n = 0 to n = N-1 of
 
                    v[n]*cos(m*n*2*pi/N)
 
               r[2*m] = the sum from n = 1 to n = N-1 of
 
                   -v[n]*sin(m*n*2*pi/N)
 
          if N is even
 
               r[N-1] = the sum from n = 0 to n = N-1 of
 
                    (-1)**(n)*v[n]
 
 
--> inverse real transform 
 
         for N even and for n = 0,...,N-1
 
               r[n] = v[0]+(-1)**(N-1)*v[N-1]
 
                    plus the sum from m=1 to m=N/2-1 of
 
                     2.*v[2*m-1]*cos(m*n*2*pi/N)
 
                    -2.*v[2*m  ]*sin(m*n*2*pi/N)
 
          for N odd and for n = 0,...,N-1
 
               r[n] = v[0] plus the sum from m=1 to m=(N-1)/2 of
 
                    2.*v[2*m-1]*cos(m*n*2*pi/N)
 
                   -2.*v[2*m  ]*sin(m*n*2*pi/N)
 
 

 
Classes
       
__builtin__.object
FFT_FLOATTYPE
FFT_FLOATTYPEPtr
FFT_FLOATTYPE
FFT_FLOATTYPEPtr
RFFT_FLOATTYPE
RFFT_FLOATTYPEPtr
RFFT_FLOATTYPE
RFFT_FLOATTYPEPtr

 
FFT = class FFT_FLOATTYPE(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_FFT_FLOATTYPE>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0xef4ef8>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
class FFT_FLOATTYPE(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_FFT_FLOATTYPE>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0xef4e18>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
class FFT_FLOATTYPEPtr(FFT_FLOATTYPE)
    
Method resolution order:
FFT_FLOATTYPEPtr
FFT_FLOATTYPE
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from FFT_FLOATTYPE:
__del__(self, destroy=<built-in function delete_FFT_FLOATTYPE>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes inherited from FFT_FLOATTYPE:
__dict__ = <dictproxy object at 0xef4de0>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'FFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
RFFT = class RFFT_FLOATTYPE(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_RFFT_FLOATTYPE>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0xef4f30>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'RFFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
class RFFT_FLOATTYPE(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_RFFT_FLOATTYPE>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0xef4be8>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'RFFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
class RFFT_FLOATTYPEPtr(RFFT_FLOATTYPE)
    
Method resolution order:
RFFT_FLOATTYPEPtr
RFFT_FLOATTYPE
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from RFFT_FLOATTYPE:
__del__(self, destroy=<built-in function delete_RFFT_FLOATTYPE>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
fft(*args)
fft_inv(*args)
resize(*args)

Data and other attributes inherited from RFFT_FLOATTYPE:
__dict__ = <dictproxy object at 0xef4da8>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'RFFT_FLOATTYPE' objects>
list of weak references to the object (if defined)

 
Functions
       
fft(*args) method of FFT_FLOATTYPE instance
fft_inv(*args) method of FFT_FLOATTYPE instance
help(...)
rfft = fft(*args) method of RFFT_FLOATTYPE instance
rfft_inv = fft_inv(*args) method of RFFT_FLOATTYPE instance

 
Data
        FALSE = 0
PI = 3.1415926535897931
TRUE = 1
__sthead_hh__ = 1
default_fft = <C CDS::FFT<(float_type)> instance at _002af30000000000_p_CDS__FFTTdouble_t>
default_rfft = <C CDS::RFFT<(float_type)> instance at _50fbf20000000000_p_CDS__RFFTTdouble_t>