[Scipy-svn] r4520 - in trunk/scipy/fftpack: . tests
scipy-svn@scip...
scipy-svn@scip...
Wed Jul 2 03:08:53 CDT 2008
Author: cdavid
Date: 2008-07-02 03:08:20 -0500 (Wed, 02 Jul 2008)
New Revision: 4520
Modified:
trunk/scipy/fftpack/basic.py
trunk/scipy/fftpack/tests/test_basic.py
Log:
Forbid shape and axes to be of different lengths for fftn.
Modified: trunk/scipy/fftpack/basic.py
===================================================================
--- trunk/scipy/fftpack/basic.py 2008-07-02 07:40:52 UTC (rev 4519)
+++ trunk/scipy/fftpack/basic.py 2008-07-02 08:08:20 UTC (rev 4520)
@@ -229,6 +229,12 @@
s = x.shape
else:
s = tuple(s)
+ if axes is None:
+ axes = range(len(s))
+ elif not len(axes) == len(s):
+ raise ValueError("when given, axes and shape arguments "\
+ "have to be of the same length")
+
if len(s) > len(x.shape):
raise ValueError("shape cannot be longer than x shape.")
for i in range(-len(s),0):
Modified: trunk/scipy/fftpack/tests/test_basic.py
===================================================================
--- trunk/scipy/fftpack/tests/test_basic.py 2008-07-02 07:40:52 UTC (rev 4519)
+++ trunk/scipy/fftpack/tests/test_basic.py 2008-07-02 08:08:20 UTC (rev 4520)
@@ -346,12 +346,13 @@
[4,5,6,0],
[7,8,9,0],
[0,0,0,0]])
- y = fftn(small_x,shape=(4,4),axes=(-1,))
- for i in range(4):
- assert_array_almost_equal (y[i],fft(large_x1[i]))
- y = fftn(small_x,shape=(4,4),axes=(-2,))
- for i in range(4):
- assert_array_almost_equal (y[:,i],fft(large_x1[:,i]))
+ # Disable tests with shape and axes of different lengths
+ #y = fftn(small_x,shape=(4,4),axes=(-1,))
+ #for i in range(4):
+ # assert_array_almost_equal (y[i],fft(large_x1[i]))
+ #y = fftn(small_x,shape=(4,4),axes=(-2,))
+ #for i in range(4):
+ # assert_array_almost_equal (y[:,i],fft(large_x1[:,i]))
y = fftn(small_x,shape=(4,4),axes=(-2,-1))
assert_array_almost_equal (y,fftn(large_x1))
y = fftn(small_x,shape=(4,4),axes=(-1,-2))
More information about the Scipy-svn
mailing list