From 0e435f38a00c161fe037948b5df71e093934d6d3 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 11 Jul 2023 16:19:24 +0200 Subject: Documenting from_dataframe methods. --- docs/user_guide/gaze_analysis/gaze_position.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'docs/user_guide/gaze_analysis') diff --git a/docs/user_guide/gaze_analysis/gaze_position.md b/docs/user_guide/gaze_analysis/gaze_position.md index 9cc7f85..8856bec 100644 --- a/docs/user_guide/gaze_analysis/gaze_position.md +++ b/docs/user_guide/gaze_analysis/gaze_position.md @@ -66,3 +66,22 @@ if gaze_position_A.overlap(gaze_position_B, both=True): # Do something if A overlaps B AND B overlaps A ... ``` + +## Timestamped gaze positions + +[TimeStampedGazePositions](../../../argaze/#argaze.GazeFeatures.TimeStampedGazePositions) inherits from [TimeStampedBuffer](../../../argaze/#argaze.DataStructures.TimeStampedBuffer) class to handle especially gaze positions. + +### Import from dataframe + +It is possible to load timestamped gaze positions from a [Pandas DataFrame](https://pandas.pydata.org/docs/getting_started/intro_tutorials/01_table_oriented.html#min-tut-01-tableoriented) object. + +```python +import pandas + +# Load gaze positions from a CSV file into Panda Dataframe +dataframe = pandas.read_csv('gaze_positions.csv', delimiter="\t", low_memory=False) + +# Convert Panda dataframe into TimestampedGazePositions buffer precising the use of each specific column labels +ts_gaze_positions = GazeFeatures.TimeStampedGazePositions.from_dataframe(dataframe, timestamp = 'Recording timestamp [ms]', x = 'Gaze point X [px]', y = 'Gaze point Y [px]') + +``` -- cgit v1.1