[SciPy-dev] fftpack2 for review

Travis Oliphant oliphant.travis at ieee.org
Fri Oct 4 15:02:08 CDT 2002


I finally had some time to test fftpack2.  It looks really great and I'm
happy to support including it.   I'll attach my test results at the end
(with fftw and djbfft).

My only comment right now, is that I don't like doing away with the word
fftshift.  This is a common command in MATLAB and is quite familiar.  I
don't necessarily mind freqshift,


> >   Also freqshift puts the Nyquist component at the end of the result
> >   while fftshift puts it at the beginning of the result. This is for
> >   the consistency among varios functions in the fftpack module.

Is there a difference between freqshift and fftshift?  If so, then I am
not satisfied.  I took great pains to ensure that fftshift works exactly
the same way as in MATLAB.

It is important that the common fft operations present a single
interface to the user.  If we want to offer specialized functions that
do not mess with the ordering but expect the user to know what they are
doing, that is fine, as long as the default functions follow the basic
pattern.

I think that the MATLAB convention should be followed here.

-Travis


Results of testing:


...................
                 Fast Fourier Transform
========================================================
      |       real input       |       complex input
--------------------------------------------------------
 size |fftpack2|  FFT  | scipy |fftpack2|  FFT  | scipy
--------------------------------------------------------
  100 |   0.31 |  0.27 |  0.27 |   0.32 |  0.28 |  0.27  (secs for 7000
calls)
 1000 |   0.23 |  0.32 |  0.30 |   0.30 |  0.32 |  0.30  (secs for 2000
calls)
  256 |   0.47 |  0.50 |  0.48 |   0.57 |  0.47 |  0.48  (secs for 10000
calls)   512 |   0.61 |  0.82 |  0.78 |   0.79 |  0.82 |  0.76  (secs
for 10000 calls)  1024 |   0.09 |  0.16 |  0.12 |   0.13 |  0.15 | 
0.12  (secs for 1000 calls)
 2048 |   0.16 |  0.27 |  0.25 |   0.26 |  0.27 |  0.31  (secs for 1000
calls)
 4096 |   0.15 |  0.43 |  0.39 |   0.30 |  0.44 |  0.41  (secs for 500
calls)
 8192 |   0.60 |  2.53 |  2.54 |   1.45 |  2.71 |  2.57  (secs for 500
calls)
.
          Inverse Fast Fourier Transform
========================================================
      |       real input       |        complex input
--------------------------------------------------------
 size |fftpack2|  FFT  | scipy |fftpack2|  FFT  | scipy
--------------------------------------------------------
  100 |   0.31 |  0.68 |  0.70 |   0.34 |  0.71 |  0.69  (secs for 7000
calls)
 1000 |   0.25 |  0.76 |  0.74 |   0.39 |  0.78 |  0.76  (secs for 2000
calls)
  256 |   0.51 |  1.28 |  1.29 |   0.58 |  1.29 |  1.32  (secs for 10000
calls)   512 |   0.67 |  2.03 |  1.98 |   0.81 |  2.09 |  2.04  (secs
for 10000 calls)  1024 |   0.10 |  0.36 |  0.34 |   0.14 |  0.36 | 
0.33  (secs for 1000 calls)
 2048 |   0.18 |  0.69 |  0.70 |   0.25 |  0.72 |  0.73  (secs for 1000
calls)
 4096 |   0.19 |  1.13 |  1.14 |   0.32 |  1.20 |  1.21  (secs for 500
calls)
 8192 |   0.80 |  3.82 |  3.80 |   1.56 |  4.05 |  3.88  (secs for 500
calls)
.
      Multi-dimensional Fast Fourier Transform
========================================================
          |       real input       |       complex input
--------------------------------------------------------
   size   |fftpack2|  FFT  | scipy |fftpack2|  FFT  | scipy
--------------------------------------------------------
  100x100 |   0.20 |  0.45 |  0.35 |   0.25 |  0.47 |  0.45  (secs for
100 calls)
 1000x100 |   0.27 |  0.47 |  0.38 |   0.28 |  0.43 |  0.43  (secs for 7
calls)   256x256 |   0.61 |  0.46 |  0.49 |   0.63 |  0.47 |  0.45 
(secs for 10 calls)  512x512 |   0.77 |  0.60 |  0.65 |   0.80 |  0.66
|  0.62  (secs for 3 calls) .
Fast Fourier Transform (real data)
==================================
 size |fftpack2|  FFT  | scipy
