From 1e17cd57ebd76830e754b513be608099ea69f8db Mon Sep 17 00:00:00 2001 From: Alexander Sikorski Date: Tue, 23 Feb 2021 12:19:19 +0100 Subject: [PATCH] ajc: add test for limit behavior --- tests/test_ajc.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_ajc.py b/tests/test_ajc.py index 263b25b..fda5fca 100644 --- a/tests/test_ajc.py +++ b/tests/test_ajc.py @@ -4,13 +4,22 @@ from scipy.linalg import expm -def test_ajc(): +def test_ajc(n=20, tol=1e-2): Q = diffusion.DoubleWell().Q - a = ajcs.AJCS(np.repeat(Q, 10), np.repeat(0.1, 10)) + ts = np.repeat(1/n, n) + a = ajcs.AJCS(np.repeat(Q, n), ts) - assert((expm(Q) - a.koopman() < .1).all()) + assert np.isclose(expm(Q).todense(), a.koopman(), atol=tol).all() g = np.zeros((a.nt, a.nx)) g[0, :] = np.nan g[1, 1] = 1 a.space_time_committor(g) + + +def test_limit(tol=1e-5): + Q = diffusion.DoubleWell().Q + a0 = ajcs.AJCS([Q, Q, Q], [0,1,0]) + a1 = ajcs.AJCS([Q, Q, Q], [1e-10, 1, 1e-10]) + + assert np.isclose(a1.koopman(), a0.koopman(), atol=tol).all()