aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2024-01-31 09:24:27 +0100
committerThéo de la Hogue2024-01-31 09:24:27 +0100
commit0d0094d39c04d32afecd33b3f197c409c38aa921 (patch)
treecf19f75cc11f3941e41585cd17e1e78b443bff88
parent719e1db3c07d0339acdc927fb6f66f8c2b9faa30 (diff)
downloadargaze-0d0094d39c04d32afecd33b3f197c409c38aa921.zip
argaze-0d0094d39c04d32afecd33b3f197c409c38aa921.tar.gz
argaze-0d0094d39c04d32afecd33b3f197c409c38aa921.tar.bz2
argaze-0d0094d39c04d32afecd33b3f197c409c38aa921.tar.xz
Considering fixations outside AOI as expected aoi.
-rw-r--r--src/argaze/ArFeatures.py3
-rw-r--r--src/argaze/GazeFeatures.py19
2 files changed, 17 insertions, 5 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 0cb1d77..0314466 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -420,7 +420,8 @@ class ArLayer(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
if GazeFeatures.is_fixation(gaze_movement):
# Append fixation to aoi scan path
- if self.__aoi_scan_path is not None and self.__looked_aoi_name is not None:
+ # TODO: add an option to filter None looked_aoi_name or not
+ if self.__aoi_scan_path is not None:
aoi_scan_step = self.__aoi_scan_path.append_fixation(timestamp, gaze_movement, self.__looked_aoi_name)
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 7254205..81a87c8 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -960,6 +960,9 @@ class AOIScanStep():
AOIScanPathType = TypeVar('AOIScanPathType', bound="AOIScanPathType")
# Type definition for type annotation convenience
+# Define strings for outside AOI case
+OutsideAOI = 'GazeFeatures.OutsideAOI'
+
class AOIScanPath(list):
"""List of aoi scan steps over successive aoi.
@@ -973,7 +976,7 @@ class AOIScanPath(list):
self.duration_max = duration_max
self.expected_aoi = expected_aoi
-
+
self.__duration = 0
@property
@@ -1042,7 +1045,9 @@ class AOIScanPath(list):
"""
self.clear()
- self.__expected_aoi = expected_aoi
+ self.__expected_aoi = [OutsideAOI]
+ self.__expected_aoi += expected_aoi
+
self.__movements = TimeStampedGazeMovements()
self.__current_aoi = ''
self.__index = ord('A')
@@ -1076,9 +1081,15 @@ class AOIScanPath(list):
"""Append new fixation to aoi scan path and return last new aoi scan step if one have been created.
!!! warning
- It could raise AOIScanStepError"""
+ It could raise AOIScanStepError"""
+
+ # Replace None aoi by generic OutsideAOI name
+ if looked_aoi is None:
+
+ looked_aoi = OutsideAOI
- if looked_aoi not in self.__expected_aoi:
+ # Raise error when aoi is not expected
+ elif looked_aoi not in self.__expected_aoi:
raise AOIScanStepError('AOI not expected', looked_aoi)