aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-10-04 19:37:36 +0200
committerThéo de la Hogue2023-10-04 19:37:36 +0200
commitc55fccdb1e8c26ea08c1cb36fa9178cfbc89dba8 (patch)
tree5b237b807d9a52284d70a95f902e482fbbcf969b
parent59d47fa2ea032c5d47812e9b7b5e80cec344f59a (diff)
downloadargaze-c55fccdb1e8c26ea08c1cb36fa9178cfbc89dba8.zip
argaze-c55fccdb1e8c26ea08c1cb36fa9178cfbc89dba8.tar.gz
argaze-c55fccdb1e8c26ea08c1cb36fa9178cfbc89dba8.tar.bz2
argaze-c55fccdb1e8c26ea08c1cb36fa9178cfbc89dba8.tar.xz
Adding aoi fixation distribution to Basic module.
-rw-r--r--src/argaze/GazeAnalysis/Basic.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/argaze/GazeAnalysis/Basic.py b/src/argaze/GazeAnalysis/Basic.py
index 7b41731..dc7b4fd 100644
--- a/src/argaze/GazeAnalysis/Basic.py
+++ b/src/argaze/GazeAnalysis/Basic.py
@@ -79,12 +79,27 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer):
self.__steps_number = len(aoi_scan_path)
sum_fixation_durations = 0
+ self.__sum_aoi_fixation_durations = {}
for aoi_scan_step in aoi_scan_path:
sum_fixation_durations += aoi_scan_step.fixation_duration
+ try:
+
+ self.__sum_aoi_fixation_durations[aoi_scan_step.aoi] = self.__sum_aoi_fixation_durations[aoi_scan_step.aoi] + aoi_scan_step.fixation_duration
+
+ except KeyError:
+
+ self.__sum_aoi_fixation_durations[aoi_scan_step.aoi] = aoi_scan_step.fixation_duration
+
self.__step_fixation_durations_average = sum_fixation_durations / self.__steps_number
+
+ self.__aoi_fixation_distribution = {}
+
+ for aoi_name, sum_aoi_fixation_duration in self.__sum_aoi_fixation_durations.items():
+
+ self.__aoi_fixation_distribution[aoi_name] = sum_aoi_fixation_duration / sum_fixation_durations
@property
def path_duration(self) -> float:
@@ -102,4 +117,10 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer):
def step_fixation_durations_average(self) -> float:
"""AOI scan path step fixation durations average."""
- return self.__step_fixation_durations_average \ No newline at end of file
+ return self.__step_fixation_durations_average
+
+ @property
+ def aoi_fixation_distribution(self) -> dict:
+ """percentage of time spent on each AOI."""
+
+ return self.__aoi_fixation_distribution \ No newline at end of file