Merge pull request #790 from murrayrm/fix_isstatic-12Nov2022 · python-control/python-control@5180c7b
@@ -399,25 +399,6 @@ def test_freq_resp(self):
399399mag, phase, omega = sys.freqresp(true_omega)
400400np.testing.assert_almost_equal(mag, true_mag)
401401402-def test__isstatic(self):
403-A0 = np.zeros((2,2))
404-A1 = A0.copy()
405-A1[0,1] = 1.1
406-B0 = np.zeros((2,1))
407-B1 = B0.copy()
408-B1[0,0] = 1.3
409-C0 = A0
410-C1 = np.eye(2)
411-D0 = 0
412-D1 = np.ones((2,1))
413-assert StateSpace(A0, B0, C1, D1)._isstatic()
414-assert not StateSpace(A1, B0, C1, D1)._isstatic()
415-assert not StateSpace(A0, B1, C1, D1)._isstatic()
416-assert not StateSpace(A1, B1, C1, D1)._isstatic()
417-assert StateSpace(A0, B0, C0, D0)._isstatic()
418-assert StateSpace(A0, B0, C0, D1)._isstatic()
419-assert StateSpace(A0, B0, C1, D0)._isstatic()
420-421402@slycotonly
422403def test_minreal(self):
423404"""Test a minreal model reduction."""
@@ -1160,6 +1141,20 @@ def test_linfnorm_ct_mimo(self, ct_siso):
11601141np.testing.assert_allclose(fpeak, reffpeak)
11611142116211431144+@pytest.mark.parametrize("args, static", [
1145+ (([], [], [], 1), True), # ctime, empty state
1146+ (([], [], [], 1, 1), True), # dtime, empty state
1147+ ((0, 0, 0, 1), False), # ctime, unused state
1148+ ((-1, 0, 0, 1), False), # ctime, exponential decay
1149+ ((-1, 0, 0, 0), False), # ctime, no input, no output
1150+ ((0, 0, 0, 1, 1), False), # dtime, integrator
1151+ ((1, 0, 0, 1, 1), False), # dtime, unused state
1152+ ((0, 0, 0, 1, None), False), # unspecified, unused state
1153+])
1154+def test_isstatic(args, static):
1155+sys = ct.StateSpace(*args)
1156+assert sys._isstatic() == static
1157+11631158# Make sure that using params for StateSpace objects generates a warning
11641159def test_params_warning():
11651160sys = StateSpace(-1, 1, 1, 0)
@@ -1169,4 +1164,3 @@ def test_params_warning():
1169116411701165with pytest.warns(UserWarning, match="params keyword ignored"):
11711166sys.output(0, [0], [0], {'k': 5})
1172-