[SciPy-user] FFTW use

Charrett, Thomas t.charrett at Cranfield.ac.uk
Tue Mar 11 12:58:02 EDT 2008


Hello,
 
I'm fairly new to using python, having converted from matlab and I have some questions concerning the FFT functions in scipy.fftpack. 
 
I have some matlab code which calculates the fft of an image (2d array) before carrying out some processing and then doing the inverse transform. However the same code converted to Python gives a different result. I've been trying to track down the problem and it appears that the problem occurs when calculate the fft, with matlab calculating slightly different values than scipy. 
 
I've have tried to build scipy to use the FFTW library that Matlab uses and think I have succeeded (scipy.show_config() says fftw3 is available). Does fft2 and fftn automatically use FFTW when installed? If not how would I set this? Are the functions in scipy.fftpack the correct ones? - I have seen post suggesting scipy.fftw which doesn't appear to exist.
 
Also I say I've tried to build scipy with FFTW as the instructions for windows are unclear and it took my a while to get it working - could someone post some instructions on the correct way to compile scipy with FFTW. 
 
I used MinGW and MSYS to compile FFTW  using the configure and make files, copied libfftw3.a and fftw3.h to a new folder. Downloaded the prebuilt atlas version from the scipy webpage and used the following in my site.cfg file:
 
[atlas]
library_dirs = C:\build\atlas3.6.0_WinNT_P3
atlas_libs = lapack, f77blas, cblas, atlas
[fftw3]
library_dirs = [path to fftw files]
include_dirs = [path to fftw libs]
libraries = fftw3
 
I then ran and installed the result using
 
python setup.py config --compiler=mingw32 build --compiler=mingw32 bdist_wininst
 
When I import scipy, scipy.test() crashed but the fftpack.test() works fine, However my fft results look exactly the same am I actually using FFTW?
 
Any help greatly appreciated, I'd really like to ditch matlab completely.
 
Tom
 
 



More information about the SciPy-User mailing list