aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-10 11:17:26 +0200
committerThéo de la Hogue2023-05-10 11:17:26 +0200
commitb85a62c410ab47c1a3409548f4b6dd8c229257d2 (patch)
treec08e09bb99e2d1bba9c9325e06f27b6840a2437c /src
parentc7a47815417ee0fbf5f187e2a422ab1adfdce28c (diff)
downloadargaze-b85a62c410ab47c1a3409548f4b6dd8c229257d2.zip
argaze-b85a62c410ab47c1a3409548f4b6dd8c229257d2.tar.gz
argaze-b85a62c410ab47c1a3409548f4b6dd8c229257d2.tar.bz2
argaze-b85a62c410ab47c1a3409548f4b6dd8c229257d2.tar.xz
Updating renamed file.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/utils/demo_gaze_features_run.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/argaze/utils/demo_gaze_features_run.py b/src/argaze/utils/demo_gaze_features_run.py
index aa11e10..c47ba14 100644
--- a/src/argaze/utils/demo_gaze_features_run.py
+++ b/src/argaze/utils/demo_gaze_features_run.py
@@ -39,9 +39,10 @@ def main():
# Init gaze movements processing
gaze_position = GazeFeatures.GazePosition()
- gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(args.deviation_max_threshold, args.duration_min_threshold)
+ gaze_movement_identifier = DispersionThresholdIdentification.GazeMovementIdentifier(args.deviation_max_threshold, args.duration_min_threshold)
visual_scan = GazeFeatures.VisualScan()
tpm = TransitionProbabilityMatrix.VisualScanAnalyzer()
+ tpm_analysis = None
gaze_movement_lock = threading.Lock()
# Init timestamp
@@ -51,6 +52,7 @@ def main():
def on_mouse_event(event, x, y, flags, param):
nonlocal gaze_position
+ nonlocal tpm_analysis
# Edit millisecond timestamp
data_ts = int((time.time() - start_ts) * 1e3)
@@ -68,7 +70,7 @@ def main():
# Identify gaze movement
gaze_movement = gaze_movement_identifier.identify(data_ts, gaze_position)
- if isinstance(gaze_movement, DispersionBasedGazeMovementIdentifier.Fixation):
+ if isinstance(gaze_movement, DispersionThresholdIdentification.Fixation):
# Does the fixation match an AOI?
look_at = 'Screen'
@@ -88,15 +90,18 @@ def main():
# Append fixation to visual scan
new_step = visual_scan.append_fixation(data_ts, gaze_movement, look_at)
+ # Analyse transition probabilities
if new_step and len(visual_scan) > 1:
- print(tpm.analyze(visual_scan))
+ tpm_analysis = tpm.analyze(visual_scan)
+
+ print(tpm_analysis)
except GazeFeatures.VisualScanStepError as e:
- print(e)
+ print(f'Error on {e.aoi} step:', e)
- if isinstance(gaze_movement, DispersionBasedGazeMovementIdentifier.Saccade):
+ if isinstance(gaze_movement, DispersionThresholdIdentification.Saccade):
# Append saccade to visual scan
visual_scan.append_saccade(data_ts, gaze_movement)