[Scipy-svn] r4076 - trunk/scipy/signal/tests

scipy-svn@scip... scipy-svn@scip...
Thu Apr 3 02:18:25 CDT 2008


Author: stefan
Date: 2008-04-03 02:18:15 -0500 (Thu, 03 Apr 2008)
New Revision: 4076

Modified:
   trunk/scipy/signal/tests/test_wavelets.py
Log:
Add tests for Morlet wavelet [contributed by Christoph Weidemann].


Modified: trunk/scipy/signal/tests/test_wavelets.py
===================================================================
--- trunk/scipy/signal/tests/test_wavelets.py	2008-04-03 01:17:38 UTC (rev 4075)
+++ trunk/scipy/signal/tests/test_wavelets.py	2008-04-03 07:18:15 UTC (rev 4076)
@@ -24,11 +24,56 @@
     def test_morlet(self):
         x = wavelets.morlet(50,4.1,complete=True)
         y = wavelets.morlet(50,4.1,complete=False)
+        # Test if complete and incomplete wavelet have same lengths:
         assert_equal(len(x),len(y))
+        # Test if complete wavelet is less than incomplete wavelet:
+        assert_array_less(x,y)
 
         x = wavelets.morlet(10,50,complete=False)
         y = wavelets.morlet(10,50,complete=True)
+        # For large widths complete and incomplete wavelets should be
+        # identical within numerical precision:
         assert_equal(x,y)
 
+        # miscellaneous tests:
+        x = N.array([1.73752399e-09 +9.84327394e-25j,
+                     6.49471756e-01 +0.00000000e+00j,
+                     1.73752399e-09 -9.84327394e-25j])
+        y = wavelets.morlet(3,w=2,complete=True)
+        assert_array_almost_equal(x,y)
+
+        x = N.array([2.00947715e-09 +9.84327394e-25j,
+                     7.51125544e-01 +0.00000000e+00j,
+                     2.00947715e-09 -9.84327394e-25j])
+        y = wavelets.morlet(3,w=2,complete=False)
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,s=4,complete=True)
+        y = wavelets.morlet(20000,s=8,complete=True)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,s=4,complete=False)
+        assert_array_almost_equal(y,x,decimal=2)
+        y = wavelets.morlet(20000,s=8,complete=False)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,w=3,s=5,complete=True)
+        y = wavelets.morlet(20000,w=3,s=10,complete=True)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,w=3,s=5,complete=False)
+        assert_array_almost_equal(y,x,decimal=2)
+        y = wavelets.morlet(20000,w=3,s=10,complete=False)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,w=7,s=10,complete=True)
+        y = wavelets.morlet(20000,w=7,s=20,complete=True)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
+        x = wavelets.morlet(10000,w=7,s=10,complete=False)
+        assert_array_almost_equal(x,y,decimal=2)
+        y = wavelets.morlet(20000,w=7,s=20,complete=False)[5000:15000]
+        assert_array_almost_equal(x,y,decimal=2)
+
 if __name__ == "__main__":
     nose.run(argv=['', __file__])



More information about the Scipy-svn mailing list