Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetle committed Jul 8, 2016
1 parent 784a5f7 commit 566501f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions package/MDAnalysis/analysis/diffusionmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
import logging
import warnings

import MDAnalysis.Universe as universe
from MDAnalysis.core.AtomGroup import Universe
import numpy as np

from .rms import rmsd
Expand Down Expand Up @@ -230,11 +230,11 @@ def __init__(self, u, select='all', metric=rmsd, cutoff=1E0-5,
self._cutoff = cutoff
self._weights = weights
self._calculated = False
# remember that this must be called before referencing self.nframes
# remember that this must be called before referencing self.n_frames
self._setup_frames(traj, start, stop, step)

def _prepare(self):
self.dist_matrix = np.zeros((self.nframes, self.nframes))
self.dist_matrix = np.zeros((self.n_frames, self.n_frames))

def _single_frame(self):
iframe = self._ts.frame
Expand Down Expand Up @@ -326,7 +326,7 @@ def __init__(self, u, epsilon=1, **kwargs):
step : int, optional
Step between frames to analyse, Default: 1
"""
if isinstance(u, universe):
if isinstance(u, Universe):
self._dist_matrix = DistanceMatrix(u, **kwargs)
elif isinstance(u, DistanceMatrix):
self._dist_matrix = u
Expand All @@ -335,8 +335,8 @@ def __init__(self, u, epsilon=1, **kwargs):
" so the DiffusionMap has no data to work with.")
self._epsilon = epsilon
# important for transform function and length of .run() method
self._nframes = self._dist_matrix.nframes
if self._nframes > 5000:
self._n_frames = self._dist_matrix.n_frames
if self._n_frames > 5000:
warnings.warn("The distance matrix is very large, and can "
"be very slow to compute. Consider picking a larger "
"step size in distance matrix initialization.")
Expand Down
6 changes: 3 additions & 3 deletions testsuite/MDAnalysisTests/analysis/test_diffusionmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ def setUp(self):

def test_eg(self):
# number of frames is trajectory is now 10 vs. 98
assert_equal(self.eigvals.shape, (self.dist.nframes, ))
assert_equal(self.eigvals.shape, (self.dist.n_frames, ))
# makes no sense to test values here, no physical meaning

def test_dist_weights(self):
backbone = self.u.select_atoms('backbone')
weights_atoms = np.ones(len(backbone.atoms))
self.dist = diffusionmap.DistanceMatrix(self.u, select='backbone',
weights=weights_atoms)
weights=weights_atoms)
self.dist.run()

def test_different_steps(self):
self.dmap = diffusionmap.DiffusionMap(self.u, select='backbone', step=3)
self.dmap.run()

def test_transform(self):
self.n_eigenvectors = 4
self.dmap = diffusionmap.DiffusionMap(self.u)
Expand Down

0 comments on commit 566501f

Please sign in to comment.