aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/GazeAnalysis/TransitionProbabilityMatrix.py10
-rw-r--r--src/argaze/GazeFeatures.py18
-rw-r--r--src/argaze/utils/demo_gaze_features_run.py16
3 files changed, 22 insertions, 22 deletions
diff --git a/src/argaze/GazeAnalysis/TransitionProbabilityMatrix.py b/src/argaze/GazeAnalysis/TransitionProbabilityMatrix.py
index e27265d..55ea43b 100644
--- a/src/argaze/GazeAnalysis/TransitionProbabilityMatrix.py
+++ b/src/argaze/GazeAnalysis/TransitionProbabilityMatrix.py
@@ -9,7 +9,7 @@ from argaze import GazeFeatures
import pandas
@dataclass
-class VisualScanAnalyzer(GazeFeatures.VisualScanAnalyzer):
+class VisualScanPathAnalyzer(GazeFeatures.VisualScanPathAnalyzer):
"""Implementation of transition probability matrix algorithm as described in ...
"""
@@ -17,16 +17,16 @@ class VisualScanAnalyzer(GazeFeatures.VisualScanAnalyzer):
pass
- def analyze(self, visual_scan: GazeFeatures.VisualScanType) -> Any:
+ def analyze(self, visual_scan_path: GazeFeatures.VisualScanPathType) -> Any:
"""Analyze visual scan."""
- assert(len(visual_scan) > 1)
+ assert(len(visual_scan_path) > 1)
sequence = []
- for step in visual_scan:
+ for visual_scan_step in visual_scan_path:
- sequence.append(step.aoi)
+ sequence.append(visual_scan_step.aoi)
return pandas.crosstab(pandas.Series(sequence[1:], name='to'), pandas.Series(sequence[:-1], name='from'), normalize=1)
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 3daea8f..1129849 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -351,11 +351,11 @@ class VisualScanStep():
return last_ts - first_ts
-VisualScanType = TypeVar('VisualScanType', bound="VisualScanType")
+VisualScanPathType = TypeVar('VisualScanPathType', bound="VisualScanPathType")
# Type definition for type annotation convenience
-class VisualScan(list):
- """List visual scan steps over successive aoi."""
+class VisualScanPath(list):
+ """List of visual scan steps over successive aoi."""
def __init__(self):
@@ -381,7 +381,7 @@ class VisualScan(list):
return output
def append_saccade(self, ts, saccade):
- """Append new saccade to visual scan."""
+ """Append new saccade to visual scan path."""
# Ignore saccade if no fixation have been stored before
if len(self.__movements) > 0:
@@ -389,7 +389,7 @@ class VisualScan(list):
self.__movements[ts] = saccade
def append_fixation(self, ts, fixation, looked_aoi: str) -> bool:
- """Append new fixation to visual scan and return last new visual scan step if one have been created.
+ """Append new fixation to visual scan path and return last new visual scan step if one have been created.
.. warning::
It could raise VisualScanStepError"""
@@ -428,10 +428,10 @@ class VisualScan(list):
return None
-class VisualScanAnalyzer():
- """Abstract class to define what should provide a visual scan analyzer."""
+class VisualScanPathAnalyzer():
+ """Abstract class to define what should provide a visual scan path analyzer."""
- def analyze(self, visual_scan: VisualScanType) -> Any:
- """Analyze visual scan."""
+ def analyze(self, visual_scan_path: VisualScanPathType) -> Any:
+ """Analyze visual scan path."""
raise NotImplementedError('analyze() method not implemented')
diff --git a/src/argaze/utils/demo_gaze_features_run.py b/src/argaze/utils/demo_gaze_features_run.py
index c47ba14..4a6527c 100644
--- a/src/argaze/utils/demo_gaze_features_run.py
+++ b/src/argaze/utils/demo_gaze_features_run.py
@@ -40,8 +40,8 @@ def main():
# Init gaze movements processing
gaze_position = GazeFeatures.GazePosition()
gaze_movement_identifier = DispersionThresholdIdentification.GazeMovementIdentifier(args.deviation_max_threshold, args.duration_min_threshold)
- visual_scan = GazeFeatures.VisualScan()
- tpm = TransitionProbabilityMatrix.VisualScanAnalyzer()
+ visual_scan_path = GazeFeatures.VisualScanPath()
+ tpm = TransitionProbabilityMatrix.VisualScanPathAnalyzer()
tpm_analysis = None
gaze_movement_lock = threading.Lock()
@@ -87,13 +87,13 @@ def main():
try:
- # Append fixation to visual scan
- new_step = visual_scan.append_fixation(data_ts, gaze_movement, look_at)
+ # Append fixation to visual scan path
+ new_step = visual_scan_path.append_fixation(data_ts, gaze_movement, look_at)
# Analyse transition probabilities
- if new_step and len(visual_scan) > 1:
+ if new_step and len(visual_scan_path) > 1:
- tpm_analysis = tpm.analyze(visual_scan)
+ tpm_analysis = tpm.analyze(visual_scan_path)
print(tpm_analysis)
@@ -103,8 +103,8 @@ def main():
if isinstance(gaze_movement, DispersionThresholdIdentification.Saccade):
- # Append saccade to visual scan
- visual_scan.append_saccade(data_ts, gaze_movement)
+ # Append saccade to visual scan path
+ visual_scan_path.append_saccade(data_ts, gaze_movement)
# Unlock gaze movement exploitation
gaze_movement_lock.release()