Skip to content

Commit

Permalink
Updated tests, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdetle committed Jul 16, 2016
1 parent b299d89 commit cc384f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package/MDAnalysis/analysis/diffusionmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class DiffusionMap(object):
Attributes
----------
eigenvalues: array
eigenvalues: array ()
Eigenvalues of the diffusion map
Methods
Expand Down Expand Up @@ -357,7 +357,7 @@ def transform(self, n_eigenvectors, time):
values, more dominant eigenvectors determine diffusion distance.
Return
------
diffusion_space : array
diffusion_space : array (n_frames, n_eigenvectors)
The diffusion map embedding as defined by [Ferguson1]_.
"""
return (self._eigenvectors[1:n_eigenvectors+1,].T *
Expand Down
12 changes: 11 additions & 1 deletion testsuite/MDAnalysisTests/analysis/test_diffusionmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,22 @@ 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,
step=3)
self.dist.run()
self.dmap = diffusionmap.DiffusionMap(self.dist)
self.dmap.run()
assert_array_almost_equal(self.dmap.eigenvalues, [1,1,1,1], 4)
assert_array_almost_equal(self.dmap._eigenvectors,
([[ 0, 0, 1, 0],
[ 0, 0, 0, 1],
[ -.707,-.707, 0, 0],
[ .707,-.707, 0, 0]]) ,2)

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

def test_transform(self):
self.n_eigenvectors = 4
Expand Down

0 comments on commit cc384f1

Please sign in to comment.