diff --git a/trackpy/motion.py b/trackpy/motion.py index cd2514e6..553d5a88 100644 --- a/trackpy/motion.py +++ b/trackpy/motion.py @@ -381,7 +381,7 @@ def vanhove(pos, lagtime, mpp=1, ensemble=False, bins=24): Examples -------- >>> pos = traj.set_index(['frame', 'particle'])['x'].unstack() # particles as columns - >>> vh = vanhove(pos) + >>> vh = vanhove(pos, lagtime=2) """ # Reindex with consecutive frames, placing NaNs in the gaps. pos = pos.reindex(np.arange(pos.index[0], 1 + pos.index[-1])) diff --git a/trackpy/tests/test_motion.py b/trackpy/tests/test_motion.py index 054ec320..4cdcb257 100644 --- a/trackpy/tests/test_motion.py +++ b/trackpy/tests/test_motion.py @@ -206,6 +206,24 @@ def test_theta_entropy(self): self.steppers.groupby('particle').apply(theta_entropy) +class TestVanHove(StrictTestCase): + def setUp(self): + N = 10 + P = 50 # particles + A = 1 # step amplitude + np.random.seed(0) + particles = [DataFrame({'x': A*random_walk(N), 'y': A*random_walk(N), + 'frame': np.arange(N), 'particle': i}) + for i in range(P)] + self.many_walks = conformity(pandas_concat(particles)) + + def test_vanhove(self): + # a simple "smoke test" to ensure no exceptions are raised + traj = self.many_walks + pos = traj.set_index(['frame', 'particle'])['x'].unstack() # particles as columns + vh = tp.vanhove(pos, lagtime=2) + + if __name__ == '__main__': import nose nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],