Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sample SLEAP data containing mixed (user/predicted) labels #85

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"examples_dirs": ["../../examples"],
"filename_pattern": "/*.py", # which files to execute before inclusion
"gallery_dirs": ["examples"], # output directory
"run_stale_examples": True, # re-run examples on each build
}

# -- Options for HTML output -------------------------------------------------
Expand Down Expand Up @@ -133,7 +134,7 @@
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']

# The linkcheck builder will skip verifying that anchors exist when checking
# The linkcheck builder will skip verifying that anchors exist when checking
# these URLs
linkcheck_anchors_ignore_for_url = [
"https://gin.g-node.org/G-Node/Info/wiki/",
Expand Down
2 changes: 2 additions & 0 deletions movement/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"SLEAP_two-mice_social-interaction.predictions.slp": "45881affde9704c045e70b8d4b3f6bbb8d9bd8ef9f4cdea6d173cfe35857549b", # noqa: E501
"SLEAP_three-mice_Aeon_proofread.analysis.h5": "82ebd281c406a61536092863bc51d1a5c7c10316275119f7daf01c1ff33eac2a", # noqa: E501
"SLEAP_three-mice_Aeon_proofread.predictions.slp": "7b7436a52dfd5f4d80d7c66919ad1a1732e5435fe33faf9011ec5f7b7074e788", # noqa: E501
"SLEAP_three-mice_Aeon_mixed-labels.analysis.h5": "899651ec027eb8fd6181246f89142ad1c0a40f14394fc8144d44ea093c0e137d", # noqa: E501
"SLEAP_three-mice_Aeon_mixed-labels.predictions.slp": "6d3f2c5446e9c12aabf28d5a9470835736b0419dcefebba89c305114f83b82d1", # noqa: E501
},
)

Expand Down
17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def pytest_configure():
"SLEAP_single-mouse_EPM.predictions.slp",
"SLEAP_three-mice_Aeon_proofread.analysis.h5",
"SLEAP_three-mice_Aeon_proofread.predictions.slp",
"SLEAP_three-mice_Aeon_mixed-labels.analysis.h5",
"SLEAP_three-mice_Aeon_mixed-labels.predictions.slp",
]
}

Expand Down Expand Up @@ -167,6 +169,21 @@ def dlc_style_df():
return pd.read_hdf(pytest.POSE_DATA.get("DLC_single-wasp.predictions.h5"))


@pytest.fixture(
params=[
"SLEAP_single-mouse_EPM.analysis.h5",
"SLEAP_single-mouse_EPM.predictions.slp",
"SLEAP_three-mice_Aeon_proofread.analysis.h5",
"SLEAP_three-mice_Aeon_proofread.predictions.slp",
"SLEAP_three-mice_Aeon_mixed-labels.analysis.h5",
"SLEAP_three-mice_Aeon_mixed-labels.predictions.slp",
]
)
def sleap_file(request):
"""Return the file path for a SLEAP .h5 or .slp file."""
return pytest.POSE_DATA.get(request.param)


@pytest.fixture
def valid_tracks_array():
"""Return a function that generate different kinds
Expand Down
16 changes: 3 additions & 13 deletions tests/test_unit/test_load_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,11 @@ def assert_dataset(
)
assert dataset.fps is None

@pytest.mark.parametrize(
"file_name",
[
"SLEAP_single-mouse_EPM.analysis.h5",
"SLEAP_single-mouse_EPM.predictions.slp",
"SLEAP_three-mice_Aeon_proofread.analysis.h5",
"SLEAP_three-mice_Aeon_proofread.predictions.slp",
],
)
def test_load_from_slp_file(self, file_name):
def test_load_from_slp_file(self, sleap_file):
"""Test that loading pose tracks from valid SLEAP files
returns a proper Dataset."""
file_path = POSE_DATA.get(file_name)
ds = load_poses.from_sleap_file(file_path)
self.assert_dataset(ds, file_path, "SLEAP")
ds = load_poses.from_sleap_file(sleap_file)
self.assert_dataset(ds, sleap_file, "SLEAP")

@pytest.mark.parametrize(
"file_name",
Expand Down