Skip to content

Commit

Permalink
ajc: add test for limit behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
axsk committed Feb 23, 2021
1 parent 9657ad4 commit 1e17cd5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_ajc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 1e17cd5

Please sign in to comment.