From 566501fde969218e3c2c053ff47f44b39e348ca5 Mon Sep 17 00:00:00 2001 From: John Detlefs Date: Fri, 8 Jul 2016 12:12:29 -0700 Subject: [PATCH] Fixed tests --- package/MDAnalysis/analysis/diffusionmap.py | 12 ++++++------ .../MDAnalysisTests/analysis/test_diffusionmap.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package/MDAnalysis/analysis/diffusionmap.py b/package/MDAnalysis/analysis/diffusionmap.py index 9a68f7d93c4..8c4a5bb042d 100644 --- a/package/MDAnalysis/analysis/diffusionmap.py +++ b/package/MDAnalysis/analysis/diffusionmap.py @@ -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 @@ -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 @@ -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 @@ -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.") diff --git a/testsuite/MDAnalysisTests/analysis/test_diffusionmap.py b/testsuite/MDAnalysisTests/analysis/test_diffusionmap.py index 2769e88607f..bd05b36fb4b 100644 --- a/testsuite/MDAnalysisTests/analysis/test_diffusionmap.py +++ b/testsuite/MDAnalysisTests/analysis/test_diffusionmap.py @@ -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)