From 1ecdbdc1427a1a3d73060686b4e9baa73487cde9 Mon Sep 17 00:00:00 2001 From: Prohurtz <48768484+RedHawk989@users.noreply.github.com> Date: Fri, 24 Nov 2023 18:08:49 -0600 Subject: [PATCH] fix: dilation crash --- EyeTrackApp/ellipse_based_pupil_dilation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/EyeTrackApp/ellipse_based_pupil_dilation.py b/EyeTrackApp/ellipse_based_pupil_dilation.py index 440c04a..3bb8839 100644 --- a/EyeTrackApp/ellipse_based_pupil_dilation.py +++ b/EyeTrackApp/ellipse_based_pupil_dilation.py @@ -359,9 +359,10 @@ class EllipseBasedPupilDilation: minp = float(self.maxval) try: - eyedilation = (pupil_area - maxp) / ( - minp - maxp - ) # for whatever reason when input and maxp are too close it outputs high + if maxp != 0 and not (np.isnan(pupil_area) or np.isnan(maxp)): + eyedilation = (pupil_area - maxp) / ( + minp - maxp + ) # for whatever reason when input and maxp are too close it outputs high except: eyedilation = 0.5 eyedilation = 1 - eyedilation