Skip to content

Commit 1903055

Browse files
committed
use common processing for state response
1 parent df33002 commit 1903055

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

control/timeresp.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -608,25 +608,15 @@ def states(self):
608608
609609
"""
610610
# TODO: move to __init__ to avoid recomputing each time?
611-
if self.x is None:
612-
return None
611+
x = _process_time_response(
612+
self.x, transpose=self.transpose,
613+
squeeze=self.squeeze, issiso=False)
613614

614-
elif self.squeeze is True:
615-
x = self.x.squeeze()
616-
617-
elif self.ninputs == 1 and self.noutputs == 1 and \
618-
self.ntraces == 1 and self.x.ndim == 3 and \
615+
# Special processing for SISO case: always retain state index
616+
if self.issiso and self.ntraces == 1 and x.ndim == 3 and \
619617
self.squeeze is not False:
620618
# Single-input, single-output system with single trace
621-
x = self.x[:, 0, :]
622-
623-
else:
624-
# Return the full set of data
625-
x = self.x
626-
627-
# Transpose processing
628-
if self.transpose:
629-
x = np.transpose(x, np.roll(range(x.ndim), 1))
619+
x = x[:, 0, :]
630620

631621
return NamedSignal(x, self.state_labels, self.input_labels)
632622

0 commit comments

Comments
 (0)