Merge pull request #1106 from murrayrm/fix_phase_crossover-28Jan2025 · python-control/python-control@ebff125
@@ -12,12 +12,9 @@
1212from numpy import inf, nan
1313from numpy.testing import assert_allclose
141415-from control.frdata import FrequencyResponseData
16-from control.margins import (margin, phase_crossover_frequencies,
17-stability_margins)
18-from control.statesp import StateSpace
19-from control.xferfcn import TransferFunction
20-from control.exception import ControlMIMONotImplemented
15+from control import ControlMIMONotImplemented, FrequencyResponseData, \
16+StateSpace, TransferFunction, margin, phase_crossover_frequencies, \
17+stability_margins
21182219s = TransferFunction.s
2320@@ -111,15 +108,17 @@ def test_margin_3input(tsys):
111108out = margin((mag, phase*180/np.pi, omega_))
112109assert_allclose(out, np.array(refout)[[0, 1, 3, 4]], atol=1.5e-3)
113110114-115111@pytest.mark.parametrize(
116112 'tfargs, omega_ref, gain_ref',
117113 [(([1], [1, 2, 3, 4]), [1.7325, 0.], [-0.5, 0.25]),
118114 (([1], [1, 1]), [0.], [1.]),
119115 (([2], [1, 3, 3, 1]), [1.732, 0.], [-0.25, 2.]),
120116 ((np.array([3, 11, 3]) * 1e-4, [1., -2.7145, 2.4562, -0.7408], .1),
121117 [1.6235, 0.], [-0.28598, 1.88889]),
118+ (([200.0], [1.0, 21.0, 20.0, 0.0]),
119+ [4.47213595, 0], [-0.47619048, inf]),
122120 ])
121+@pytest.mark.filterwarnings("error")
123122def test_phase_crossover_frequencies(tfargs, omega_ref, gain_ref):
124123"""Test phase_crossover_frequencies() function"""
125124sys = TransferFunction(*tfargs)