aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/ArFeatures.py29
-rw-r--r--src/argaze/utils/demo_data/demo_gaze_analysis_setup.json4
2 files changed, 18 insertions, 15 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 30044a7..262ebd0 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -130,6 +130,9 @@ class ArLayer(DataFeatures.SharedObject):
# Init current gaze movement
self.__gaze_movement = GazeFeatures.UnvalidGazeMovement()
+ # Init current looked aoi name
+ self.__looked_aoi_name = None
+
# Init new analysis available state
self.__new_analysis_available = False
@@ -353,6 +356,12 @@ class ArLayer(DataFeatures.SharedObject):
self.__parent = parent
@property
+ def looked_aoi_name(self) -> str:
+ """The name of looked aoi."""
+
+ return self.__looked_aoi_name
+
+ @property
def new_analysis_available(self) -> bool:
"""Is there new aoi scan path analysis to check?"""
@@ -373,23 +382,20 @@ class ArLayer(DataFeatures.SharedObject):
# Lock layer exploitation
self.acquire()
- # Gather look data
- look_data = locals()
-
# Update current gaze movement
self.__gaze_movement = gaze_movement
# No new analysis available by default
self.__new_analysis_available = False
- # Init looked aoi name
- looked_aoi_name = None
+ # No looked aoi by default
+ self.__looked_aoi_name = None
if self.aoi_matcher is not None:
# Update looked aoi thanks to aoi matcher
# Note: don't filter valid/unvalid and finished/unfinished fixation/saccade as we don't know how the aoi matcher works internally
- looked_aoi_name, _ , match_time, match_exception = self.aoi_matcher.match(self.aoi_scene, gaze_movement)
+ self.__looked_aoi_name, _ , match_time, match_exception = self.aoi_matcher.match(self.aoi_scene, gaze_movement)
# Valid and finished gaze movement has been identified
if gaze_movement.valid and gaze_movement.finished:
@@ -397,9 +403,9 @@ class ArLayer(DataFeatures.SharedObject):
if GazeFeatures.is_fixation(gaze_movement):
# Append fixation to aoi scan path
- if self.aoi_scan_path is not None and looked_aoi_name is not None:
+ if self.aoi_scan_path is not None and self.__looked_aoi_name is not None:
- aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, gaze_movement, looked_aoi_name)
+ aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, gaze_movement, self.__looked_aoi_name)
# Is there a new step?
if aoi_scan_step is not None and len(self.aoi_scan_path) > 1:
@@ -422,7 +428,7 @@ class ArLayer(DataFeatures.SharedObject):
# Log look data
for logger_name, logger in self.loggers.items():
- logger.emit(look_data)
+ logger.emit(locals())
# Unlock layer exploitation
self.release()
@@ -827,9 +833,6 @@ class ArFrame(DataFeatures.SharedObject):
# Lock frame exploitation
self.acquire()
- # Store look arguments
- look_data = locals()
-
# No new analysis by default
self.__new_analysis_available = False
@@ -903,7 +906,7 @@ class ArFrame(DataFeatures.SharedObject):
# Log look data
for logger_name, logger in self.loggers.items():
- logger.emit(look_data)
+ logger.emit(locals())
# Unlock frame exploitation
self.release()
diff --git a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
index 2763a27..0600101 100644
--- a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
+++ b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
@@ -65,14 +65,14 @@
"path": "_export/logs/Fixations.csv",
"header": "Timestamp (ms), Focus (px), Duration (ms), AOI",
"selector": "GazeFeatures.is_fixation(self.gaze_movement) and self.gaze_movement.finished",
- "formatter": "timestamp, self.gaze_movement.focus, self.gaze_movement.duration, self.layers['main_layer'].aoi_matcher.looked_aoi_name"
+ "formatter": "timestamp, self.gaze_movement.focus, self.gaze_movement.duration, self.layers['main_layer'].looked_aoi_name"
}
},
"messages": {
"FileWriter" : {
"path": "_export/logs/Messages.csv",
"selector": "GazeFeatures.is_fixation(self.gaze_movement) and not self.gaze_movement.finished",
- "formatter": "f'FixationInProgress Start={self.gaze_movement.positions.first[0]} Duration={self.gaze_movement.duration} AOI={self.layers[\"main_layer\"].aoi_matcher.looked_aoi_name} Probabilities={self.layers[\"main_layer\"].aoi_matcher.looked_probabilities}'"
+ "formatter": "f'FixationInProgress Start={self.gaze_movement.positions.first[0]} Duration={self.gaze_movement.duration} AOI={self.layers[\"main_layer\"].looked_aoi_name} Probabilities={self.layers[\"main_layer\"].aoi_matcher.looked_probabilities}'"
}
},
"scan_path_metrics": {