Skip to content

Commit eeebec3

Browse files
committed
BUG: indent_radius not handled properly when passed to nyquist_plot
1 parent 5e405cc commit eeebec3

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

control/freqplot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,9 +1536,6 @@ def nyquist_plot(
15361536
color : string, optional
15371537
Used to specify the color of the line and arrowhead.
15381538
1539-
return_contour : bool, optional
1540-
If 'True', return the contour used to evaluate the Nyquist plot.
1541-
15421539
**kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
15431540
Additional keywords (passed to `matplotlib`)
15441541
@@ -1630,6 +1627,10 @@ def nyquist_plot(
16301627
max_curve_magnitude). Default linestyle (['-', '-.']) is
16311628
determined by config.defaults['nyquist.mirror_style'].
16321629
1630+
return_contour : bool, optional
1631+
(legacy) If 'True', return the encirclement count and Nyquist
1632+
contour used to generate the Nyquist plot.
1633+
16331634
start_marker : str, optional
16341635
Matplotlib marker to use to mark the starting point of the Nyquist
16351636
plot. Defaults value is 'o' and can be set using
@@ -1760,6 +1761,7 @@ def _parse_linestyle(style_name, allow_false=False):
17601761
omega_num=kwargs.pop('omega_num', None),
17611762
warn_encirclements=kwargs.pop('warn_encirclements', True),
17621763
warn_nyquist=kwargs.pop('warn_nyquist', True),
1764+
indent_radius=kwargs.pop('indent_radius', None),
17631765
check_kwargs=False, **kwargs)
17641766
else:
17651767
nyquist_responses = data

control/tests/nyquist_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,15 @@ def test_nyquist_indent_do(indentsys):
300300
np.testing.assert_allclose(contour[:50].real**2 + contour[:50].imag**2,
301301
0.01**2)
302302

303+
# Make sure that the command also works if called directly as _plot()
304+
plt.figure()
305+
with pytest.warns(DeprecationWarning, match=".* use nyquist_response()"):
306+
count, contour = ct.nyquist_plot(
307+
indentsys, indent_radius=0.01, return_contour=True)
308+
assert _Z(indentsys) == count + _P(indentsys)
309+
np.testing.assert_allclose(
310+
contour[:50].real**2 + contour[:50].imag**2, 0.01**2)
311+
303312

304313
def test_nyquist_indent_left(indentsys):
305314
plt.figure();

0 commit comments

Comments
 (0)