8000 update _convert_to_transfer_function to allow 0D and 1D arrays · python-control/python-control@8d30e76 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8d30e76

Browse files
committed
update _convert_to_transfer_function to allow 0D and 1D arrays
1 parent 213ae49 commit 8d30e76

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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
@@ -1023,8 +1023,8 @@ def test_returnScipySignalLTI_error(self, mimotf):
10231023
[pytest.param(getattr(operator, s), id=s) for s in ('add', 'sub', 'mul')])
10241024
@pytest.mark.parametrize(
10251025
"tf, arr",
1026-
[# pytest.param(ct.tf([1], [0.5, 1]), np.array(2.), id="0D scalar"),
1027-
# pytest.param(ct.tf([1], [0.5, 1]), np.array([2.]), id="1D scalar"),
1026+
[pytest.param(ct.tf([1], [0.5, 1]), np.array(2.), id="0D scalar"),
1027+
pytest.param(ct.tf([1], [0.5, 1]), np.array([2.]), id="1D scalar"),
10281028
pytest.param(ct.tf([1], [0.5, 1]), np.array([[2.]]), id="2D scalar")])
10291029
def test_xferfcn_ndarray_precedence(op, tf, arr):
10301030
# 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
@@ -1314,7 +1314,7 @@ def _convert_to_transfer_function(sys, **kw):
13141314

13151315
# If this is array-like, try to create a constant feedthrough
13161316
try:
1317-
D = array(sys)
1317+
D = array(sys, ndmin=2)
13181318
outputs, inputs = D.shape
13191319
num = [[[D[i, j]] for j in range(inputs)] for i in range(outputs)]
13201320
den = [[[1] for j in range(inputs)] for i in range(outputs)]

0 commit comments

Comments
 (0)
0