Skip to content

Commit 66b381f

Browse files
committed
address review: allclose broadcasts
1 parent 97e08c6 commit 66b381f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

control/tests/timeresp_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,7 @@ def test_time_vector(self, tsystem, fun, squeeze, matarrayout):
883883
# tout should always match t, which has shape (n, )
884884
np.testing.assert_allclose(tout, tsystem.t)
885885
elif fun == forced_response and sys.dt in [None, True]:
886-
np.testing.assert_allclose(
887-
np.diff(tout), np.full_like(tout[:-1], 1.))
886+
np.testing.assert_allclose(np.diff(tout), 1.)
888887

889888
if squeeze is False or not sys.issiso():
890889
assert yout.shape[0] == sys.noutputs

control/timeresp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
356356

357357
# equally spaced also implies strictly monotonic increase
358358
dt = T[1] - T[0]
359-
if not np.allclose(np.diff(T), np.full_like(T[:-1], dt)):
359+
if not np.allclose(np.diff(T), dt):
360360
raise ValueError("Parameter ``T``: time values must be "
361361
"equally spaced.")
362362
n_steps = T.shape[0] # number of simulation steps
@@ -365,7 +365,6 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
365365
X0 = _check_convert_array(X0, [(n_states,), (n_states, 1)],
366366
'Parameter ``X0``: ', squeeze=True)
367367

368-
369368
xout = np.zeros((n_states, n_steps))
370369
xout[:, 0] = X0
371370
yout = np.zeros((n_outputs, n_steps))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy