aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/ArFeatures.py76
1 files changed, 35 insertions, 41 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 63768ec..b9a29de 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -387,59 +387,56 @@ class ArLayer():
try:
- # Check gaze movement validity
- if gaze_movement.valid:
+ if self.aoi_matcher is not None:
- if self.aoi_matcher is not None:
+ # Store aoi matching start date
+ matching_start = time.perf_counter()
- # Store aoi matching start date
- matching_start = time.perf_counter()
+ # 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, looked_aoi = self.aoi_matcher.match(self.aoi_scene, gaze_movement)
- # Update looked aoi thanks to aoi matcher
- # Note: don't filter finished/unfinished fixation/saccade as we don't know how the aoi matcher works internally
- looked_aoi_name, looked_aoi = self.aoi_matcher.match(self.aoi_scene, gaze_movement)
+ # Assess aoi matching time in ms
+ execution_times['aoi_matcher'] = (time.perf_counter() - matching_start) * 1e3
- # Assess aoi matching time in ms
- execution_times['aoi_matcher'] = (time.perf_counter() - matching_start) * 1e3
-
- # Finished gaze movement has been identified
- if gaze_movement.finished:
+ # Valid and finished gaze movement has been identified
+ if gaze_movement.valid and gaze_movement.finished:
- if GazeFeatures.is_fixation(gaze_movement):
+ 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:
+ # Append fixation to aoi scan path
+ if self.aoi_scan_path is not None and 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, looked_aoi_name)
- # Is there a new step?
- if aoi_scan_step is not None and len(self.aoi_scan_path) > 1:
+ # Is there a new step?
+ if aoi_scan_step is not None and len(self.aoi_scan_path) > 1:
- for aoi_scan_path_analyzer_module_path, aoi_scan_path_analyzer in self.aoi_scan_path_analyzers.items():
+ for aoi_scan_path_analyzer_module_path, aoi_scan_path_analyzer in self.aoi_scan_path_analyzers.items():
- # Store aoi scan path analysis start date
- aoi_scan_path_analysis_start = time.perf_counter()
+ # Store aoi scan path analysis start date
+ aoi_scan_path_analysis_start = time.perf_counter()
- # Analyze aoi scan path
- aoi_scan_path_analyzer.analyze(self.aoi_scan_path)
+ # Analyze aoi scan path
+ aoi_scan_path_analyzer.analyze(self.aoi_scan_path)
- # Assess aoi scan step analysis time in ms
- execution_times['aoi_scan_step_analyzers'][aoi_scan_path_analyzer_module_path] = (time.perf_counter() - aoi_scan_path_analysis_start) * 1e3
+ # Assess aoi scan step analysis time in ms
+ execution_times['aoi_scan_step_analyzers'][aoi_scan_path_analyzer_module_path] = (time.perf_counter() - aoi_scan_path_analysis_start) * 1e3
- # Store analysis
- aoi_scan_path_analysis[aoi_scan_path_analyzer_module_path] = aoi_scan_path_analyzer.analysis
+ # Store analysis
+ aoi_scan_path_analysis[aoi_scan_path_analyzer_module_path] = aoi_scan_path_analyzer.analysis
- # Log analysis
- if self.log:
+ # Log analysis
+ if self.log:
- self.__ts_logs[aoi_scan_path_analyzer_module_path][timestamp] = aoi_scan_path_analyzer.analysis
+ self.__ts_logs[aoi_scan_path_analyzer_module_path][timestamp] = aoi_scan_path_analyzer.analysis
- elif GazeFeatures.is_saccade(gaze_movement):
+ elif GazeFeatures.is_saccade(gaze_movement):
- # Append saccade to aoi scan path
- if self.aoi_scan_path is not None:
+ # Append saccade to aoi scan path
+ if self.aoi_scan_path is not None:
- self.aoi_scan_path.append_saccade(timestamp, gaze_movement)
+ self.aoi_scan_path.append_saccade(timestamp, gaze_movement)
except Exception as e:
@@ -912,11 +909,7 @@ class ArFrame():
# No valid finished gaze movement: optionnaly stop in progress identification filtering
elif self.gaze_movement_identifier is not None and not self.filter_in_progress_identification:
- current_gaze_movement = self.gaze_movement_identifier.current_gaze_movement
-
- if current_gaze_movement.valid:
-
- identified_gaze_movement = current_gaze_movement
+ identified_gaze_movement = self.gaze_movement_identifier.current_gaze_movement
# Update heatmap
if self.heatmap is not None:
@@ -933,7 +926,8 @@ class ArFrame():
# Assess heatmap time in ms
execution_times['heatmap'] = (time.perf_counter() - heatmap_start) * 1e3
- # Look layers
+ # Look layers with valid identified gaze movement
+ # Note: don't filter valid/unvalid finished/unfished gaze movement to allow layers to reset internally
for layer_name, layer in self.layers.items():
looked_aoi, aoi_scan_path_analysis, layer_execution_times, layer_exception = layer.look(timestamp, identified_gaze_movement)