Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve forced_response and its documentation #588

Merged
merged 12 commits into from
Apr 2, 2021
10 changes: 5 additions & 5 deletions control/tests/modelsimp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ def testMarkovSignature(self, matarrayout, matarrayin):
markov(Y, U, m)

# Make sure markov() returns the right answer
# forced response can return wrong shape until gh-488 is merged
@pytest.mark.xfail
@pytest.mark.parametrize("k, m, n",
[(2, 2, 2),
(2, 5, 5),
Expand All @@ -81,7 +79,7 @@ def testMarkovResults(self, k, m, n):
# m = number of Markov parameters
# n = size of the data vector
#
# Values should match exactly for n = m, otherewise you get a
# Values *should* match exactly for n = m, otherewise you get a
# close match but errors due to the assumption that C A^k B =
# 0 for k > m-2 (see modelsimp.py).
#
Expand All @@ -108,7 +106,10 @@ def testMarkovResults(self, k, m, n):
Mcomp = markov(Y, U, m)

# Compare to results from markov()
np.testing.assert_array_almost_equal(Mtrue, Mcomp)
# experimentally determined probability to get non matching results
# with rtot=1e-6 and atol=1e-8 due to numerical errors
# for k=5, m=n=10: 0.015 %
np.testing.assert_allclose(Mtrue, Mcomp, rtol=1e-6, atol=1e-8)

def testModredMatchDC(self, matarrayin):
#balanced realization computed in matlab for the transfer function:
Expand Down Expand Up @@ -219,4 +220,3 @@ def testBalredMatchDC(self, matarrayin):
np.testing.assert_array_almost_equal(rsys.B, Brtrue, decimal=4)
np.testing.assert_array_almost_equal(rsys.C, Crtrue, decimal=4)
np.testing.assert_array_almost_equal(rsys.D, Drtrue, decimal=4)