aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorThéo de la Hogue2023-07-11 16:19:24 +0200
committerThéo de la Hogue2023-07-11 16:19:24 +0200
commit0e435f38a00c161fe037948b5df71e093934d6d3 (patch)
tree5550f67f4427c1dd9e6ae8aaac61146ae6ee6b5c /docs
parent8368f7ac505f9979c40d940e6b8457e421946159 (diff)
downloadargaze-0e435f38a00c161fe037948b5df71e093934d6d3.zip
argaze-0e435f38a00c161fe037948b5df71e093934d6d3.tar.gz
argaze-0e435f38a00c161fe037948b5df71e093934d6d3.tar.bz2
argaze-0e435f38a00c161fe037948b5df71e093934d6d3.tar.xz
Documenting from_dataframe methods.
Diffstat (limited to 'docs')
-rw-r--r--docs/user_guide/gaze_analysis/gaze_position.md19
-rw-r--r--docs/user_guide/timestamped_data/pandas_dataframe_conversion.md8
2 files changed, 26 insertions, 1 deletions
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]')
+
+```
diff --git a/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md b/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md
index 839460a..eaa7b69 100644
--- a/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md
+++ b/docs/user_guide/timestamped_data/pandas_dataframe_conversion.md
@@ -7,6 +7,8 @@ Pandas DataFrame conversion
A [Pandas DataFrame](https://pandas.pydata.org/docs/getting_started/intro_tutorials/01_table_oriented.html#min-tut-01-tableoriented) is a python data structure allowing powerful table processings.
+## Export as dataframe
+
[TimeStampedBuffer](../../../argaze/#argaze.DataStructures.TimeStampedBuffer) instance can be converted into dataframe provided that data values are stored as dictionaries.
```python
@@ -32,4 +34,8 @@ ts_buffer_dataframe would look like:
|10 |0 |0.123|
|20 |4 |0.567|
|30 |8 |0.901|
-|... |... |... | \ No newline at end of file
+|... |... |... |
+
+## Import from dataframe
+
+Reversely, [TimeStampedBuffer](../../../argaze/#argaze.DataStructures.TimeStampedBuffer) instance can be created from dataframe, as a result of which each dataframe columns label will become a key of data value dictionary. Notice that the column containing timestamp values have to be called 'timestamp'.