Skip to content

Commit 47bad08

Browse files
committed
Fixing problem with test requirements for transversal Lyapunov exponents. See: neurophysik/jitcdde/pull/58#issuecomment-2566488186
1 parent 2d8bb5d commit 47bad08

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/test_transversal_lyap.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
from itertools import combinations
8+
from warnings import warn
89

910
import numpy as np
1011
from scipy.stats import sem
@@ -73,6 +74,9 @@
7374
{"k": 0 , "sign": 0},
7475
]
7576

77+
class TestPrerequisiteBroken(AssertionError):
78+
pass
79+
7680
for scenario in scenarios:
7781
for average_dynamics in [False,True]:
7882
n = len(scenario["f"])
@@ -119,9 +123,15 @@
119123

120124
# Check that we are still on the synchronisation manifold:
121125
message = f"The dynamics left the synchronisation manifold when {scenario['name']} with coupling {coupling}. If this fails, this is a problem with the test and not with what is tested or any software involved.\n\nSpecifically, this test only works when the backend (Symengine plus compiler) implements certain computations completely symmetrically. This needs not and cannot be reasonably controlled (and no, turning off compiler optimisation doesn’t necessarily help as it often restores symmetries broken by Symengine). It’s only something exploited by this test to make it work in the first place."
122-
for group in scenario["groups"]:
123-
for i,j in combinations(group,2):
124-
assert ODE1.y[i]==ODE1.y[j], message
126+
try:
127+
for group in scenario["groups"]:
128+
for i,j in combinations(group,2):
129+
if ODE1.y[i]!=ODE1.y[j]:
130+
raise TestPrerequisiteBroken(message)
131+
except TestPrerequisiteBroken as err:
132+
warn(str(err),stacklevel=2)
133+
print( "X", end="", flush=True )
134+
continue
125135

126136
Lyap1 = np.average(lyaps1[500:])
127137
Lyap2 = np.average(lyaps2[500:])

0 commit comments

Comments
 (0)