aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/PupilAnalysis
diff options
context:
space:
mode:
authorThéo de la Hogue2023-04-26 12:01:12 +0200
committerThéo de la Hogue2023-04-26 12:01:12 +0200
commit1f31352f020a0d7d4d98052c71d4a4f3d3b281a7 (patch)
treeb178d531103a32a40373a5688e18c6fa4700ab97 /src/argaze/PupilAnalysis
parent6a3a5c674a877aa6feaee73c3e9e9419c540cda6 (diff)
downloadargaze-1f31352f020a0d7d4d98052c71d4a4f3d3b281a7.zip
argaze-1f31352f020a0d7d4d98052c71d4a4f3d3b281a7.tar.gz
argaze-1f31352f020a0d7d4d98052c71d4a4f3d3b281a7.tar.bz2
argaze-1f31352f020a0d7d4d98052c71d4a4f3d3b281a7.tar.xz
Preventing from division by zero.
Diffstat (limited to 'src/argaze/PupilAnalysis')
-rw-r--r--src/argaze/PupilAnalysis/WorkloadIndex.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/argaze/PupilAnalysis/WorkloadIndex.py b/src/argaze/PupilAnalysis/WorkloadIndex.py
index 5ed5bee..6728595 100644
--- a/src/argaze/PupilAnalysis/WorkloadIndex.py
+++ b/src/argaze/PupilAnalysis/WorkloadIndex.py
@@ -36,7 +36,13 @@ class PupilDiameterAnalyzer(PupilFeatures.PupilDiameterAnalyzer):
if ts - self.__last_ts >= self.period:
- workload_index = (self.__variations_sum / self.__variations_number) / self.reference.value
+ if self.__variations_number > 0 and self.reference.value > 0.:
+
+ workload_index = (self.__variations_sum / self.__variations_number) / self.reference.value
+
+ else:
+
+ workload_index = 0.
self.__variations_sum = abs(pupil_diameter.value - self.reference.value)
self.__variations_number = 1