Skip to content

Commit

Permalink
TST: Test direction_corr and relate_frames
Browse files Browse the repository at this point in the history
  • Loading branch information
nkeim committed Jul 7, 2020
1 parent 4a6aedb commit 6d722b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions trackpy/tests/test_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,25 @@ def test_theta_entropy(self):
theta_entropy = lambda x: tp.motion.theta_entropy(x, plot=False)
self.steppers.groupby('particle').apply(theta_entropy)

def test_relate_frames(self):
# Check completeness of output
pos_columns = ['x', 'y']
f1, f2 = 2, 6
df = tp.motion.relate_frames(self.steppers, f1, f2, pos_columns=pos_columns)
for c in pos_columns:
assert c in df
assert c + '_b' in df
assert 'd' + c in df
assert 'dr' in df
assert 'direction' in df

def test_direction_corr(self):
# just a smoke test
f1, f2 = 2, 6
df = tp.motion.direction_corr(self.steppers, f1, f2)
# Only 2 particles, so only 1 correlation
assert len(df) == 1


if __name__ == '__main__':
import unittest
Expand Down

0 comments on commit 6d722b5

Please sign in to comment.