From 60b3e5053a3ec1c4560cf25b85ecac50aa5fdc30 Mon Sep 17 00:00:00 2001 From: lochhh Date: Fri, 24 Jan 2025 17:51:14 +0000 Subject: [PATCH] Swap poses "centroid" and "left" keypoint NaNs --- tests/fixtures/data.py | 10 +++++----- tests/test_unit/test_kinematics.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/fixtures/data.py b/tests/fixtures/data.py index 02d0d32e..624f8826 100644 --- a/tests/fixtures/data.py +++ b/tests/fixtures/data.py @@ -287,16 +287,16 @@ def valid_poses_dataset_with_nan(valid_poses_dataset): Using ``valid_poses_dataset`` as the base dataset, the following NaN values are introduced: - Individual "id_0": - - 1 NaN value in the centroid keypoint of individual id_0 at time=0 - - 3 NaN values in the left keypoint of individual id_0 (frames 3, 7, 8) - - 10 NaN values in the right keypoint of individual id_0 (all frames) + - 3 NaNs in the centroid keypoint of individual id_0 (frames 3, 7, 8) + - 1 NaN in the left keypoint of individual id_0 at time=0 + - 10 NaNs in the right keypoint of individual id_0 (all frames) - Individual "id_1" has no missing values. """ valid_poses_dataset.position.loc[ - {"individuals": "id_0", "keypoints": "centroid", "time": 0} + {"individuals": "id_0", "keypoints": "centroid", "time": [3, 7, 8]} ] = np.nan valid_poses_dataset.position.loc[ - {"individuals": "id_0", "keypoints": "left", "time": [3, 7, 8]} + {"individuals": "id_0", "keypoints": "left", "time": 0} ] = np.nan valid_poses_dataset.position.loc[ {"individuals": "id_0", "keypoints": "right"} diff --git a/tests/test_unit/test_kinematics.py b/tests/test_unit/test_kinematics.py index 0577a42a..3cbe3704 100644 --- a/tests/test_unit/test_kinematics.py +++ b/tests/test_unit/test_kinematics.py @@ -213,7 +213,7 @@ def test_path_length_across_time_ranges( [ ( "ffill", - np.array([np.sqrt(2) * 8, np.sqrt(2) * 9, np.nan]), + np.array([np.sqrt(2) * 9, np.sqrt(2) * 8, np.nan]), does_not_raise(), ), ( @@ -287,9 +287,9 @@ def test_path_length_warns_about_nans( assert caplog.records[1].levelname == "INFO" assert "Individual: id_0" in info_msg assert "Individual: id_1" not in info_msg - assert "left: 3/10 (30.0%)" in info_msg + assert "centroid: 3/10 (30.0%)" in info_msg assert "right: 10/10 (100.0%)" in info_msg - assert "centroid" not in info_msg + assert "left" not in info_msg @pytest.fixture @@ -298,7 +298,7 @@ def valid_data_array_for_forward_vector(): (left ear, right ear and nose), tracked for 4 frames, in x-y space. """ time = [0, 1, 2, 3] - individuals = ["individual_0"] + individuals = ["id_0"] keypoints = ["left_ear", "right_ear", "nose"] space = ["x", "y"]