From 0c5fb0f3ec5f773797fc08ec769f33e332c7dd46 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 10 Apr 2024 20:04:45 +0200 Subject: Updating documentation. --- .../advanced_topics/gaze_position_calibration.md | 17 ++++++---- .../advanced_topics/module_loading.md | 37 ++++++---------------- .../advanced_topics/scripting.md | 29 ++++++++++------- 3 files changed, 38 insertions(+), 45 deletions(-) (limited to 'docs/user_guide/gaze_analysis_pipeline/advanced_topics') diff --git a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/gaze_position_calibration.md b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/gaze_position_calibration.md index 1960763..4970dba 100644 --- a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/gaze_position_calibration.md +++ b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/gaze_position_calibration.md @@ -13,13 +13,16 @@ Here is an extract from the JSON ArFrame configuration file where a [Linear Regr ```json { - "name": "My FullHD screen", - "size": [1920, 1080], - ... - "gaze_position_calibrator": { - "LinearRegression": {} - }, - ... + "argaze.ArFeatures.ArFrame": { + "name": "My FullHD screen", + "size": [1920, 1080], + ... + "gaze_position_calibrator": { + "LinearRegression": {} + }, + ... + } +} ``` !!! note When a [GazePositionCalibrator](../../../argaze.md/#argaze.GazeFeatures.GazePositionCalibrator) is instantiated, each gaze position passed to [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) method will be transformed before gaze movement identification step. diff --git a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/module_loading.md b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/module_loading.md index 8250382..8242a7f 100644 --- a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/module_loading.md +++ b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/module_loading.md @@ -1,34 +1,16 @@ -Load modules from another package -================================= +Load objects from external package +================================== -It is possible to load [GazeMovementIdentifier](../../../argaze.md/#argaze.GazeFeatures.GazeMovementIdentifier), [ScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.ScanPathAnalyzer), [AOIMatcher](../../../argaze.md/#argaze.GazeFeatures.AOIMatcher) or [AOIScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.AOIScanPathAnalyzer) modules [from another Python package](https://docs.python.org/3/tutorial/modules.html#packages). +It is possible to load pipeline step objects [from external Python package](https://docs.python.org/3/tutorial/modules.html#packages). -To do so, simply prepend the package where to find the module into the JSON configuration file: +To do so, simply prepend the package module where to find a class into the JSON configuration file. The exemple below shows how to load an external [GazeMovementIdentifier](../../../argaze.md/#argaze.GazeFeatures.GazeMovementIdentifier): ``` { ... "gaze_movement_identifier": { - "my_package.MyGazeMovementIdentifierAlgorithm": { - "specific_plugin_parameter": 0 - } - }, - ... - "scan_path_analyzers": { - "my_package.MyScanPathAnalyzerAlgorithm": { - "specific_plugin_parameter": 0 - } - } - ... - "aoi_matcher": { - "my_package.MyAOIMatcherAlgorithm": { - "specific_plugin_parameter": 0 - } - } - ... - "aoi_scan_path_analyzers": { - "my_package.MyAOIScanPathAnalyzerAlgorithm": { - "specific_plugin_parameter": 0 + "my_package.my_module.my_class": { + "my_parameter": 0 } } } @@ -45,7 +27,8 @@ import my_package # Load ArFrame with argaze.load('./configuration.json') as ar_frame: - # Print ArFrame attributes - for module, scan_path_analyzer in ar_frame.scan_path_analyzers.items(): - print('scan path analyzer type:', type(scan_path_analyzer)) + # Print gaze movement identifier type + print(type(ar_frame.gaze_movement_identifier)) ``` + +This logic would be the same for [ScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.ScanPathAnalyzer), [AOIMatcher](../../../argaze.md/#argaze.GazeFeatures.AOIMatcher), [AOIScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.AOIScanPathAnalyzer) or [GazePositionCalibrator](../../../argaze.md/#argaze.GazeFeatures.GazePositionCalibrator). \ No newline at end of file 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 9c4fb60..a230d4c 100644 --- a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md +++ b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md @@ -6,10 +6,13 @@ This could be particularly useful for realtime gaze interaction applications. ## Load ArFrame configuration from dictionary -First of all, [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) configuration can be loaded from a Python dictionary. +An [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) configuration can be loaded from a Python dictionary. ```python -from argaze import ArFeatures +from argaze import ArFeatures, DataFeatures + +# Set working directory to enable relative file path loading +DataFeatures.set_working_directory('path/to/folder') # Edit a dict with ArFrame configuration configuration = { @@ -40,7 +43,7 @@ configuration = { } # Load ArFrame -with ArFeatures.ArFrame.from_dict(configuration) as ar_frame: +with ArFeatures.ArFrame(**configuration) as ar_frame: # Do something with ArFrame ... @@ -95,9 +98,11 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho # Do something with scan path analysis if ar_frame.is_analysis_available(): - for scan_path_analyzer_name, scan_path_analysis in ar_frame.analysis: + for scan_path_analyzer_name, analyses in ar_frame.analysis().items(): - ... + for analysis_name, analysis in analyses.items(): + + ... # Do something with layers aoi scan path analysis for layer_name, ar_layer in ar_frame.layers.items(): @@ -107,9 +112,11 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho if ar_layer.is_analysis_available(): - for aoi_scan_path_analyzer_name, aoi_scan_path_analysis in ar_layer.analysis: + for aoi_scan_path_analyzer_name, analyses in ar_frame.analysis().items(): - ... + for analysis_name, analysis in analyses.items(): + + ... # Do something with pipeline exception except Exception as e: @@ -136,9 +143,9 @@ Then, the last gaze movement type can be tested thanks to [GazeFeatures.is_fixat To know when new scan path analysis is available. -### *ar_frame.analysis()* +### *ar_frame.analysis().items()* -This an iterator to access to all scan path analysis. +This an iterator to access to all scan path analysis. Notice that each scan path analyzer returns a dictionary containing possibly several analyses. ### *ar_layer.last_looked_aoi_name()* @@ -148,9 +155,9 @@ The name of the last aoi matching done by [AoiMatcher](../../../argaze.md/#argaz To know when new aoi scan path analysis is available. -### *ar_layer.analysis()* +### *ar_layer.analysis().items()* -This an iterator to access to all aoi scan path analysis. +This an iterator to access to all aoi scan path analysis. Notice that each aoi scan path analyzer returns a dictionary containing possibly several analyses. ## Setup ArFrame image parameters -- cgit v1.1