Skip to content

Commit c568c59

Browse files
committed
remove redundant code
1 parent 84a1e4d commit c568c59

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

control/nlsys.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,8 +1498,8 @@ def input_output_response(
14981498
else:
14991499
legal_shapes = [(sys.ninputs, ntimepts)]
15001500

1501-
U = _check_convert_array(U, legal_shapes,
1502-
'Parameter ``U``: ', squeeze=False)
1501+
U = _check_convert_array(
1502+
U, legal_shapes, 'Parameter ``U``: ', squeeze=False)
15031503

15041504
# Always store the input as a 2D array
15051505
U = U.reshape(-1, ntimepts)
@@ -1508,23 +1508,6 @@ def input_output_response(
15081508
# If we were passed a list of initial states, concatenate them
15091509
X0 = _concatenate_list_elements(X0, 'X0')
15101510

1511-
# If the initial state is too short, make it longer (NB: sys.nstates
1512-
# could be None if nstates comes from size of initial condition)
1513-
if sys.nstates and isinstance(X0, np.ndarray) and X0.size < sys.nstates:
1514-
if X0[-1] != 0:
1515-
warn("initial state too short; padding with zeros")
1516-
X0 = np.hstack([X0, np.zeros(sys.nstates - X0.size)])
1517-
1518-
# If we were passed a list of initial states, concatenate them
1519-
if isinstance(X0, (tuple, list)):
1520-
X0_list = []
1521-
for i, x0 in enumerate(X0):
1522-
x0 = np.array(x0).reshape(-1) # convert everyting to 1D array
1523-
X0_list += x0.tolist() # add elements to initial state
1524-
1525-
# Save the newly created input vector
1526-
X0 = np.array(X0_list)
1527-
15281511
# If the initial state is too short, make it longer (NB: sys.nstates
15291512
# could be None if nstates comes from size of initial condition)
15301513
if sys.nstates and isinstance(X0, np.ndarray) and X0.size < sys.nstates:
@@ -1536,8 +1519,8 @@ def input_output_response(
15361519
nstates = _find_size(sys.nstates, X0, "states")
15371520

15381521
# create X0 if not given, test if X0 has correct shape
1539-
X0 = _check_convert_array(X0, [(nstates,), (nstates, 1)],
1540-
'Parameter ``X0``: ', squeeze=True)
1522+
X0 = _check_convert_array(
1523+
X0, [(nstates,), (nstates, 1)], 'Parameter ``X0``: ', squeeze=True)
15411524

15421525
# Figure out the number of outputs
15431526
if sys.noutputs is None:

0 commit comments

Comments
 (0)