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

Fix post hoc pupil detection progress for zero total frames #2063

Merged
merged 1 commit into from
Dec 2, 2020
Merged
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
Fix "division by zero" in post-hoc pupil detection progress
  • Loading branch information
romanroibu committed Dec 2, 2020
commit ee73e5532e337b38678652f658186c1781c6504d
9 changes: 6 additions & 3 deletions pupil_src/shared_modules/pupil_producers.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,12 @@ def detection_progress(self) -> float:

for eye_id in (0, 1):
total_frames = self.eye_frame_num[eye_id]
current_index = self.eye_frame_idx[eye_id]
progress = (current_index + 1) / total_frames
progress = max(0.0, min(progress, 1.0))
if total_frames > 0:
current_index = self.eye_frame_idx[eye_id]
progress = (current_index + 1) / total_frames
progress = max(0.0, min(progress, 1.0))
else:
progress = 1.0
progress_by_eye[eye_id] = progress

return min(progress_by_eye)
Expand Down