Skip to content

Commit af4fa21

Browse files
committed
remove MATLAB-style matrix constructor from string
1 parent 71bbce2 commit af4fa21

4 files changed

Lines changed: 4 additions & 18 deletions

File tree

control/matlab/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def bode(*args, **kwargs):
4848
--------
4949
>>> from control.matlab import ss, bode
5050
51-
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
51+
>>> sys = ss([[1, -2], [3, -4]], [[5], [7]], [[6, 8]], 9)
5252
>>> mag, phase, omega = bode(sys)
5353
5454
.. todo::

control/statesp.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,8 @@ def _ssmatrix(data, axis=1):
105105
106106
"""
107107
# Convert the data into an array or matrix, as configured
108-
# If data is passed as a string, use (deprecated?) matrix constructor
109108
if config.defaults['statesp.use_numpy_matrix']:
110109
arr = np.matrix(data, dtype=float)
111-
elif isinstance(data, str):
112-
arr = np.array(np.matrix(data, dtype=float))
113110
else:
114111
arr = np.array(data, dtype=float)
115112
ndim = arr.ndim

control/tests/statesp_test.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,6 @@ def test_copy_constructor_nodt(self, sys322):
196196
sys = StateSpace(sysin)
197197
assert sys.dt is None
198198

199-
def test_matlab_style_constructor(self):
200-
"""Use (deprecated) matrix-style construction string"""
201-
with pytest.deprecated_call():
202-
sys = StateSpace("-1 1; 0 2", "0; 1", "1, 0", "0")
203-
assert sys.A.shape == (2, 2)
204-
assert sys.B.shape == (2, 1)
205-
assert sys.C.shape == (1, 2)
206-
assert sys.D.shape == (1, 1)
207-
for X in [sys.A, sys.B, sys.C, sys.D]:
208-
assert ismatarrayout(X)
209-
210199
def test_D_broadcast(self, sys623):
211200
"""Test broadcast of D=0 to the right shape"""
212201
# Giving D as a scalar 0 should broadcast to the right shape

control/xferfcn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,8 @@ def tf(*args, **kwargs):
16401640
>>> G = (s + 1)/(s**2 + 2*s + 1)
16411641
16421642
>>> # Convert a StateSpace to a TransferFunction object.
1643-
>>> sys_ss = ct.ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
1644-
>>> sys2 = ct.tf(sys1)
1643+
>>> sys_ss = ct.ss([[1, -2], [3, -4]], [[5], [7]], [[6, 8]], 9)
1644+
>>> sys_tf = ct.tf(sys_ss)
16451645
16461646
"""
16471647

@@ -1801,7 +1801,7 @@ def ss2tf(*args, **kwargs):
18011801
>>> sys1 = ct.ss2tf(A, B, C, D)
18021802
18031803
>>> sys_ss = ct.ss(A, B, C, D)
1804-
>>> sys2 = ct.ss2tf(sys_ss)
1804+
>>> sys_tf = ct.ss2tf(sys_ss)
18051805
18061806
"""
18071807

0 commit comments

Comments
 (0)