Skip to content
Closed
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
4 changes: 4 additions & 0 deletions control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,10 @@ def horner(self, x, warn_infinite=True):
out[:, :, idx] = complex(np.nan, np.nan)
else:
out[:, :, idx] = complex(np.inf, np.nan)
else:
if np.any(np.isnan(out[:, :, idx])):
print(idx, x_idx, self.A, self.B)
print(out[:, :, idx])

return out

Expand Down
5 changes: 3 additions & 2 deletions control/tests/flatsys_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,9 @@ def test_point_to_point_errors(self):
traj_kwarg = fs.point_to_point(
flat_sys, timepts, x0, u0, xf, uf, cost=cost_fcn,
basis=fs.PolyFamily(8), minimize_kwargs={'method': 'slsqp'})
np.testing.assert_almost_equal(
traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0])
np.testing.assert_allclose(
traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0],
atol=1e-5)

# Unrecognized keywords
with pytest.raises(TypeError, match="unrecognized keyword"):
Expand Down
3 changes: 2 additions & 1 deletion control/tests/timeresp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,8 @@ def test_forced_response_T_U(self, tsystem, fr_kwargs, refattr):
fr_kwargs['X0'] = tsystem.X0
t, y = forced_response(tsystem.sys, **fr_kwargs)
np.testing.assert_allclose(t, tsystem.t)
np.testing.assert_allclose(y, getattr(tsystem, refattr), rtol=1e-3)
np.testing.assert_allclose(y, getattr(tsystem, refattr),
rtol=1e-3, atol=1e-5)

@pytest.mark.parametrize("tsystem", ["siso_ss1"], indirect=True)
def test_forced_response_invalid_c(self, tsystem):
Expand Down