Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
BUG: indent_radius not handled properly when passed to nyquist_plot
  • Loading branch information
murrayrm committed Jun 26, 2024
commit eeebec32603586cbf4c7d682471b3181d6578784
8 changes: 5 additions & 3 deletions control/freqplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1536,9 +1536,6 @@ def nyquist_plot(
color : string, optional
Used to specify the color of the line and arrowhead.

return_contour : bool, optional
If 'True', return the contour used to evaluate the Nyquist plot.

**kwargs : :func:`matplotlib.pyplot.plot` keyword properties, optional
Additional keywords (passed to `matplotlib`)

Expand Down Expand Up @@ -1630,6 +1627,10 @@ def nyquist_plot(
max_curve_magnitude). Default linestyle (['-', '-.']) is
determined by config.defaults['nyquist.mirror_style'].

return_contour : bool, optional
(legacy) If 'True', return the encirclement count and Nyquist
contour used to generate the Nyquist plot.

start_marker : str, optional
Matplotlib marker to use to mark the starting point of the Nyquist
plot. Defaults value is 'o' and can be set using
Expand Down Expand Up @@ -1760,6 +1761,7 @@ def _parse_linestyle(style_name, allow_false=False):
omega_num=kwargs.pop('omega_num', None),
warn_encirclements=kwargs.pop('warn_encirclements', True),
warn_nyquist=kwargs.pop('warn_nyquist', True),
indent_radius=kwargs.pop('indent_radius', None),
check_kwargs=False, **kwargs)
else:
nyquist_responses = data
Expand Down
9 changes: 9 additions & 0 deletions control/tests/nyquist_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,15 @@ def test_nyquist_indent_do(indentsys):
np.testing.assert_allclose(contour[:50].real**2 + contour[:50].imag**2,
0.01**2)

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


def test_nyquist_indent_left(indentsys):
plt.figure();
Expand Down