Skip to content

Commit bd77d71

Browse files
committed
update _convert_to_transfer_function to allow 0D and 1D arrays
1 parent 8793d78 commit bd77d71

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

control/tests/bdalg_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def test_feedback_args(self, tsys):
255255
ctrl.feedback(*args)
256256

257257
# If second argument is not LTI or convertable, generate an exception
258-
args = (tsys.sys1, np.array([1]))
258+
args = (tsys.sys1, 'hello world')
259259
with pytest.raises(TypeError):
260260
ctrl.feedback(*args)
261261

control/tests/xferfcn_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ def test_returnScipySignalLTI_error(self, mimotf):
10301030
[pytest.param(getattr(operator, s), id=s) for s in ('add', 'sub', 'mul')])
10311031
@pytest.mark.parametrize(
10321032
"tf, arr",
1033-
[# pytest.param(ct.tf([1], [0.5, 1]), np.array(2.), id="0D scalar"),
1034-
# pytest.param(ct.tf([1], [0.5, 1]), np.array([2.]), id="1D scalar"),
1033+
[pytest.param(ct.tf([1], [0.5, 1]), np.array(2.), id="0D scalar"),
1034+
pytest.param(ct.tf([1], [0.5, 1]), np.array([2.]), id="1D scalar"),
10351035
pytest.param(ct.tf([1], [0.5, 1]), np.array([[2.]]), id="2D scalar")])
10361036
def test_xferfcn_ndarray_precedence(op, tf, arr):
10371037
# Apply the operator to the transfer function and array

control/xferfcn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ def _convert_to_transfer_function(sys, **kw):
12851285

12861286
# If this is array-like, try to create a constant feedthrough
12871287
try:
1288-
D = array(sys)
1288+
D = array(sys, ndmin=2)
12891289
outputs, inputs = D.shape
12901290
num = [[[D[i, j]] for j in range(inputs)] for i in range(outputs)]
12911291
den = [[[1] for j in range(inputs)] for i in range(outputs)]

0 commit comments

Comments
 (0)