Skip to content

Commit

Permalink
Refactor fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lochhh committed Jan 24, 2025
1 parent aebf91f commit 7c0b12c
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 249 deletions.
27 changes: 12 additions & 15 deletions tests/fixtures/datasets.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
"""Valid and invalid movement datasets and arrays fixtures."""
"""Valid and invalid data fixtures."""

import numpy as np
import pandas as pd
import pytest
import xarray as xr

from movement.validators.datasets import ValidBboxesDataset, ValidPosesDataset


# -------------------- Valid DLC-style DataFrame --------------------
@pytest.fixture
def dlc_style_df():
"""Return a valid DLC-style DataFrame."""
return pd.read_hdf(pytest.DATA_PATHS.get("DLC_single-wasp.predictions.h5"))


# -------------------- Valid bboxes datasets and arrays --------------------
@pytest.fixture
def valid_bboxes_arrays_all_zeros():
Expand Down Expand Up @@ -285,24 +293,13 @@ def valid_poses_dataset_with_nan(valid_poses_dataset):
- 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": 0}
] = np.nan
valid_poses_dataset.position.loc[
{
"individuals": "id_0",
"keypoints": "left",
"time": [3, 7, 8],
}
{"individuals": "id_0", "keypoints": "left", "time": [3, 7, 8]}
] = np.nan
valid_poses_dataset.position.loc[
{
"individuals": "id_0",
"keypoints": "right",
}
{"individuals": "id_0", "keypoints": "right"}
] = np.nan
return valid_poses_dataset

Expand Down
Loading

0 comments on commit 7c0b12c

Please sign in to comment.