| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a775479 commit 9dca3fe
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1254,6 +1254,17 @@ def test_response_transpose( | |||
| 1254 | 1254 | assert y.shape == ysh_no | |
| 1255 | 1255 | assert x.shape == (T.size, sys.nstates) | |
| 1256 | 1256 | ||
| 1257 | + def test_forced_response_transpose_without_time_vector(self): | ||
| 1258 | + sys = ct.ss( | ||
| 1259 | + [[0.5]], [[1.0, -0.25]], [[1.0]], [[0.0, 0.0]], dt=True) | ||
| 1260 | + U = np.column_stack((np.arange(5.0), np.arange(5.0) + 10)) | ||
| 1261 | + | ||
| 1262 | + response = ct.forced_response(sys, inputs=U, transpose=True) | ||
| 1263 | + | ||
| 1264 | + np.testing.assert_allclose(response.time, np.arange(U.shape[0])) | ||
| 1265 | + np.testing.assert_allclose(response.inputs, U) | ||
| 1266 | + assert response.outputs.shape == (U.shape[0], sys.noutputs) | ||
| 1267 | + | ||
| 1257 | 1268 | ||
| 1258 | 1269 | @pytest.mark.pandas | |
| 1259 | 1270 | def test_to_pandas(): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1112,7 +1112,7 @@ def forced_response( | |||
| 1112 | 1112 | raise ValueError('Parameters `T` and `U` can\'t both be ' | |
| 1113 | 1113 | 'zero for discrete-time simulation') | |
| 1114 | 1114 | # Set T to equally spaced samples with same length as U | |
| 1115 | - if U.ndim == 1: | ||
| 1115 | + if U.ndim == 1 or transpose: | ||
| 1116 | 1116 | n_steps = U.shape[0] | |
| 1117 | 1117 | else: | |
| 1118 | 1118 | n_steps = U.shape[1] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments