diff options
Diffstat (limited to 'docs/user_guide/gaze_analysis_pipeline/logging.md')
-rw-r--r-- | docs/user_guide/gaze_analysis_pipeline/logging.md | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/docs/user_guide/gaze_analysis_pipeline/logging.md b/docs/user_guide/gaze_analysis_pipeline/logging.md index 001c213..9cfe152 100644 --- a/docs/user_guide/gaze_analysis_pipeline/logging.md +++ b/docs/user_guide/gaze_analysis_pipeline/logging.md @@ -13,11 +13,20 @@ Here is an extract from the JSON ArFrame configuration file where logging is ena { "name": "My FullHD screen", "size": [1920, 1080], - "observers": "my_frame_logger.py", + "observers": { + "my_frame_logger.ScanPathAnalysisLogger": { + "path": "./scan_path_metrics.csv", + "header": ["Timestamp (ms)", "Duration (ms)", "Steps number"] + }, ... "layers": { "MyLayer": { - "observers": "my_layer_logger.py", + "observers": { + "my_layer_logger.AOIScanPathAnalysisLogger": { + "path": "./aoi_scan_path_metrics.csv", + "header": ["Timestamp (ms)", "NGram counts"] + } + }, ... } } @@ -42,17 +51,12 @@ class ScanPathAnalysisLogger(DataFeatures.PipelineStepObserver, UtilsFeatures.Fi log = ( timestamp, - ar_frame.scan_path_analyzers['argaze.GazeAnalysis.Basic'].path_duration, - ar_frame.scan_path_analyzers['argaze.GazeAnalysis.Basic'].steps_number + ar_frame.analysis['argaze.GazeAnalysis.Basic'].path_duration, + ar_frame.analysis['argaze.GazeAnalysis.Basic'].steps_number ) # Write to file self.write(log) - -# Export logger as observer -__observers__ = { - "Scan path analysis logger": ScanPathAnalysisLogger(path="./scan_path_metrics.csv", header=("Timestamp (ms)", "Duration (ms)", "Steps number")) - } ``` Assuming that [ArGaze.GazeAnalysis.Basic](../../argaze.md/#argaze.GazeAnalysis.Basic) scan path analysis module is enabled for 'My FullHD screen' ArFrame, a ***scan_path_metrics.csv*** file would be created: @@ -82,16 +86,11 @@ class AOIScanPathAnalysisLogger(DataFeatures.PipelineStepObserver, UtilsFeatures log = ( timestamp, - ar_layer.aoi_scan_path_analyzers['argaze.GazeAnalysis.NGram'].ngrams_count + ar_layer.analysis['argaze.GazeAnalysis.NGram'].ngrams_count ) # Write to file self.write(log) - -# Export logger as observer -__observers__ = { - "AOI Scan path analysis logger": AOIScanPathAnalysisLogger(path="./aoi_scan_path_metrics.csv", header=("Timestamp (ms)", "NGram counts")) - } ``` Assuming that [ArGaze.GazeAnalysis.NGram](../../argaze.md/#argaze.GazeAnalysis.NGram) AOI scan path analysis module is enabled for 'MyLayer' ArLayer, a ***aoi_scan_path_metrics.csv*** file would be created: @@ -110,9 +109,28 @@ Assuming that [ArGaze.GazeAnalysis.NGram](../../argaze.md/#argaze.GazeAnalysis.N As explained in [pipeline steps visualisation chapter](visualisation.md), it is possible to get [ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) once timestamped gaze positions have been processed by [ArFrame.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method. +Here is the JSON ArFrame configuration file where [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) observers are extended with a new my_frame_logger.VideoRecorder instance: + +```json +{ + "name": "My FullHD screen", + "size": [1920, 1080], + "observers": { + ... + "my_frame_logger.VideoRecorder": { + "path": "./video.mp4", + "width": 1920, + "height": 1080, + "fps": 15 + }, + ... +} +``` + +Here is *my_frame_logger.py* file extended with a new VideoRecorder class: + ```python -from argaze import DataFeatures -from argaze.utils import UtilsFeatures +... class VideoRecorder(DataFeatures.PipelineStepObserver, UtilsFeatures.VideoWriter): @@ -121,10 +139,6 @@ class VideoRecorder(DataFeatures.PipelineStepObserver, UtilsFeatures.VideoWriter self.write(ar_frame.image()) -# Export recorder as observer -__observers__ = { - "Video recorder": VideoRecorder(path="./video.mp4", width=1920, height=1080, fps=15) - } ``` Assuming that [ArFrame.image_parameters](../../argaze.md/#argaze.ArFeatures.ArFrame.image_parameters) are provided, ***video.mp4*** file would be created.
\ No newline at end of file |