8000 fixed phaseplot test to use system which will always have separatrices · lkies/python-control@4724e5a · GitHub
[go: up one dir, main page]

Skip to content

Commit 4724e5a

Browse files
committed
fixed phaseplot test to use system which will always have separatrices
1 parent 81d9c1e commit 4724e5a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

control/tests/phaseplot_test.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def invpend_ode(t, x, m=0, l=0, b=0, g=0):
170170
plot_streamlines=True)
171171

172172
with pytest.raises(ValueError, match="gridtype must be 'meshgrid' when using streamplot"):
173-
ct.phase_plane_plot(ct.rss(2, 1, 1), plot_streamplot=True, gridtype='boxgrid')
173+
ct.phase_plane_plot(ct.rss(2, 1, 1), plot_streamlines=False,
174+
plot_streamplot=True, gridtype='boxgrid')
174175

175176
# Warning messages for invalid solutions: nonlinear spring mass system
176177
sys = ct.nlsys(
@@ -220,7 +221,8 @@ def assert_orders(streamlines, quiver, streamplot, separatrices, equilpoints):
220221
if streamplot is not None:
221222
assert streamplot < separatrices < equilpoints
222223

223-
sys = ct.rss(2, 1, 1)
224+
def sys(t, x):
225+
return np.array([4*x[1], -np.sin(4*x[0])])
224226

225227
# ensure correct zordering for all three flow types
226228
res_streamlines = ct.phase_plane_plot(sys, plot_streamlines=dict(color=key_color))
@@ -239,7 +241,9 @@ def assert_orders(streamlines, quiver, streamplot, separatrices, equilpoints):
239241

240242
@pytest.mark.usefixtures('mplcleanup')
241243
def test_stream_plot_magnitude():
242-
sys = ct.rss(2, 1, 1)
244+
def sys(t, x):
245+
return np.array([4*x[1], -np.sin(4*x[0])])
246+
243247
# plt context with linewidth
244248
with plt.rc_context({'lines.linewidth': 4}):
245249
res = ct.phase_plane_plot(sys, plot_streamplot=dict(vary_linewidth=True))

0 commit comments

Comments
 (0)
0