Skip to content

Commit 7a209f7

Browse files
authored
Merge pull request #1003 from gdmcbain/rlocus-k
process legacy rlocus keyword k->gains
2 parents 6178097 + 12865cf commit 7a209f7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

control/rlocus.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ def root_locus_plot(
160160
from .pzmap import pole_zero_plot
161161

162162
# Legacy parameters
163-
gains = config._process_legacy_keyword(kwargs, 'kvect', 'gains', gains)
163+
for oldkey in ['kvect', 'k']:
164+
gains = config._process_legacy_keyword(kwargs, oldkey, 'gains', gains)
164165

165166
# Set default parameters
166167
grid = config._get_param('rlocus', 'grid', grid, _rlocus_defaults)

control/tests/rlocus_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ def test_root_locus_plots(sys, grid, xlim, ylim, interactive):
181181

182182

183183
# Test deprecated keywords
184-
def test_root_locus_legacy():
184+
@pytest.mark.parametrize("keyword", ["kvect", "k"])
185+
def test_root_locus_legacy(keyword):
185186
sys = ct.rss(2, 1, 1)
186-
with pytest.warns(DeprecationWarning, match="'kvect' is deprecated"):
187-
ct.root_locus_plot(sys, kvect=[0, 1, 2])
187+
with pytest.warns(DeprecationWarning, match=f"'{keyword}' is deprecated"):
188+
ct.root_locus_plot(sys, **{keyword: [0, 1, 2]})
188189

189190

190191
# Generate plots used in documentation

0 commit comments

Comments
 (0)