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)
 
 
 
 
# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.

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

 
class CDSVector_DComplex(__builtin__.object)
   
 

 
  Methods defined here:
__add__(*args)

 
__del__(self, destroy=<built-in function delete_CDSVector_DComplex>)

 
__div__(*args)

 
__getattr__ lambda self, name

 
__getitem__(*args)

 
__getslice__(*args)

 
__iadd__(*args)

 
__idiv__(*args)

 
__imul__(*args)

 
__init__(self, *args)

 
__isub__(*args)

 
__len__(*args)

 
__mul__(*args)

 
__neg__(*args)

 
__pow__(*args)

 
__repr__(self)

 
__rmul__(*args)

 
__setattr__ lambda self, name, value

 
__setitem__(*args)

 
__str__(*args)

 
__sub__(*args)

 
fromList(s, l)

 
help(*args)

 
resize(*args)

 
scale(*args)

 
set(*args)

 

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x25487c0>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'CDSVector_DComplex' objects>

 
list of weak references to the object (if defined)

 
class CDSVector_DComplexPtr(CDSVector_DComplex)
   
 

 
 
Method resolution order:
CDSVector_DComplexPtr
CDSVector_DComplex
__builtin__.object

Methods defined here:
__init__(self, this)

 

Methods inherited from CDSVector_DComplex:
__add__(*args)

 
__del__(self, destroy=<built-in function delete_CDSVector_DComplex>)

 
__div__(*args)

 
__getattr__ lambda self, name

 
__getitem__(*args)

 
__getslice__(*args)

 
__iadd__(*args)

 
__idiv__(*args)

 
__imul__(*args)

 
__isub__(*args)

 
__len__(*args)

 
__mul__(*args)

 
__neg__(*args)

 
__pow__(*args)

 
__repr__(self)

 
__rmul__(*args)

 
__setattr__ lambda self, name, value

 
__setitem__(*args)

 
__str__(*args)

 
__sub__(*args)

 
fromList(s, l)

 
help(*args)

 
resize(*args)

 
scale(*args)

 
set(*args)

 

Data and other attributes inherited from CDSVector_DComplex:
__dict__ = <dictproxy object at 0x2548750>

 
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'CDSVector_DComplex' objects>

 
list of weak references to the object (if defined)

 
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 0x25489f0>

 
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 0x25488d8>

 
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 0x2548a98>

 
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 0x25484e8>

 
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 0x25488a0>

 
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 0x2548980>

 
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
       
cat(...)

 
cat3(...)

 
cat4(...)

 
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

 
sum(...)

 

 
Data
        FALSE = 0
PI = 3.1415926535897931
TRUE = 1
__package__ = None
__sthead_hh__ = 1
default_fft = <C CDS::FFT<(float_type)> instance at _905f050200000000_p_CDS__FFTTdouble_t>
default_rfft = <C CDS::RFFT<(float_type)> instance at _f030530200000000_p_CDS__RFFTTdouble_t>
pyXplorHelp = Type help() for interactive help, or help(object) for help about object.