Skip to content

Commit eb62d80

Browse files
Merge pull request #540 from murrayrm/fix_descfcn_iosys_merge
fix isssues arising in merge of descfcn/iosys changes
2 parents 2c132c9 + a586543 commit eb62d80

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

control/iosys.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ def __call__(sys, u, params=None, squeeze=None):
855855

856856
# Evaluate the function on the argument
857857
out = sys._out(0, np.array((0,)), np.asarray(u))
858-
_, out = _process_time_response(sys, [], out, [], squeeze=squeeze)
858+
_, out = _process_time_response(sys, None, out, None, squeeze=squeeze)
859859
return out
860860

861861
def _update_params(self, params, warning=False):
@@ -1867,8 +1867,10 @@ def linearize(sys, xeq, ueq=[], t=0, params={}, **kw):
18671867

18681868
# Utility function to parse a signal parameter
18691869
def _parse_signal_parameter(value, name, kwargs, end=False):
1870+
# Check kwargs for a variant of the parameter name
18701871
if value is None and name in kwargs:
1871-
value = list(kwargs.pop(name))
1872+
value = kwargs.pop(name)
1873+
18721874
if end and kwargs:
18731875
raise TypeError("unknown parameters %s" % kwargs)
18741876
return value

control/timeresp.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,11 @@ def _process_time_response(
467467
468468
Parameters
469469
----------
470+
sys : LTI or InputOutputSystem
471+
System that generated the data (used to check if SISO/MIMO).
472+
470473
T : 1D array
471-
Time values of the output
474+
Time values of the output. Ignored if None.
472475
473476
yout : ndarray
474477
Response of the system. This can either be a 1D array indexed by time
@@ -478,9 +481,9 @@ def _process_time_response(
478481
479482
xout : array, optional
480483
Individual response of each x variable (if return_x is True). For a
481-
SISO system (or if a single input is specified), This should be a 2D
484+
SISO system (or if a single input is specified), this should be a 2D
482485
array indexed by the state index and time (for single input systems)
483-
or a 3D array indexed by state, input, and time.
486+
or a 3D array indexed by state, input, and time. Ignored if None.
484487
485488
transpose : bool, optional
486489
If True, transpose all input and output arrays (for backward
@@ -545,7 +548,7 @@ def _process_time_response(
545548
raise ValueError("unknown squeeze value")
546549

547550
# Figure out whether and how to squeeze the state data
548-
if issiso and len(xout.shape) > 2:
551+
if issiso and xout is not None and len(xout.shape) > 2:
549552
xout = xout[:, 0, :] # remove input
550553

551554
# See if we need to transpose the data back into MATLAB form
@@ -555,7 +558,8 @@ def _process_time_response(
555558

556559
# For signals, put the last index (time) into the first slot
557560
yout = np.transpose(yout, np.roll(range(yout.ndim), 1))
558-
xout = np.transpose(xout, np.roll(range(xout.ndim), 1))
561+
if xout is not None:
562+
xout = np.transpose(xout, np.roll(range(xout.ndim), 1))
559563

560564
# Return time, output, and (optionally) state
561565
return (tout, yout, xout) if return_x else (tout, yout)

0 commit comments

Comments
 (0)