Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Prediction fails on empty frames #367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions trackpy/tests/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def test_simple_predict(self):
pred.link_df_iter, 0.45)
assert all(ll.values == 3)

def test_empty_predict(self):
"""Check what happens if there is an empty frame"""
pred = self.predict_class()
empty = pandas.DataFrame({'x': [], 'y': [], 'frame': []})
ll = get_linked_lengths((self.mkframe(0), self.mkframe(0.25), empty, self.mkframe(0.65)),
pred.link_df_iter, 0.45)
assert all(ll.values == 3)

def test_big_predict(self):
Nside = Nside_oversize
pred = self.predict_class()
Expand Down