Skip to content

Commit feb9fc9

Browse files
authored
Use standard time series convention for markov() input data (#508)
1 parent 8194b1d commit feb9fc9

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

control/modelsimp.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def era(YY, m, n, nin, nout, r):
395395
raise NotImplementedError('This function is not implemented yet.')
396396

397397

398-
def markov(Y, U, m=None, transpose=None):
398+
def markov(Y, U, m=None, transpose=False):
399399
"""Calculate the first `m` Markov parameters [D CB CAB ...]
400400
from input `U`, output `Y`.
401401
@@ -424,8 +424,7 @@ def markov(Y, U, m=None, transpose=None):
424424
Number of Markov parameters to output. Defaults to len(U).
425425
transpose : bool, optional
426426
Assume that input data is transposed relative to the standard
427-
:ref:`time-series-convention`. The default value is true for
428-
backward compatibility with legacy code.
427+
:ref:`time-series-convention`. Default value is False.
429428
430429
Returns
431430
-------
@@ -456,15 +455,6 @@ def markov(Y, U, m=None, transpose=None):
456455
>>> H = markov(Y, U, 3, transpose=False)
457456
458457
"""
459-
# Check on the specified format of the input
460-
if transpose is None:
461-
# For backwards compatibility, assume time series in rows but warn user
462-
warnings.warn(
463-
"Time-series data assumed to be in rows. This will change in a "
464-
"future release. Use `transpose=True` to preserve current "
465-
"behavior.")
466-
transpose = True
467-
468458
# Convert input parameters to 2D arrays (if they aren't already)
469459
Umat = np.array(U, ndmin=2)
470460
Ymat = np.array(Y, ndmin=2)

control/tests/modelsimp_test.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ def testMarkovSignature(self, matarrayout, matarrayin):
4444
H = markov(np.transpose(Y), np.transpose(U), m, transpose=True)
4545
np.testing.assert_array_almost_equal(H, np.transpose(Htrue))
4646

47-
# Default (in v0.8.4 and below) should be transpose=True (w/ warning)
48-
with pytest.warns(UserWarning, match="assumed to be in rows.*"
49-
"change in a future release"):
50-
# Generate Markov parameters without any arguments
51-
H = markov(np.transpose(Y), np.transpose(U), m)
52-
np.testing.assert_array_almost_equal(H, np.transpose(Htrue))
53-
47+
# Generate Markov parameters without any arguments
48+
H = markov(Y, U, m)
49+
np.testing.assert_array_almost_equal(H, Htrue)
5450

5551
# Test example from docstring
5652
T = np.linspace(0, 10, 100)
@@ -65,9 +61,8 @@ def testMarkovSignature(self, matarrayout, matarrayin):
6561

6662
# Make sure MIMO generates an error
6763
U = np.ones((2, 100)) # 2 inputs (Y unchanged, with 1 output)
68-
with pytest.warns(UserWarning):
69-
with pytest.raises(ControlMIMONotImplemented):
70-
markov(Y, U, m)
64+
with pytest.raises(ControlMIMONotImplemented):
65+
markov(Y, U, m)
7166

7267
# Make sure markov() returns the right answer
7368
@pytest.mark.parametrize("k, m, n",
@@ -108,7 +103,7 @@ def testMarkovResults(self, k, m, n):
108103
T = np.array(range(n)) * Ts
109104
U = np.cos(T) + np.sin(T/np.pi)
110105
_, Y, _ = forced_response(Hd, T, U, squeeze=True)
111-
Mcomp = markov(Y, U, m, transpose=False)
106+
Mcomp = markov(Y, U, m)
112107

113108
# Compare to results from markov()
114109
np.testing.assert_array_almost_equal(Mtrue, Mcomp)

0 commit comments

Comments
 (0)