@@ -534,9 +534,10 @@ def gen_zero_centered_series(val_min, val_max, period):
534
534
}
535
535
536
536
537
- def nyquist_plot (syslist , omega = None , plot = True , omega_limits = None ,
538
- omega_num = None , label_freq = 0 , color = None ,
539
- return_contour = False , warn_nyquist = True , * args , ** kwargs ):
537
+ def nyquist_plot (
538
+ syslist , omega = None , plot = True , omega_limits = None , omega_num = None ,
539
+ label_freq = 0 , color = None , return_contour = False ,
540
+ warn_encirclements = True , warn_nyquist = True , ** kwargs ):
540
541
"""Nyquist plot for a system
541
542
542
543
Plots a Nyquist plot for the system over a (optional) frequency range.
@@ -646,11 +647,11 @@ def nyquist_plot(syslist, omega=None, plot=True, omega_limits=None,
646
647
determined by config.defaults['nyquist.mirror_style'].
647
648
648
649
primary_style : [str, str], optional
649
- Linestyles for primary image of the Nyquist curve. The first element
650
- is used for unscaled portions of the Nyquist curve, the second
651
- element is used for scaled portions that are scaled (using
652
- max_curve_magnitude). Default linestyle (['-', ':']) is determined by
653
- config.defaults['nyquist.mirror_style'].
650
+ Linestyles for primary image of the Nyquist curve. The first
651
+ element is used for unscaled portions of the Nyquist curve,
652
+ the second element is used for portions that are scaled (using
653
+ max_curve_magnitude). Default linestyle (['-', ':']) is
654
+ determined by config.defaults['nyquist.mirror_style'].
654
655
655
656
start_marker : str, optional
656
657
Matplotlib marker to use to mark the starting point of the Nyquist
@@ -838,7 +839,8 @@ def _parse_linestyle(style_name, allow_false=False):
838
839
p_ol = splane_poles [
839
840
(np .abs (splane_poles - p_cl )).argmin ()]
840
841
841
- if abs (p_ol - p_cl ) <= indent_radius :
842
+ if abs (p_ol - p_cl ) <= indent_radius and \
843
+ warn_encirclements :
842
844
warnings .warn (
843
845
"indented contour may miss closed loop pole; "
844
846
"consider reducing indent_radius to be less than "
@@ -919,7 +921,8 @@ def _parse_linestyle(style_name, allow_false=False):
919
921
count = int (np .round (encirclements , 0 ))
920
922
921
923
# Let the user know if the count might not make sense
922
- if abs (encirclements - count ) > encirclement_threshold :
924
+ if abs (encirclements - count ) > encirclement_threshold and \
925
+ warn_encirclements :
923
926
warnings .warn (
924
927
"number of encirclements was a non-integer value; this can"
925
928
" happen is contour is not closed, possibly based on a"
@@ -936,13 +939,13 @@ def _parse_linestyle(style_name, allow_false=False):
936
939
P = (sys .pole ().real > 0 ).sum () if indent_direction == 'right' \
937
940
else (sys .pole ().real >= 0 ).sum ()
938
941
Z = (sys .feedback ().pole ().real >= 0 ).sum ()
939
- if Z != count + P :
942
+ if Z != count + P and warn_encirclements :
940
943
warnings .warn (
941
944
"number of encirclements does not match Nyquist criterion;"
942
945
" check frequency range and indent radius/direction" ,
943
946
UserWarning , stacklevel = 2 )
944
- elif indent_direction == 'none' and \
945
- any ( np . isclose ( sys . pole (). real , 0 )) :
947
+ elif indent_direction == 'none' and any ( sys . pole (). real == 0 ) and \
948
+ warn_encirclements :
946
949
warnings .warn (
947
950
"system has pure imaginary poles but indentation is"
948
951
" turned off; results may be meaningless" ,
@@ -990,7 +993,7 @@ def _parse_linestyle(style_name, allow_false=False):
990
993
x_reg = np .ma .masked_where (reg_mask , resp .real )
991
994
y_reg = np .ma .masked_where (reg_mask , resp .imag )
992
995
p = plt .plot (
993
- x_reg , y_reg , primary_style [0 ], color = color , * args , * *kwargs )
996
+ x_reg , y_reg , primary_style [0 ], color = color , ** kwargs )
994
997
c = p [0 ].get_color ()
995
998
996
999
# Figure out how much to offset the curve: the offset goes from
@@ -1004,13 +1007,13 @@ def _parse_linestyle(style_name, allow_false=False):
1004
1007
y_scl = np .ma .masked_where (scale_mask , resp .imag )
1005
1008
plt .plot (
1006
1009
x_scl * (1 + curve_offset ), y_scl * (1 + curve_offset ),
1007
- primary_style [1 ], color = c , * args , * *kwargs )
1010
+ primary_style [1 ], color = c , ** kwargs )
1008
1011
1009
1012
# Plot the primary curve (invisible) for setting arrows
1010
1013
x , y = resp .real .copy (), resp .imag .copy ()
1011
1014
x [reg_mask ] *= (1 + curve_offset [reg_mask ])
1012
1015
y [reg_mask ] *= (1 + curve_offset [reg_mask ])
1013
- p = plt .plot (x , y , linestyle = 'None' , color = c , * args , * *kwargs )
1016
+ p = plt .plot (x , y , linestyle = 'None' , color = c , ** kwargs )
1014
1017
1015
1018
# Add arrows
1016
1019
ax = plt .gca ()
@@ -1021,17 +1024,17 @@ def _parse_linestyle(style_name, allow_false=False):
1021
1024
if mirror_style is not False :
1022
1025
# Plot the regular and scaled segments
1023
1026
plt .plot (
1024
- x_reg , - y_reg , mirror_style [0 ], color = c , * args , * *kwargs )
1027
+ x_reg , - y_reg , mirror_style [0 ], color = c , ** kwargs )
1025
1028
plt .plot (
1026
1029
x_scl * (1 - curve_offset ),
1027
1030
- y_scl * (1 - curve_offset ),
1028
- mirror_style [1 ], color = c , * args , * *kwargs )
1031
+ mirror_style [1 ], color = c , ** kwargs )
1029
1032
1030
1033
# Add the arrows (on top of an invisible contour)
1031
1034
x , y = resp .real .copy (), resp .imag .copy ()
1032
1035
x [reg_mask ] *= (1 - curve_offset [reg_mask ])
1033
1036
y [reg_mask ] *= (1 - curve_offset [reg_mask ])
1034
- p = plt .plot (x , - y , linestyle = 'None' , color = c , * args , * *kwargs )
1037
+ p = plt .plot (x , - y , linestyle = 'None' , color = c , ** kwargs )
1035
1038
_add_arrows_to_line2D (
1036
1039
ax , p [0 ], arrow_pos , arrowstyle = arrow_style , dir = - 1 )
1037
1040
0 commit comments