Skip to content

fix isssues arising in merge of descfcn/iosys changes #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions control/iosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def __call__(sys, u, params=None, squeeze=None):

# Evaluate the function on the argument
out = sys._out(0, np.array((0,)), np.asarray(u))
_, out = _process_time_response(sys, [], out, [], squeeze=squeeze)
_, out = _process_time_response(sys, None, out, None, squeeze=squeeze)
return out

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

# Utility function to parse a signal parameter
def _parse_signal_parameter(value, name, kwargs, end=False):
# Check kwargs for a variant of the parameter name
if value is None and name in kwargs:
value = list(kwargs.pop(name))
value = kwargs.pop(name)

if end and kwargs:
raise TypeError("unknown parameters %s" % kwargs)
return value
Expand Down
14 changes: 9 additions & 5 deletions control/timeresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,11 @@ def _process_time_response(

Parameters
----------
sys : LTI or InputOutputSystem
System that generated the data (used to check if SISO/MIMO).

T : 1D array
Time values of the output
Time values of the output. Ignored if None.

yout : ndarray
Response of the system. This can either be a 1D array indexed by time
Expand All @@ -478,9 +481,9 @@ def _process_time_response(

xout : array, optional
Individual response of each x variable (if return_x is True). For a
SISO system (or if a single input is specified), This should be a 2D
SISO system (or if a single input is specified), this should be a 2D
array indexed by the state index and time (for single input systems)
or a 3D array indexed by state, input, and time.
or a 3D array indexed by state, input, and time. Ignored if None.

transpose : bool, optional
If True, transpose all input and output arrays (for backward
Expand Down Expand Up @@ -545,7 +548,7 @@ def _process_time_response(
raise ValueError("unknown squeeze value")

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

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

# For signals, put the last index (time) into the first slot
yout = np.transpose(yout, np.roll(range(yout.ndim), 1))
xout = np.transpose(xout, np.roll(range(xout.ndim), 1))
if xout is not None:
xout = np.transpose(xout, np.roll(range(xout.ndim), 1))

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