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

Standardise package structure and add tests #57

Merged
merged 24 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6098af3
Standardise tooling and package structure
adamltyson Dec 19, 2023
5f10a77
Add more assertions to the cellfinder xml reader test
adamltyson Dec 19, 2023
0c56e7f
remove boilerplate comment
adamltyson Dec 19, 2023
6f0f0c0
Move cellfinder dir reader into workflows directory
adamltyson Dec 19, 2023
61e68c3
remove unused function
adamltyson Dec 19, 2023
3093e10
restructure tests
adamltyson Dec 19, 2023
74c3587
Add more assertions for writer test
adamltyson Dec 19, 2023
9976250
Expand cellfinder xml writer tests
adamltyson Dec 19, 2023
32f8eab
Test loading other files
adamltyson Dec 19, 2023
da82935
Add unit tests
adamltyson Dec 19, 2023
df82a81
Add test for layer naming
adamltyson Dec 19, 2023
85e3fd3
Move xml test data
adamltyson Dec 19, 2023
8ff2b13
Add brainreg reader tests
adamltyson Dec 19, 2023
0b355cb
Add whole brain cell detection & registration tests
adamltyson Dec 19, 2023
c9cce2a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 19, 2023
44852f0
lint
adamltyson Dec 19, 2023
5559005
Merge branch 'update' of https://github.com/brainglobe/brainglobe-nap…
adamltyson Dec 19, 2023
e7dd061
Remove check for executables
adamltyson Dec 19, 2023
8e90e3d
replace np.random.random with Generator
adamltyson Dec 19, 2023
8c9e647
Update GH workflow
adamltyson Dec 19, 2023
ed5346f
Update tests/tests/test_integration/test_cellfinder_reader.py
adamltyson Dec 20, 2023
2bb2402
update pre-commit
adamltyson Dec 20, 2023
8045348
update pre-commit
adamltyson Dec 20, 2023
8c61bcf
Merge branch 'update' of https://github.com/brainglobe/brainglobe-nap…
adamltyson Dec 20, 2023
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
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
.napari_cache

# Translations
*.mo
Expand All @@ -66,6 +65,11 @@ docs/_build/
# PyBuilder
target/

# Pycharm and VSCode
.idea/
venv/
.vscode/

# IPython Notebook
.ipynb_checkpoints

Expand All @@ -76,6 +80,4 @@ target/
.DS_Store

# written by setuptools_scm
*/_version.py

.idea/
**/_version.py
16 changes: 11 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -15,17 +15,23 @@ repos:
args: [--fix=lf]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.272
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies:
- types-setuptools
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools-scm]
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
include LICENSE
include README.md
exclude tox.ini

exclude .pre-commit-config.yaml

exclude *.yml
exclude *.yaml
recursive-exclude tests *

recursive-exclude brainglobe_napari_io *.xml
include brainglobe_napari_io/napari.yaml
Expand Down
10 changes: 6 additions & 4 deletions brainglobe_napari_io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from importlib_metadata import version
from importlib.metadata import PackageNotFoundError, version

__version__ = version("brainglobe-napari-io")
__author__ = "Adam Tyson"
__license__ = "BSD-3-Clause"
try:
__version__ = version("brainglobe-napari-io")
except PackageNotFoundError:
# package is not installed
pass
7 changes: 0 additions & 7 deletions brainglobe_napari_io/cellfinder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ def cells_df_as_np(
return cells


def cells_to_array(cells) -> Tuple[np.ndarray, np.ndarray]:
df = pd.DataFrame([c.to_dict() for c in cells])
points = cells_df_as_np(df[df["type"] == Cell.CELL])
rejected = cells_df_as_np(df[df["type"] == Cell.UNKNOWN])
return points, rejected


def get_cell_arrays(cells_file: os.PathLike) -> Tuple[np.ndarray, np.ndarray]:
df = cells_xml_to_df(str(cells_file))

Expand Down
8 changes: 4 additions & 4 deletions brainglobe_napari_io/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ contributions:
title: Brainreg Read Directory Atlas Space
python_name: brainglobe_napari_io.brainreg.reader_dir_atlas_space:brainreg_read_dir_atlas_space

- id: brainglobe-napari-io.cellfinder_read_dir
title: Cellfinder Read Directory
python_name: brainglobe_napari_io.cellfinder.reader_dir:cellfinder_read_dir
- id: brainglobe-napari-io.workflows_wholebrain_cell_read_dir
adamltyson marked this conversation as resolved.
Show resolved Hide resolved
title: Workflows Whole Brain Cell Detection Read Directory
python_name: brainglobe_napari_io.workflows.wholebrain_cell_reader_dir:wholebrain_cell_read_dir

- id: brainglobe-napari-io.cellfinder_read_xml
title: Cellfinder Read XML
Expand All @@ -34,7 +34,7 @@ contributions:
- '*.tiff'
accepts_directories: true

- command: brainglobe-napari-io.cellfinder_read_dir
- command: brainglobe-napari-io.workflows_wholebrain_cell_read_dir
filename_patterns:
- '*.tif'
accepts_directories: true
Expand Down
Loading
Loading