From 75e2e040edee78139ea5e60e9dcf8962fa54cb7c Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 24 Jan 2024 00:19:05 +0100 Subject: Making look method as analysis iterator. --- .../advanced_topics/scripting.md | 47 +++++++++++----------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'docs/user_guide') diff --git a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md index 9e65c08..12e45f7 100644 --- a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md +++ b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md @@ -73,8 +73,20 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho try: - # Look ArFrame at a timestamped gaze position - ar_frame.look(timestamp, gaze_position).values() + # Look ArFrame at a timestamped gaze position and iterate over analysis + for element, module, analysis in ar_frame.look(timestamp, gaze_position): + + # Ckeck if analysis comes from frame + if ArFeatures.is_frame(element): + + # Do something with scan path module analysis + ... + + # Ckeck if analysis comes from frame + elif ArFeatures.is_layer(element): + + # Do something with aoi scan path module analysis + ... # Do something with calibrated gaze position ... ar_frame.gaze_position @@ -90,27 +102,6 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho elif GazeFeatures.is_saccade(ar_frame.gaze_movement): ... - # Check if new scan path analysis are available - if ar_frame.new_analysis_available: - - # Access to each scan path analyzer - for analyzer_name, analyzer in ar_frame.scan_path_analyzers.items(): - - # Do something with analysis results - ... analyzer.analysis - - # Iterate over each ArFrame layers - for name, ar_layer in ar_frame.layers.items(): - - # Check if new aoi scan path analysis are available - if ar_layer.new_analysis_available: - - # Access to each aoi scan path analyzer - for analyzer_name, analyzer in ar_layer.aoi_scan_path_analyzers.items(): - - # Do something with analysis results - ... analyzer.analysis - # Do something with pipeline exception except Exception as e: @@ -119,6 +110,16 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho Let's understand the meaning of each data. +### *element, module, analysis* + +Looking at [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) leads inner [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) scan path analyzers and inner [Arlayers](../../../argaze.md/#argaze.ArFeatures.ArLayer) aoi scan path analysis to produce analysis. + +The *element* returning analysis can be tested thanks to [ArFeatures.is_frame](../../../argaze.md/#argaze.ArFeatures.is_frame) and [ArFeatures.is_layer](../../../argaze.md/#argaze.ArFeatures.is_layer) functions. + +The *module* is the type of scan path or aoi scan path analyzer. + +The *analysis* is a dictionnary containing all analysis produced by the module. + ### *ar_frame.gaze_position* This is the calibrated [GazePosition](../../../argaze.md/#argaze.GazeFeatures.GazePosition) returned by [GazePositionCalibrator](../../../argaze.md/#argaze.GazeFeatures.GazePositionCalibrator) if one is instanciated else, it is the given [GazePosition](../../../argaze.md/#argaze.GazeFeatures.GazePosition). -- cgit v1.1