From da307162ca85bcd6433058528b9bd48de2ccaf93 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 11 Mar 2024 12:11:08 +0100 Subject: Making timestamp as an optional PipelineStepMethod parameter required if the first parameter is not a TimestampedObject. --- .../configuration_and_execution.md | 2 +- .../timestamped_gaze_positions_edition.md | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) (limited to 'docs/user_guide/gaze_analysis_pipeline') diff --git a/docs/user_guide/gaze_analysis_pipeline/configuration_and_execution.md b/docs/user_guide/gaze_analysis_pipeline/configuration_and_execution.md index de23713..633b736 100644 --- a/docs/user_guide/gaze_analysis_pipeline/configuration_and_execution.md +++ b/docs/user_guide/gaze_analysis_pipeline/configuration_and_execution.md @@ -110,7 +110,7 @@ Timestamped gaze positions have to be passed one by one to [ArFrame.look](../../ try: # Look ArFrame at a timestamped gaze position - ar_frame.look(timestamp, gaze_position) + ar_frame.look(gaze_position) # Do something with pipeline exception except Exception as e: 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 ... -- cgit v1.1