From 98f3096bd4b5bf90123e5d7ef084eeba9320bcca Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Fri, 28 Jul 2023 21:02:01 +0200 Subject: Fixing __looked_aoi_covering_mean calculation. --- src/argaze/ArFeatures.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 0ed581d..a67ffe9 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -409,6 +409,7 @@ class ArFrame(): def __init_looked_aoi_data(self): """Init looked aoi data.""" + self.__look_count = 0 self.__looked_aoi = None self.__looked_aoi_covering_mean = 0 self.__looked_aoi_covering = {} @@ -416,6 +417,8 @@ class ArFrame(): def __update_looked_aoi_data(self, fixation): """Update looked aoi data.""" + self.__look_count += 1 + max_covering = 0. most_likely_looked_aoi = None @@ -434,7 +437,7 @@ class ArFrame(): self.__looked_aoi_covering[name] = circle_ratio - # Update most likely aoi + # Update most likely looked aoi if self.__looked_aoi_covering[name] > max_covering: most_likely_looked_aoi = name @@ -444,7 +447,7 @@ class ArFrame(): self.__looked_aoi = most_likely_looked_aoi # Update looked aoi covering mean - self.__looked_aoi_covering_mean = int(100 * max_covering / (len(fixation.positions) - 2)) / 100 + self.__looked_aoi_covering_mean = int(100 * max_covering / self.__look_count) / 100 def look(self, timestamp: int|float, inner_gaze_position: GazeFeatures.GazePosition = GazeFeatures.UnvalidGazePosition(), identified_gaze_movement: GazeFeatures.GazeMovement = GazeFeatures.UnvalidGazeMovement()) -> Tuple[GazeFeatures.GazeMovement, dict, dict, dict]: """ @@ -603,10 +606,10 @@ class ArFrame(): # Assess heatmap time in ms times['heatmap'] = (time.time() - heatmap_start) * 1e3 - + except Exception as e: - print(e) + print('Warning: the following error occurs in ArFrame.look method:', e) returned_fixation = GazeFeatures.UnvalidGazeMovement() scan_step_analysis = {} -- cgit v1.1