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 test fixtures for cell matching regression test #1

Merged
merged 1 commit into from
Jun 3, 2024
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
21 changes: 21 additions & 0 deletions tests/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
from pathlib import Path

import pooch
import pytest


@pytest.fixture
def data_path():
"""Directory storing all test data"""
return Path(__file__).parent.parent / "data"


@pytest.fixture
def test_data_registry():
"""
Create a test data registry for BrainGlobe.

Returns:
pooch.Pooch: The test data registry object.

"""
registry = pooch.create(
path=pooch.os_cache("brainglobe_test_data"),
base_url="https://gin.g-node.org/BrainGlobe/test-data/raw/master/",
registry={
"cellfinder/cells-z-1000-1050.xml": None,
"cellfinder/other-cells-z-1000-1050.xml": None,
},
)
return registry
37 changes: 37 additions & 0 deletions tests/tests/test_cells/test_matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@
match_cells,
match_points,
)
from brainglobe_utils.IO.cells import get_cells


@pytest.fixture
def cells_and_other_cells(test_data_registry):
"""
Provides real-life cell coordinates from a CFOS-labelled brain from
two different cellfinder versions (pre- and post cellfinder PR #398).
Intended to be used for regression testing our cell matching code.

Parameters
----------
test_data_registry : Pooch.pooch
The BrainGlobe test data registry.

Returns
-------
cell_data : List[Cell]
The loaded cell data.

"""
cell_data_path = test_data_registry.fetch(
"cellfinder/cells-z-1000-1050.xml"
)
other_cell_data_path = test_data_registry.fetch(
"cellfinder/other_cells-z-1000-1050.xml"
)
cell_data = get_cells(cell_data_path)
other_cell_data = get_cells(other_cell_data_path)
return cell_data, other_cell_data


def as_cell(x: List[float]):
Expand All @@ -19,6 +49,13 @@ def as_cell(x: List[float]):
return cells


@pytest.mark.xfail
def test_cell_matching_regression(cells_and_other_cells):
cells, other_cells = cells_and_other_cells
# TODO implement cell matching regression test here, then remove xfail
assert False


@pytest.mark.parametrize("use_scipy", [True, False])
@pytest.mark.parametrize("pre_match", [True, False])
def test_cell_matches_equal_size(pre_match, use_scipy):
Expand Down