From baf0ddabe03e0fa3e6a1f9d84b557a1af2a19439 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 7 Dec 2022 16:26:22 +0100 Subject: Replacing pop_first_until by pop_last_before. --- src/argaze/utils/tobii_segment_display.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/argaze/utils/tobii_segment_display.py b/src/argaze/utils/tobii_segment_display.py index 344241d..8d8f037 100644 --- a/src/argaze/utils/tobii_segment_display.py +++ b/src/argaze/utils/tobii_segment_display.py @@ -63,7 +63,7 @@ def main(): try: # Get nearest head rotation before video timestamp and remove all head rotations before - _, nearest_head_rotation = tobii_ts_head_rotations.pop_first_until(video_ts) + _, nearest_head_rotation = tobii_ts_head_rotations.pop_last_before(video_ts) # Calculate head movement considering only head yaw and pitch head_movement = numpy.array(nearest_head_rotation.value) @@ -80,7 +80,7 @@ def main(): try: # Get nearest gaze position before video timestamp and remove all gaze positions before - _, nearest_gaze_position = tobii_ts_gaze_positions.pop_first_until(video_ts) + _, nearest_gaze_position = tobii_ts_gaze_positions.pop_last_before(video_ts) # Ignore frame when gaze position is not valid if nearest_gaze_position.validity == 0: @@ -88,7 +88,7 @@ def main(): gaze_position_pixel = GazeFeatures.GazePosition( (int(nearest_gaze_position.value[0] * video_frame.width), int(nearest_gaze_position.value[1] * video_frame.height)) ) # Get nearest gaze position 3D before video timestamp and remove all gaze positions before - _, nearest_gaze_position_3d = tobii_ts_gaze_positions_3d.pop_first_until(video_ts) + _, nearest_gaze_position_3d = tobii_ts_gaze_positions_3d.pop_last_before(video_ts) # Ignore frame when gaze position 3D is not valid if nearest_gaze_position_3d.validity == 0: @@ -108,7 +108,7 @@ def main(): try: # Get nearest event before video timestamp and remove all gaze positions before - nearest_event_ts, nearest_event = tobii_ts_events.pop_first_until(video_ts) + nearest_event_ts, nearest_event = tobii_ts_events.pop_last_before(video_ts) #print(nearest_event_ts / 1e3, nearest_event) -- cgit v1.1