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