diff options
-rw-r--r-- | src/argaze/utils/demo_gaze_features_run.py | 15 |
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) |