[Scipy-svn] r5356 - trunk/scipy/fftpack/tests

scipy-svn@scip... scipy-svn@scip...
Wed Jan 7 08:50:01 CST 2009


Author: cdavid
Date: 2009-01-07 08:49:46 -0600 (Wed, 07 Jan 2009)
New Revision: 5356

Modified:
   trunk/scipy/fftpack/tests/test_basic.py
Log:
Add single prec test for rfft.

Modified: trunk/scipy/fftpack/tests/test_basic.py
===================================================================
--- trunk/scipy/fftpack/tests/test_basic.py	2009-01-07 14:49:15 UTC (rev 5355)
+++ trunk/scipy/fftpack/tests/test_basic.py	2009-01-07 14:49:46 UTC (rev 5356)
@@ -228,17 +228,16 @@
         pass
 
 
-class TestRfft(TestCase):
+class _TestRFFTBase(TestCase):
 
     def test_definition(self):
-        x = [1,2,3,4,1,2,3,4]
-        y = rfft(x)
-        y1 = direct_rdft(x)
-        assert_array_almost_equal(y,y1)
-        x = [1,2,3,4,1,2,3,4,5]
-        y = rfft(x)
-        y1 = direct_rdft(x)
-        assert_array_almost_equal(y,y1)
+        for t in [[1, 2, 3, 4, 1, 2, 3, 4], [1, 2, 3, 4, 1, 2, 3, 4, 5]]:
+            x = np.array([1,2,3,4,1,2,3,4], dtype=self.rdt)
+            y = rfft(x)
+            y1 = direct_rdft(x)
+            assert_array_almost_equal(y,y1)
+            self.failUnless(y1.dtype == self.rdt,
+                    "Output dtype is %s, expected %s" % (y1.dtype, self.rdt))
 
     def test_djbfft(self):
         from numpy.fft import fft as numpy_fft
@@ -255,7 +254,16 @@
             y = fftpack.drfft(x)
             assert_array_almost_equal(y,y1)
 
+class TestRFFTDouble(_TestRFFTBase):
+    def setUp(self):
+        self.cdt = np.cdouble
+        self.rdt = np.double
 
+class TestRFFTSingle(_TestRFFTBase):
+    def setUp(self):
+        self.cdt = np.complex64
+        self.rdt = np.float32
+
 class TestIrfft(TestCase):
 
     def test_definition(self):



More information about the Scipy-svn mailing list