@@ -1885,6 +1885,11 @@ def _parse_linestyle(style_name, allow_false=False):
18851885 legend_loc , _ , show_legend = _process_legend_keywords (
18861886 kwargs , None , 'upper right' )
18871887
1888+ # Figure out where the blended curve should start
1889+ if blend_fraction < 0 or blend_fraction > 1 :
1890+ raise ValueError ("blend_fraction must be between 0 and 1" )
1891+ blend_curve_start = (1 - blend_fraction ) * max_curve_magnitude
1892+
18881893 # Create a list of lines for the output
18891894 out = np .empty ((len (nyquist_responses ), 4 ), dtype = object )
18901895 for i in range (len (nyquist_responses )):
@@ -1899,9 +1904,6 @@ def _parse_linestyle(style_name, allow_false=False):
18991904 splane_contour = np .log (response .contour ) / response .dt
19001905
19011906 # Find the different portions of the curve (with scaled pts marked)
1902- if blend_fraction < 0 or blend_fraction > 1 :
1903- raise ValueError ("blend_fraction must be between 0 and 1" )
1904- blend_curve_start = (1 - blend_fraction ) * max_curve_magnitude
19051907 reg_mask = np .logical_or (
19061908 np .abs (resp ) > blend_curve_start ,
19071909 np .logical_not (np .isclose (splane_contour .real , 0 )))
@@ -1918,8 +1920,7 @@ def _parse_linestyle(style_name, allow_false=False):
19181920 abs_subset = np .abs (subset )
19191921 unit_vectors = subset / abs_subset # Preserve phase/direction
19201922
1921- if blend_curve_start is None or \
1922- blend_curve_start == max_curve_magnitude :
1923+ if blend_curve_start == max_curve_magnitude :
19231924 # Clip at max_curve_magnitude
19241925 resp [rescale_idx ] = max_curve_magnitude * unit_vectors
19251926 else :
0 commit comments