[Scipy-svn] r6219 - in trunk/scipy/signal: . tests

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Feb 8 08:18:36 EST 2010


Author: stefan
Date: 2010-02-08 07:18:36 -0600 (Mon, 08 Feb 2010)
New Revision: 6219

Added:
   trunk/scipy/signal/tests/test_ltisys.py
Modified:
   trunk/scipy/signal/ltisys.py
Log:
BUG: Remove syntax error in little used branch of ss2tf.

Modified: trunk/scipy/signal/ltisys.py
===================================================================
--- trunk/scipy/signal/ltisys.py	2010-02-08 09:46:08 UTC (rev 6218)
+++ trunk/scipy/signal/ltisys.py	2010-02-08 13:18:36 UTC (rev 6219)
@@ -136,13 +136,15 @@
     if D.shape[-1] != 0:
         D = D[:,input]
 
-    den = poly(A)
+    try:
+        den = poly(A)
+    except ValueError:
+        den = 1
 
     if (product(B.shape,axis=0) == 0) and (product(C.shape,axis=0) == 0):
         num = numpy.ravel(D)
         if (product(D.shape,axis=0) == 0) and (product(A.shape,axis=0) == 0):
             den = []
-        end
         return num, den
 
     num_states = A.shape[0]

Added: trunk/scipy/signal/tests/test_ltisys.py
===================================================================
--- trunk/scipy/signal/tests/test_ltisys.py	                        (rev 0)
+++ trunk/scipy/signal/tests/test_ltisys.py	2010-02-08 13:18:36 UTC (rev 6219)
@@ -0,0 +1,21 @@
+import numpy as np
+from numpy.testing import *
+
+from scipy.signal.ltisys import ss2tf
+
+class TestSS2TF:
+    def tst_matrix_shapes(self, p, q, r):
+        ss2tf(np.zeros((p, p)),
+              np.zeros((p, q)),
+              np.zeros((r, p)),
+              np.zeros((r, q)), 0)
+
+    def test_basic(self):
+        for p, q, r in [
+            (3, 3, 3),
+            (0, 3, 3),
+            (1, 1, 1)]:
+            yield self.tst_matrix_shapes, p, q, r
+
+if __name__ == "__main__":
+    run_module_suite()




More information about the Scipy-svn mailing list