diff options
author | Théo de la Hogue | 2024-03-11 12:11:08 +0100 |
---|---|---|
committer | Théo de la Hogue | 2024-03-11 12:11:08 +0100 |
commit | da307162ca85bcd6433058528b9bd48de2ccaf93 (patch) | |
tree | 54445aa0eda7e7aa8debd2e39d5963354ea7c521 /docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md | |
parent | a4e350d677b4f6b161fa897404a42e0bbd57c1a8 (diff) | |
download | argaze-da307162ca85bcd6433058528b9bd48de2ccaf93.zip argaze-da307162ca85bcd6433058528b9bd48de2ccaf93.tar.gz argaze-da307162ca85bcd6433058528b9bd48de2ccaf93.tar.bz2 argaze-da307162ca85bcd6433058528b9bd48de2ccaf93.tar.xz |
Making timestamp as an optional PipelineStepMethod parameter required if the first parameter is not a TimestampedObject.
Diffstat (limited to 'docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md')
-rw-r--r-- | docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md b/docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md index 2156f3b..4c53258 100644 --- a/docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md +++ b/docs/user_guide/gaze_analysis_pipeline/timestamped_gaze_positions_edition.md @@ -5,7 +5,7 @@ Whatever eye data comes from a file on disk or from a live stream, timestamped g ![Timestamped gaze positions](../../img/timestamped_gaze_positions.png) -## Import gaze positions from CSV file +## Import timestamped gaze positions from CSV file 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 which can be loaded from a CSV file. @@ -20,13 +20,13 @@ dataframe = pandas.read_csv('gaze_positions.csv', delimiter=",", low_memory=Fals ts_gaze_positions = GazeFeatures.TimeStampedGazePositions.from_dataframe(dataframe, timestamp = 'Recording timestamp [ms]', x = 'Gaze point X [px]', y = 'Gaze point Y [px]') # Iterate over timestamped gaze positions -for timestamp, gaze_position in ts_gaze_positions.items(): +for gaze_position in ts_gaze_positions: # Do something with each timestamped gaze position ... ``` -## Edit gaze positions from live stream +## Edit timestamped gaze positions from live stream When gaze positions comes from a real time input, gaze position can be edited thanks to [GazePosition](../../argaze.md/#argaze.GazeFeatures.GazePosition) class. Besides, timestamps can be edited from the incoming data stream or, if not available, they can be edited thanks to the python [time package](https://docs.python.org/3/library/time.html). @@ -37,11 +37,8 @@ from argaze import GazeFeatures # Assuming to be inside the function where timestamp_µs, gaze_x and gaze_y values are catched ... - # Edit a second timestamp from a microsecond second timestamp - timestamp = timestamp_µs * 1e-6 - - # Define a basic gaze position - gaze_position = GazeFeatures.GazePosition((gaze_x, gaze_y)) + # Define a basic gaze position converting microsecond timestamp into second timestamp + gaze_position = GazeFeatures.GazePosition((gaze_x, gaze_y), timestamp=timestamp_µs * 1e-6) # Do something with each timestamped gaze position ... @@ -58,11 +55,8 @@ start_time = time.time() # Assuming to be inside the function where only gaze_x and gaze_y values are catched (no timestamp) ... - # Edit a millisecond timestamp - timestamp = int((time.time() - start_time) * 1e3) - - # Define a basic gaze position - gaze_position = GazeFeatures.GazePosition((gaze_x, gaze_y)) + # Define a basic gaze position with millisecond timestamp + gaze_position = GazeFeatures.GazePosition((gaze_x, gaze_y), timestamp=int((time.time() - start_time) * 1e3)) # Do something with each timestamped gaze position ... |