Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
specify tolerance and add comment for markov test
  • Loading branch information
bnavigator committed Apr 1, 2021
commit a72441b9f629b0f0de03fe5a740128a4df15cc57
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)