----------------------------------
  100 |   0.30 |  0.36 |  0.37  (secs for 7000 calls)
 1000 |   0.22 |  0.26 |  0.23  (secs for 2000 calls)
  256 |   0.44 |  0.58 |  0.62  (secs for 10000 calls)
  512 |   0.57 |  0.79 |  0.84  (secs for 10000 calls)
 1024 |   0.09 |  0.12 |  0.12  (secs for 1000 calls)
 2048 |   0.13 |  0.19 |  0.21  (secs for 1000 calls)
 4096 |   0.13 |  0.20 |  0.19  (secs for 500 calls)
 8192 |   0.40 |  0.82 |  0.81  (secs for 500 calls)
.
Inverse Fast Fourier Transform (real data)
==================================
 size |fftpack2|  FFT  | scipy
----------------------------------
  100 |   0.29 |  0.80 |  0.77  (secs for 7000 calls)
 1000 |   0.23 |  0.46 |  0.45  (secs for 2000 calls)
  256 |   0.45 |  1.23 |  1.22  (secs for 10000 calls)
  512 |   0.59 |  1.47 |  1.46  (secs for 10000 calls)
 1024 |   0.08 |  0.21 |  0.20  (secs for 1000 calls)
 2048 |   0.15 |  0.30 |  0.33  (secs for 1000 calls)
 4096 |   0.13 |  0.36 |  0.38  (secs for 500 calls)
 8192 |   0.40 |  1.28 |  1.50  (secs for 500 calls)
.
----------------------------------------------------------------------
Ran 24 tests in 298.302s

OK
[travis at travis fftpack2-0.1]$ python tests/test_helper.py 10
....
----------------------------------------------------------------------
Ran 4 tests in 0.013s

OK
[travis at travis fftpack2-0.1]$ python tests/test_pseudo_diffs.py 10
....................
 Shifting periodic functions
==============================
 size  | optimized |    naive
------------------------------
   100 |      0.07 |      0.44  (secs for 1500 calls)
  1000 |      0.05 |      0.50  (secs for 300 calls)
   256 |      0.08 |      0.76  (secs for 1500 calls)
   512 |      0.07 |      0.85  (secs for 1000 calls)
  1024 |      0.06 |      0.80  (secs for 500 calls)
  2048 |      0.05 |      0.74  (secs for 200 calls)
  4096 |      0.04 |      0.81  (secs for 100 calls)
  8192 |      0.11 |      0.90  (secs for 50 calls)
.
Differentiation of periodic functions
=====================================
 size  |  convolve |    naive
-------------------------------------
   100 |      0.14 |      0.59  (secs for 1500 calls)
  1000 |      0.05 |      0.65  (secs for 300 calls)
   256 |      0.09 |      0.92  (secs for 1500 calls)
   512 |      0.07 |      1.12  (secs for 1000 calls)
  1024 |      0.06 |      1.06  (secs for 500 calls)
  2048 |      0.04 |      0.93  (secs for 200 calls)
  4096 |      0.05 |      0.98  (secs for 100 calls)
  8192 |      0.08 |      1.10  (secs for 50 calls)
.
 Tilbert transform of periodic functions
=========================================
 size  | optimized |    naive
-----------------------------------------
   100 |      0.08 |      0.48  (secs for 1500 calls)
  1000 |      0.04 |      0.41  (secs for 300 calls)
   256 |      0.09 |      0.69  (secs for 1500 calls)
   512 |      0.06 |      0.70  (secs for 1000 calls)
  1024 |      0.06 |      0.67  (secs for 500 calls)
  2048 |      0.04 |      0.64  (secs for 200 calls)
  4096 |      0.04 |      0.66  (secs for 100 calls)
  8192 |      0.06 |      0.72  (secs for 50 calls)
.
 Hilbert transform of periodic functions
=========================================
 size  | optimized |    naive
-----------------------------------------
   100 |      0.07 |      0.42  (secs for 1500 calls)
  1000 |      0.04 |      0.36  (secs for 300 calls)
   256 |      0.08 |      0.61  (secs for 1500 calls)
   512 |      0.07 |      0.62  (secs for 1000 calls)
  1024 |      0.05 |      0.58  (secs for 500 calls)
  2048 |      0.03 |      0.53  (secs for 200 calls)
  4096 |      0.05 |      0.63  (secs for 100 calls)
  8192 |      0.06 |      0.72  (secs for 50 calls)
.
----------------------------------------------------------------------
Ran 24 tests in 62.302s

OK






More information about the Scipy-dev mailing list