Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4267eea

Browse files
committed
labelFreq -> label_freq in nyquist_plot() w/ deprecation warning + remove extraneous docstring text
1 parent 249d85e commit 4267eea

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

control/freqplot.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def bode_plot(syslist, omega=None,
114114
Additional arguments for `matplotlib` plots (color, linestyle, etc)
115115
**kwargs : `matplotlib` plot keyword properties, optional
116116
Additional keywords (passed to `matplotlib`)
117-
w
117+
118118
Returns
119119
-------
120120
mag : array (list if len(syslist) > 1)
@@ -442,7 +442,7 @@ def gen_zero_centered_series(val_min, val_max, period):
442442
# Nyquist plot
443443
#
444444

445-
def nyquist_plot(syslist, omega=None, plot=True, labelFreq=0,
445+
def nyquist_plot(syslist, omega=None, plot=True, label_freq=0,
446446
arrowhead_length=0.1, arrowhead_width=0.1,
447447
color=None, *args, **kwargs):
448448
"""
@@ -460,7 +460,7 @@ def nyquist_plot(syslist, omega=None, plot=True, labelFreq=0,
460460
If True, plot magnitude
461461
color : string
462462
Used to specify the color of the plot
463-
labelFreq : int
463+
label_freq : int
464464
Label every nth frequency on the plot
465465
arrowhead_width : arrow head width
466466
arrowhead_length : arrow head length
@@ -492,6 +492,14 @@ def nyquist_plot(syslist, omega=None, plot=True, labelFreq=0,
492492
# Map 'Plot' keyword to 'plot' keyword
493493
plot = kwargs.pop('Plot')
494494

495+
# Check to see if legacy 'labelFreq' keyword was used
496+
if 'labelFreq' in kwargs:
497+
import warnings
498+
warnings.warn("'labelFreq' keyword is deprecated in nyquist_plot; "
499+
"use 'label_freq'", FutureWarning)
500+
# Map 'labelFreq' keyword to 'label_freq' keyword
501+
label_freq = kwargs.pop('labelFreq')
502+
495503
# If argument was a singleton, turn it into a list
496504
if not getattr(syslist, '__iter__', False):
497505
syslist = (syslist,)
@@ -544,8 +552,8 @@ def nyquist_plot(syslist, omega=None, plot=True, labelFreq=0,
544552
plt.plot([-1], [0], 'r+')
545553

546554
# Label the frequencies of the points
547-
if labelFreq:
548-
ind = slice(None, None, labelFreq)
555+
if label_freq:
556+
ind = slice(None, None, label_freq)
549557
for xpt, ypt, omegapt in zip(x[ind], y[ind], omega[ind]):
550558
# Convert to Hz
551559
f = omegapt / (2 * sp.pi)

0 commit comments

Comments
 (0)