Skip to content

Commit 65d1d26

Browse files
murrayrmclaude
andcommitted
use doctest ELLIPSIS for bandwidth() values to avoid ULP failures
bandwidth() gets its value from a scipy.optimize.root_scalar bisection, so the last digit or two of the repr differs across scipy/BLAS builds. The full-precision literals matched locally but failed on GitHub. Truncate to ~14 significant digits with # doctest: +ELLIPSIS. This keeps the examples verified (unlike +SKIP, used elsewhere in the repo for platform-dependent output), and trim_doctest_flags (on by default) strips the flag comment from the rendered HTML. Also applied to the G1*G2 example, which has the same origin and had not failed yet. Verified with "make doctest" in doc/: 728 tests, 0 failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent c4f248c commit 65d1d26

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

control/lti.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,15 @@ def bandwidth(sys, dbdrop=-3):
706706
Examples
707707
--------
708708
>>> G = ct.tf([1], [1, 1])
709-
>>> ct.bandwidth(G)
710-
np.float64(0.9976283451102316)
709+
>>> ct.bandwidth(G) # doctest: +ELLIPSIS
710+
np.float64(0.99762834511023...)
711711
712712
>>> G1 = ct.tf(0.1, [1, 0.1])
713713
>>> wn2 = 1
714714
>>> zeta2 = 0.001
715715
>>> G2 = ct.tf(wn2**2, [1, 2*zeta2*wn2, wn2**2])
716-
>>> ct.bandwidth(G1*G2)
717-
np.float64(0.10184838823897456)
716+
>>> ct.bandwidth(G1*G2) # doctest: +ELLIPSIS
717+
np.float64(0.10184838823897...)
718718
719719
"""
720720
if not isinstance(sys, LTI):

doc/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,5 @@ This documentation has a number of notional conventions and functionality:
190190
.. doctest::
191191

192192
>>> sys = ct.tf([1], [1, 0.5, 1])
193-
>>> ct.bandwidth(sys)
194-
np.float64(1.4839084518312828)
193+
>>> ct.bandwidth(sys) # doctest: +ELLIPSIS
194+
np.float64(1.4839084518312...)

0 commit comments

Comments
 (0)