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

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Nov 6 06:54:30 EST 2008


Author: cdavid
Date: 2008-11-06 05:54:13 -0600 (Thu, 06 Nov 2008)
New Revision: 4997

Added:
   trunk/scipy/signal/tests/test_filter_design.py
Log:
Add a simple test for tf2zpk.

Added: trunk/scipy/signal/tests/test_filter_design.py
===================================================================
--- trunk/scipy/signal/tests/test_filter_design.py	2008-11-05 11:18:54 UTC (rev 4996)
+++ trunk/scipy/signal/tests/test_filter_design.py	2008-11-06 11:54:13 UTC (rev 4997)
@@ -0,0 +1,21 @@
+import numpy as np
+from numpy.testing import TestCase, assert_array_almost_equal
+
+from scipy.signal import tf2zpk
+
+class TestTf2zpk(TestCase):
+    def test_simple(self):
+        z_r = np.array([0.5, -0.5])
+        p_r = np.array([1.j / np.sqrt(2), -1.j / np.sqrt(2)])
+        # Sort the zeros/poles so that we don't fail the test if the order
+        # changes
+        z_r.sort()
+        p_r.sort()
+        b = np.poly(z_r)
+        a = np.poly(p_r)
+
+        z, p, k = tf2zpk(b, a)
+        z.sort()
+        p.sort()
+        assert_array_almost_equal(z, z_r)
+        assert_array_almost_equal(p, p_r)




More information about the Scipy-svn mailing list