diff options
-rw-r--r-- | src/argaze/GazeAnalysis/DeviationCircleCoverage.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py index 2138899..3d910c7 100644 --- a/src/argaze/GazeAnalysis/DeviationCircleCoverage.py +++ b/src/argaze/GazeAnalysis/DeviationCircleCoverage.py @@ -22,6 +22,7 @@ import numpy from argaze import GazeFeatures, DataFeatures from argaze.AreaOfInterest import AOIFeatures +from argaze.GazeAnalysis import DispersionThresholdIdentification, VelocityThresholdIdentification class AOIMatcher(GazeFeatures.AOIMatcher): @@ -70,8 +71,23 @@ class AOIMatcher(GazeFeatures.AOIMatcher): for name, aoi in aoi_scene.items(): - # BAD: we use deviation_max attribute which is an attribute of DispersionThresholdIdentification.Fixation class - region, _, circle_ratio = aoi.circle_intersection(gaze_movement.focus, gaze_movement.deviation_max) + # DispersionThresholdIdentification.Fixation: use maximal deviation + if issubclass(type(gaze_movement), DispersionThresholdIdentification.Fixation): + + fixation_circle_radius = gaze_movement.deviation_max + + # VelocityThresholdIdentification.Fixation: use amplitude + elif issubclass(type(gaze_movement), VelocityThresholdIdentification.Fixation): + + fixation_circle_radius = gaze_movement.amplitude + + # Otherwise, compute maximal deviation + else: + + fixation_circle_radius = max(gaze_movement.distances(gaze_movement.focus)) + + # Intersect + region, _, circle_ratio = aoi.circle_intersection(gaze_movement.focus, fixation_circle_radius) if name not in self.exclude and circle_ratio > self.__coverage_threshold: |