Skip to content

Commit 48a18d6

Browse files
committed
revert the removal of rtol for discrete margin test: conda on python3.6 is not as precise
1 parent 96cc124 commit 48a18d6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

control/tests/margin_test.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,19 +336,23 @@ def test_zmore_stability_margins(tsys_zmore):
336336

337337
@pytest.mark.parametrize(
338338
'cnum, cden, dt,'
339-
'ref,',
339+
'ref,'
340+
'rtol',
340341
[( # gh-465
341342
[2], [1, 3, 2, 0], 1e-2,
342-
(2.9558, 32.390, 0.43584, 1.4037, 0.74951, 0.97079)),
343+
[2.9558, 32.390, 0.43584, 1.4037, 0.74951, 0.97079],
344+
2e-3), # the gradient of the function reduces numerical precision
343345
( # 2/(s+1)**3
344346
[2], [1, 3, 3, 1], .1,
345-
[3.4927, 65.4212, 0.5763, 1.6283, 0.76625, 1.2019]),
347+
[3.4927, 65.4212, 0.5763, 1.6283, 0.76625, 1.2019],
348+
1e-4),
346349
( # gh-523
347350
[1.1 * 4 * np.pi**2], [1, 2 * 0.2 * 2 * np.pi, 4 * np.pi**2], .05,
348-
[2.3842, 18.161, 0.26953, 11.712, 8.7478, 9.1504]),
351+
[2.3842, 18.161, 0.26953, 11.712, 8.7478, 9.1504],
352+
1e-4),
349353
])
350-
def test_stability_margins_discrete(cnum, cden, dt, ref):
354+
def test_stability_margins_discrete(cnum, cden, dt, ref, rtol):
351355
"""Test stability_margins with discrete TF input"""
352356
tf = TransferFunction(cnum, cden).sample(dt)
353357
out = stability_margins(tf)
354-
assert_allclose(out, ref, rtol=1e-4)
358+
assert_allclose(out, ref, rtol=rtol)

0 commit comments

Comments
 (0)