Skip to content

Commit

Permalink
Updating tests to use new package name and state interface
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-graham committed Oct 23, 2019
1 parent 4a7993c commit bcce104
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions tests/test_integrators.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy as np
import hmc.integrators as integrators
import hmc.systems as systems
import hmc.states as states
from hmc.errors import IntegratorError
import mici.integrators as integrators
import mici.systems as systems
import mici.states as states
from mici.errors import IntegratorError

SEED = 3046987125
SIZES = {1, 2, 5, 10}
Expand Down Expand Up @@ -118,7 +118,7 @@ def __init__(self):
lambda q: 0.5 * np.sum(q**2), grad_neg_log_dens=lambda q: q)
self.integrator = integrators.LeapfrogIntegrator(system, 0.5)
self.states = {size: [
states.HamiltonianState(pos=q, mom=p)
states.ChainState(pos=q, mom=p, dir=1)
for q, p in self.rng.standard_normal((N_STATE, 2, size))]
for size in SIZES}
self.h_diff_tol = 5e-3
Expand All @@ -133,7 +133,7 @@ def __init__(self):
lambda q: 0.25 * np.sum(q**4), grad_neg_log_dens=lambda q: q**3)
self.integrator = integrators.LeapfrogIntegrator(system, 0.1)
self.states = {size: [
states.HamiltonianState(pos=q, mom=p)
states.ChainState(pos=q, mom=p, dir=1)
for q, p in self.rng.standard_normal((N_STATE, 2, size))]
for size in SIZES}
self.h_diff_tol = 2e-2
Expand All @@ -148,7 +148,7 @@ def __init__(self):
lambda q: 0, grad_neg_log_dens=lambda q: 0 * q)
self.integrator = integrators.LeapfrogIntegrator(system, 0.5)
self.states = {size: [
states.HamiltonianState(pos=q, mom=p)
states.ChainState(pos=q, mom=p, dir=1)
for q, p in self.rng.standard_normal((N_STATE, 2, size))]
for size in SIZES}
self.h_diff_tol = 1e-10
Expand All @@ -164,7 +164,7 @@ def __init__(self):
grad_neg_log_dens=lambda q: 0.5 * q**3)
self.integrator = integrators.LeapfrogIntegrator(system, 0.1)
self.states = {size: [
states.HamiltonianState(pos=q, mom=p)
states.ChainState(pos=q, mom=p, dir=1)
for q, p in self.rng.standard_normal((N_STATE, 2, size))]
for size in SIZES}
self.h_diff_tol = 1e-2
2 changes: 1 addition & 1 deletion tests/test_matrices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import hmc.matrices as matrices
import mici.matrices as matrices
import numpy as np
import numpy.linalg as nla
import scipy.linalg as sla
Expand Down

0 comments on commit bcce104

Please sign in to comment.