|
From: <mur...@us...> - 2013-06-25 06:07:53
|
Revision: 288
http://sourceforge.net/p/python-control/code/288
Author: murrayrm
Date: 2013-06-25 06:07:45 +0000 (Tue, 25 Jun 2013)
Log Message:
-----------
updated exception handling to be python2.6+ and python3 compatible
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/margins.py
trunk/src/statesp.py
trunk/src/xferfcn.py
trunk/tests/minreal_test.py
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-06-19 01:50:10 UTC (rev 287)
+++ trunk/ChangeLog 2013-06-25 06:07:45 UTC (rev 288)
@@ -1,3 +1,10 @@
+2013-06-24 Richard Murray <mu...@al...>
+
+ * tests/minreal_test.py (TestMinreal.testMinrealBrute),
+ src/xferfcn.py (_convertToTransferFunction), src/statesp.py
+ (StateSpace.__rmul__), src/margins.py (stability_margins): changed
+ exception syntax to be python3 compatibile (works for python2.6+)
+
2013-06-10 Richard Murray <mu...@al...>
* src/xferfcn.py (TransferFunction.horner): small fix to docstring
Modified: trunk/src/margins.py
===================================================================
--- trunk/src/margins.py 2013-06-19 01:50:10 UTC (rev 287)
+++ trunk/src/margins.py 2013-06-25 06:07:45 UTC (rev 288)
@@ -127,7 +127,7 @@
sys = frdata.FRD(mag*np.exp((1j/360.)*phase), omega, smooth=True)
else:
sys = xferfcn._convertToTransferFunction(sysdata)
- except Exception, e:
+ except Exception as e:
print (e)
raise ValueError("Margin sysdata must be either a linear system or "
"a 3-sequence of mag, phase, omega.")
Modified: trunk/src/statesp.py
===================================================================
--- trunk/src/statesp.py 2013-06-19 01:50:10 UTC (rev 287)
+++ trunk/src/statesp.py 2013-06-25 06:07:45 UTC (rev 288)
@@ -351,7 +351,7 @@
D = X * self.D
return StateSpace(self.A, self.B, C, D, self.dt)
- except Exception, e:
+ except Exception as e:
print(e)
pass
raise TypeError("can't interconnect systems")
Modified: trunk/src/xferfcn.py
===================================================================
--- trunk/src/xferfcn.py 2013-06-19 01:50:10 UTC (rev 287)
+++ trunk/src/xferfcn.py 2013-06-25 06:07:45 UTC (rev 288)
@@ -1053,7 +1053,7 @@
num = [[[D[i,j]] for j in range(inputs)] for i in range(outputs)]
den = [[[1] for j in range(inputs)] for i in range(outputs)]
return TransferFunction(num, den)
- except Exception, e:
+ except Exception as e:
print("Failure to assume argument is matrix-like in"
" _convertToTransferFunction, result %s" % e)
Modified: trunk/tests/minreal_test.py
===================================================================
--- trunk/tests/minreal_test.py 2013-06-19 01:50:10 UTC (rev 287)
+++ trunk/tests/minreal_test.py 2013-06-25 06:07:45 UTC (rev 288)
@@ -53,7 +53,7 @@
self.assert_numden_almost_equal(
ht1.num[0][0], ht2.num[0][0],
ht1.den[0][0], ht2.den[0][0])
- except Exception, e:
+ except Exception as e:
# for larger systems, the tf minreal's
# the original rss, but not the balanced one
if n < 6:
|