[SciPy-user] scipy.basic to numpy

Rob Managan managan at llnl.gov
Thu Jan 5 17:03:33 CST 2006


At 3:24 PM -0600 1/5/06, Pearu Peterson wrote:
>On Thu, 5 Jan 2006, Rob Managan wrote:
>
>>  Sorry for being unclear. I was referencing the numpy.dft.fft function
>>  to show that it works but the fftpack version in scipy does not.
>>
>>  The problem is in scipy not numpy.
>
>I tried building scipy.fftpack against fftw-2.1.3, fftw-3.0.1, and fortran
>fftpack. In all cases scipy.fftpack.test() finishes without failures on
>debian box, both on 32 and 64-bit boxes.
>
>Could you try building scipy without fftw support? For that
>set
>
>   export FFTW=None
>
>and rebuild scipy.
>

here are the results with the first two failures.

[mangrove:~/Documents/devel/scipy] managan% python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import scipy
>>>  scipy.show_config()
dfftw_info:
   NOT AVAILABLE

blas_opt_info:
     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
     extra_compile_args = ['-faltivec', 
'-I/System/Library/Frameworks/vecLib.framework/Head
ers']
     define_macros = [('NO_ATLAS_INFO', 3)]

djbfft_info:
   NOT AVAILABLE

lapack_opt_info:
     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
     extra_compile_args = ['-faltivec']
     define_macros = [('NO_ATLAS_INFO', 3)]

fftw_info:
   NOT AVAILABLE

>>>  scipy.fftpack.test()
   Found 18 tests for scipy.fftpack.basic
   Found 4 tests for scipy.fftpack.helper
   Found 20 tests for scipy.fftpack.pseudo_diffs
   Found 0 tests for __main__
F...F..F..FF.F........F.........F.....F.F.
======================================================================
FAIL: check_definition (scipy.fftpack.basic.test_basic.test_fft)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/Users/managan/Documents/local/lib/python2.4/site-packages/scipy/fftpack/tests/tes
t_basic.py", line 98, in check_definition
     assert_array_almost_equal(y,y1)
   File 
"/Users/managan/Documents/local/lib/python2.4/site-packages/numpy/testing/utils.py"
, line 182, in assert_array_almost_equal
     assert cond,\
AssertionError:
Arrays are not almost equal (mismatch 100.0%):
         Array 1: [ 20.+0.j   0.+0.j  -4.+4.j   0.+0.j  -4.+0.j 
0.-0.j  -4.-4.j   0.-0.j]
         Array 2: [ 20.       +3.j         -0.7071068+0.7071068j  -7.       +4.j
   -0.7071068-0.7071068j  -4.       -3.j          0.707106...


======================================================================
FAIL: check_definition (scipy.fftpack.basic.test_basic.test_fftn)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/Users/managan/Documents/local/lib/python2.4/site-packages/scipy/fftpack/tests/tes
t_basic.py", line 425, in check_definition
     assert_array_almost_equal(y,direct_dftn(x))
   File 
"/Users/managan/Documents/local/lib/python2.4/site-packages/numpy/testing/utils.py"
, line 182, in assert_array_almost_equal
     assert cond,\
AssertionError:
Arrays are not almost equal (mismatch 22.2222222222%):
         Array 1: [[ 45. +0.j         -4.5+2.5980762j  -4.5-2.5980762j]
  [-13.5+7.7942286j   0. +0.j          0. +0.j       ]
  [-13.5-7.79...
         Array 2: [[ 45. +0.j         -4.5+2.5980762j  -4.5-2.5980762j]
  [-13.5+0.j          0. +0.j          0. -0.j       ]
  [-13.5+0.j ...

My simple test
import numpy
import scipy

x = numpy.arange(16)*2*numpy.pi/16.0
sx = numpy.sin(x)
print 'sx'
print sx
print 'scipy.ifft(scipy.fft(sx)).real'
print scipy.ifft(scipy.fft(sx)).real
print 'numpy.ifft(numpy.fft(sx)).real'
print numpy.ifft(numpy.fft(sx)).real

gives

[mangrove:~/Documents/devel/scipy] managan% python fft3.py
sx
[  0.00000000e+00   3.82683432e-01   7.07106781e-01   9.23879533e-01
    1.00000000e+00   9.23879533e-01   7.07106781e-01   3.82683432e-01
    1.22464680e-16  -3.82683432e-01  -7.07106781e-01  -9.23879533e-01
   -1.00000000e+00  -9.23879533e-01  -7.07106781e-01  -3.82683432e-01]
scipy.ifft(scipy.fft(sx)).real
[  0.00000000e+00  -3.11858849e-16  -1.13434883e-16   5.44139747e-17
    0.00000000e+00   1.12119479e-16   1.68946034e-16   1.17569819e-16
    1.22464680e-16   1.17569819e-16   1.68946034e-16   1.12119479e-16
    0.00000000e+00   5.44139747e-17  -1.13434883e-16  -3.11858849e-16]
numpy.ifft(numpy.fft(sx)).real
[  6.16297582e-32   3.82683432e-01   7.07106781e-01   9.23879533e-01
    1.00000000e+00   9.23879533e-01   7.07106781e-01   3.82683432e-01
    1.22464680e-16  -3.82683432e-01  -7.07106781e-01  -9.23879533e-01
   -1.00000000e+00  -9.23879533e-01  -7.07106781e-01  -3.82683432e-01]

-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Rob Managan               email managan at llnl.gov
LLNL                      phone: 925-423-0903
P.O. Box 808, L-095       FAX:   925-422-3389
Livermore, CA  94551-0808



More information about the SciPy-user mailing list