Skip to content

Commit

Permalink
Swap poses "centroid" and "left" keypoint NaNs
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Jan 24, 2025
1 parent 7526b27 commit 60b3e50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions tests/fixtures/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
8 changes: 4 additions & 4 deletions tests/test_unit/test_kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
(
Expand Down Expand Up @@ -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
Expand All @@ -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"]

Expand Down

0 comments on commit 60b3e50

Please sign in to comment.