Skip to content

Commit cf3daa4

Browse files
committed
address @slivingston review comments
1 parent 13eda42 commit cf3daa4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

control/freqplot.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

control/tests/nyquist_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,11 @@ def test_nyquist_rescale():
646646
from datetime import date
647647

648648
# Create the file to store figures
649-
git_info = subprocess.check_output(['git', 'describe'], text=True).strip()
649+
try:
650+
git_info = subprocess.check_output(
651+
['git', 'describe'], text=True).strip()
652+
except subprocess.CalledProcessError:
653+
git_info = 'UNKNOWN-REPO-INFO'
650654
pdf = PdfPages(
651655
f'nyquist_gallery-{git_info}-{date.today().isoformat()}.pdf')
652656

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy