diff options
author | Théo de la Hogue | 2023-04-26 12:01:12 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-04-26 12:01:12 +0200 |
commit | 1f31352f020a0d7d4d98052c71d4a4f3d3b281a7 (patch) | |
tree | b178d531103a32a40373a5688e18c6fa4700ab97 /src/argaze/PupilAnalysis | |
parent | 6a3a5c674a877aa6feaee73c3e9e9419c540cda6 (diff) | |
download | argaze-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.py | 8 |
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 |