Skip to content

Commit 67c1f3f

Browse files
committed
add legacy settings for nyquist
1 parent c25c0cb commit 67c1f3f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

control/config.py

+9
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ def use_legacy_defaults(version):
267267
#
268268
reset_defaults() # start from a clean slate
269269

270+
# Version 0.9.2:
271+
if major == 0 and minor < 9 or (minor == 9 and patch < 2):
272+
from math import inf
273+
274+
# Reset Nyquist defaults
275+
set_defaults('nyquist', indent_radius=0.1, max_curve_magnitude=inf,
276+
max_curve_offset=0, primary_style=['-', '-'],
277+
mirror_style=['--', '--'], start_marker_size=0)
278+
270279
# Version 0.9.0:
271280
if major == 0 and minor < 9:
272281
# switched to 'array' as default for state space objects

control/tests/nyquist_test.py

+11
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,17 @@ def test_linestyle_checks():
337337
with pytest.raises(ValueError, match="invalid 'mirror_style'"):
338338
ct.nyquist_plot(sys, mirror_style=0.2)
339339

340+
@pytest.mark.usefixtures("editsdefaults")
341+
def test_nyquist_legacy():
342+
ct.use_legacy_defaults('0.9.1')
343+
344+
# Example that generated a warning using earlier defaults
345+
s = ct.tf('s')
346+
sys = (0.02 * s**3 - 0.1 * s) / (s**4 + s**3 + s**2 + 0.25 * s + 0.04)
347+
348+
with pytest.warns(UserWarning, match="indented contour may miss"):
349+
count = ct.nyquist_plot(sys)
350+
340351

341352
if __name__ == "__main__":
342353
#

0 commit comments

Comments
 (0)