Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion openpathsampling/experimental/simstore/test_custom_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import numpy as np
from numpy import testing as npt
from simtk import unit

from . import test_utils

Expand Down
12 changes: 9 additions & 3 deletions openpathsampling/experimental/storage/ops_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
from . import snapshots
from .snapshots_table import SnapshotsTable

from .simtk_unit import simtk_quantity_codec, SimtkQuantityHandler
try:
from .simtk_unit import simtk_quantity_codec, SimtkQuantityHandler
except ImportError:
simtk_quantity_codec = None
SimtkQuantityHandler = None

import logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,8 +75,10 @@
ops_schema_sql_metadata = {}

# this defines the simulation object serializer for OPS
CODECS = DEFAULT_CODECS + [simtk_quantity_codec]
HANDLERS = DEFAULT_HANDLERS + [SimtkQuantityHandler]
EXTRA_CODECS = [simtk_quantity_codec] if simtk_quantity_codec else []
EXTRA_HANDLERS = [SimtkQuantityHandler] if SimtkQuantityHandler else []
CODECS = DEFAULT_CODECS + EXTRA_CODECS
HANDLERS = DEFAULT_HANDLERS + EXTRA_HANDLERS

UNSAFE_CODECS = CODECS + [CallableCodec()]
SAFE_CODECS = CODECS + [CallableCodec({'safemode': True})]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class TestMDTrajFunctionCV(object):
def setup(self):
if not HAS_MDTRAJ:
pytest.skip("Unable to import MDTraj")
pytest.importorskip('simtk.unit')

self.mdt = md.load(data_filename("ala_small_traj.pdb"))
top = ops_omm.topology.MDTrajTopology(self.mdt.topology)
Expand Down
2 changes: 1 addition & 1 deletion openpathsampling/netcdfplus/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
short_version = '1.4.0'
short_version = '1.4.1'
version = short_version
full_version = short_version
git_revision = 'alpha'
Expand Down
12 changes: 5 additions & 7 deletions openpathsampling/tests/test_features.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from __future__ import absolute_import
from builtins import hex
from builtins import object
from nose.tools import (assert_equal, assert_not_equal,
assert_almost_equal, raises, assert_in)
from nose.tools import raises

from nose.plugins.skip import Skip, SkipTest
from .test_helpers import (true_func, assert_equal_array_array,
make_1d_traj, assert_items_equal, u)
from nose.plugins.skip import SkipTest
from .test_helpers import u

import logging

Expand Down Expand Up @@ -43,7 +41,7 @@ def test_copy_with_replacement_toy(self):
assert(toy_copy.velocities[1] == 1.0)

def test_copy_with_replacement_openmm(self):
if not paths.integration_tools.HAS_OPENMM:
if not paths.integration_tools.HAS_OPENMM or omt is None:
raise SkipTest
# test an openmm snapshot
sys = omt.testsystems.AlanineDipeptideVacuum()
Expand Down Expand Up @@ -71,4 +69,4 @@ def test_parameter_error(self):
init_vel = np.array([3.0, 4.0])
toy_snap = toy_engine.Snapshot(
coordinates=init_coord, velocities=init_vel)
toy_copy = toy_snap.copy_with_replacement(dummy=0)
toy_snap.copy_with_replacement(dummy=0)
26 changes: 12 additions & 14 deletions openpathsampling/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
except ImportError:
md = None

from nose.tools import assert_equal, assert_in, assert_true
#from nose.tools import assert_items_equal
from pkg_resources import resource_filename

import openpathsampling as paths
Expand Down Expand Up @@ -61,20 +59,20 @@ def make_1d_traj(coordinates, velocities=None, engine=None):
return paths.Trajectory(traj)

def items_equal(truth, beauty):
assert_equal(len(truth), len(beauty))
assert len(truth) == len(beauty)
for (t, b) in zip(truth, beauty):
if t != b:
return False
return True

def assert_items_equal(truth, beauty):
assert_equal(len(truth), len(beauty))
assert len(truth) == len(beauty)
for (t, b) in zip(truth, beauty):
assert_equal(t, b)
assert t == b

def assert_items_almost_equal(truth, beauty, tol=10e-7):
for (t,b) in zip(truth, beauty):
assert_equal( abs(t-b) - tol < 0.0, True)
assert abs(t-b) - tol < 0.0


def assert_equal_array_array(truth, beauty):
Expand All @@ -90,9 +88,9 @@ def assert_not_equal_array_array(list_a, list_b):
return exist_diff

def assert_same_items(list_a, list_b):
assert_equal(len(list_a), len(list_b))
assert len(list_a) == len(list_b)
for elem_a in list_a:
assert_in(elem_a, list_b)
assert elem_a in list_b


class MoverWithSignature(paths.PathMover):
Expand Down Expand Up @@ -306,18 +304,18 @@ def _wrapper(*args, **kwargs):
return decorator

def assert_frame_equal(truth, beauty):
assert_equal(len(truth.index), len(beauty.index))
assert_equal(len(truth.columns), len(beauty.columns))
assert_equal(set(truth.index), set(beauty.index))
assert_equal(set(truth.columns), set(beauty.columns))
assert len(truth.index) == len(beauty.index)
assert len(truth.columns) == len(beauty.columns)
assert set(truth.index) == set(beauty.index)
assert set(truth.columns) == set(beauty.columns)
for idx in truth.index:
for col in truth.columns:
truth_val = truth.loc[idx, col]
beauty_val = beauty.loc[idx, col]
if np.isnan(truth_val):
assert_true(np.isnan(beauty_val))
assert np.isnan(beauty_val)
else:
assert_equal(truth_val, beauty_val)
assert truth_val == beauty_val

def A2BEnsemble(volume_a, volume_b, trusted=True):
# this is a little replacement for the same name that used to be in
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = openpathsampling
version = 1.4.0
version = 1.4.1
description = A Python package for path sampling simulations
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -49,6 +49,9 @@ test =
pytest-cov
coveralls
ipynbtest
simstore =
sqlalchemy
dill

[bdist_wheel]
universal = 1