From dec80c17aab5c66938c3755968e1da0dee293109 Mon Sep 17 00:00:00 2001 From: viktorpm Date: Thu, 12 Oct 2023 16:33:17 +0100 Subject: [PATCH 01/27] draft validation functions --- bg_atlasgen/validate_atlases.py | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 bg_atlasgen/validate_atlases.py diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py new file mode 100644 index 0000000..bbb0de6 --- /dev/null +++ b/bg_atlasgen/validate_atlases.py @@ -0,0 +1,71 @@ +from bg_atlasapi.list_atlases import get_atlases_lastversions, get_all_atlases_lastversions +from bg_atlasapi.update_atlases import update_atlas +from bg_atlasapi import BrainGlobeAtlas +from pathlib import Path +import numpy as np +import meshio as mio + +def validate_atlas_files(atlas_path: Path): + assert atlas_path.exists(), f"Atlas path {atlas_path} not found" + expected_files = ["annotation.tiff", "reference.tiff", "metadata.json", "structures.json", "meshes"] + for expected_file_name in expected_files: + expected_path = Path(atlas_path / expected_file_name) + assert expected_path.exists(), f"Expected file not found at {expected_path}" + return True + +def _assert_close(mesh_coord, annotation_coord, pixel_size): + assert abs(mesh_coord - annotation_coord) <= 10 * pixel_size, f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" +def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): + root_mesh = atlas.mesh_from_structure("root") + annotation_image = atlas.annotation + resolution = atlas.resolution + + z_range, y_range, x_range = np.nonzero(annotation_image) + z_min, z_max = np.min(z_range), np.max(z_range) + y_min, y_max = np.min(y_range), np.max(y_range) + x_min, x_max = np.min(x_range), np.max(x_range) + + mesh_points = root_mesh.points + z_coords, y_coords, x_coords = mesh_points[:,0], mesh_points[:,1], mesh_points[:,2] + z_min_mesh, z_max_mesh = np.min(z_coords), np.max(z_coords) + y_min_mesh, y_max_mesh = np.min(y_coords), np.max(y_coords) + x_min_mesh, x_max_mesh = np.min(x_coords), np.max(x_coords) + + z_min_scaled, z_max_scaled = z_min*resolution[0], z_max * resolution[0] + y_min_scaled, y_max_scaled = y_min * resolution[1], y_max * resolution[1] + x_min_scaled, x_max_scaled = x_min * resolution[2], x_max * resolution[2] + + _assert_close(z_min_mesh, z_min_scaled, resolution[0]) + _assert_close(z_max_mesh, z_max_scaled, resolution[0]) + _assert_close(y_min_mesh, y_min_scaled, resolution[1]) + _assert_close(y_max_mesh, y_max_scaled, resolution[1]) + _assert_close(x_min_mesh, x_min_scaled, resolution[2]) + _assert_close(x_max_mesh, x_max_scaled, resolution[2]) + + return True + +def open_for_visual_check(atlas): + pass + +def validate_checksum(atlas): + pass + +def check_additional_references(): + # check additional references are different, but have same dimensions + pass + + +def validate_atlas(atlas_name, version): + print(atlas_name, version) + if atlas_name in get_atlases_lastversions().keys(): + updated = get_atlases_lastversions()[atlas_name]['updated'] + if not updated: + update_atlas(atlas_name) + atlas_path = Path.home() / ".brainglobe" / f"{atlas_name}_v{version}" + assert validate_atlas_files(atlas_path), f"Atlas file {atlas_path} validation failed" + assert validate_mesh_matches_image_extents(BrainGlobeAtlas(atlas_name)), "Atlas object validation failed" + +for atlas_name, version in get_all_atlases_lastversions().items(): + # regenerate_atlas(atlas_name) + validate_atlas(atlas_name, version) + From 566fc4420a87808cc78ed970d94bf3994e415df5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:40:58 +0000 Subject: [PATCH 02/27] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- bg_atlasgen/validate_atlases.py | 54 +++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index bbb0de6..9355d6e 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -1,20 +1,37 @@ -from bg_atlasapi.list_atlases import get_atlases_lastversions, get_all_atlases_lastversions -from bg_atlasapi.update_atlases import update_atlas -from bg_atlasapi import BrainGlobeAtlas from pathlib import Path + import numpy as np -import meshio as mio +from bg_atlasapi import BrainGlobeAtlas +from bg_atlasapi.list_atlases import ( + get_all_atlases_lastversions, + get_atlases_lastversions, +) +from bg_atlasapi.update_atlases import update_atlas + def validate_atlas_files(atlas_path: Path): assert atlas_path.exists(), f"Atlas path {atlas_path} not found" - expected_files = ["annotation.tiff", "reference.tiff", "metadata.json", "structures.json", "meshes"] + expected_files = [ + "annotation.tiff", + "reference.tiff", + "metadata.json", + "structures.json", + "meshes", + ] for expected_file_name in expected_files: expected_path = Path(atlas_path / expected_file_name) - assert expected_path.exists(), f"Expected file not found at {expected_path}" + assert ( + expected_path.exists() + ), f"Expected file not found at {expected_path}" return True + def _assert_close(mesh_coord, annotation_coord, pixel_size): - assert abs(mesh_coord - annotation_coord) <= 10 * pixel_size, f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" + assert ( + abs(mesh_coord - annotation_coord) <= 10 * pixel_size + ), f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" + + def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): root_mesh = atlas.mesh_from_structure("root") annotation_image = atlas.annotation @@ -26,12 +43,16 @@ def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): x_min, x_max = np.min(x_range), np.max(x_range) mesh_points = root_mesh.points - z_coords, y_coords, x_coords = mesh_points[:,0], mesh_points[:,1], mesh_points[:,2] + z_coords, y_coords, x_coords = ( + mesh_points[:, 0], + mesh_points[:, 1], + mesh_points[:, 2], + ) z_min_mesh, z_max_mesh = np.min(z_coords), np.max(z_coords) y_min_mesh, y_max_mesh = np.min(y_coords), np.max(y_coords) x_min_mesh, x_max_mesh = np.min(x_coords), np.max(x_coords) - z_min_scaled, z_max_scaled = z_min*resolution[0], z_max * resolution[0] + z_min_scaled, z_max_scaled = z_min * resolution[0], z_max * resolution[0] y_min_scaled, y_max_scaled = y_min * resolution[1], y_max * resolution[1] x_min_scaled, x_max_scaled = x_min * resolution[2], x_max * resolution[2] @@ -44,12 +65,15 @@ def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): return True + def open_for_visual_check(atlas): pass + def validate_checksum(atlas): pass + def check_additional_references(): # check additional references are different, but have same dimensions pass @@ -58,14 +82,18 @@ def check_additional_references(): def validate_atlas(atlas_name, version): print(atlas_name, version) if atlas_name in get_atlases_lastversions().keys(): - updated = get_atlases_lastversions()[atlas_name]['updated'] + updated = get_atlases_lastversions()[atlas_name]["updated"] if not updated: update_atlas(atlas_name) atlas_path = Path.home() / ".brainglobe" / f"{atlas_name}_v{version}" - assert validate_atlas_files(atlas_path), f"Atlas file {atlas_path} validation failed" - assert validate_mesh_matches_image_extents(BrainGlobeAtlas(atlas_name)), "Atlas object validation failed" + assert validate_atlas_files( + atlas_path + ), f"Atlas file {atlas_path} validation failed" + assert validate_mesh_matches_image_extents( + BrainGlobeAtlas(atlas_name) + ), "Atlas object validation failed" + for atlas_name, version in get_all_atlases_lastversions().items(): # regenerate_atlas(atlas_name) validate_atlas(atlas_name, version) - From 8bb2150fb2b1c5dee34a4a49be7d9c5e5507f227 Mon Sep 17 00:00:00 2001 From: viktorpm Date: Thu, 12 Oct 2023 16:50:35 +0100 Subject: [PATCH 03/27] run on all atlases, don't crash on assertion error --- bg_atlasgen/validate_atlases.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index bbb0de6..9c2ba60 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -57,15 +57,26 @@ def check_additional_references(): def validate_atlas(atlas_name, version): print(atlas_name, version) - if atlas_name in get_atlases_lastversions().keys(): - updated = get_atlases_lastversions()[atlas_name]['updated'] - if not updated: - update_atlas(atlas_name) - atlas_path = Path.home() / ".brainglobe" / f"{atlas_name}_v{version}" - assert validate_atlas_files(atlas_path), f"Atlas file {atlas_path} validation failed" - assert validate_mesh_matches_image_extents(BrainGlobeAtlas(atlas_name)), "Atlas object validation failed" + atlas = BrainGlobeAtlas(atlas_name) + updated = get_atlases_lastversions()[atlas_name]['updated'] + if not updated: + update_atlas(atlas_name) + atlas_path = Path.home() / ".brainglobe" / f"{atlas_name}_v{version}" + assert validate_atlas_files(atlas_path), f"Atlas file {atlas_path} validation failed" + assert validate_mesh_matches_image_extents(atlas), "Atlas object validation failed" +valid_atlases = [] +invalid_atlases = [] for atlas_name, version in get_all_atlases_lastversions().items(): - # regenerate_atlas(atlas_name) - validate_atlas(atlas_name, version) + try: + validate_atlas(atlas_name, version) + valid_atlases.append(atlas_name) + except AssertionError as e: + invalid_atlases.append((atlas_name, e)) + continue + +print("Summary") +print(valid_atlases) +print(invalid_atlases) + From 9423015f123ca81a05a40cb6e1023179d1134d12 Mon Sep 17 00:00:00 2001 From: viktorpm Date: Thu, 2 Nov 2023 11:14:22 +0000 Subject: [PATCH 04/27] fixing atlas path --- bg_atlasgen/validate_atlases.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 0c9858f..9fca16d 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -2,6 +2,7 @@ import numpy as np from bg_atlasapi import BrainGlobeAtlas +from bg_atlasapi.config import get_brainglobe_dir from bg_atlasapi.list_atlases import ( get_all_atlases_lastversions, get_atlases_lastversions, @@ -85,7 +86,7 @@ def validate_atlas(atlas_name, version): updated = get_atlases_lastversions()[atlas_name]["updated"] if not updated: update_atlas(atlas_name) - atlas_path = Path.home() / ".brainglobe" / f"{atlas_name}_v{version}" + atlas_path = Path(get_brainglobe_dir()) / f"{atlas_name}_v{version}" assert validate_atlas_files( atlas_path ), f"Atlas file {atlas_path} validation failed" From 319e7210a9ad17edc7890419d40f89f0dd7abc0a Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Thu, 2 Nov 2023 12:03:24 +0000 Subject: [PATCH 05/27] Clearer output printing --- bg_atlasgen/validate_atlases.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 9fca16d..d6734f0 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -106,5 +106,7 @@ def validate_atlas(atlas_name, version): continue print("Summary") +print("### Valid atlases ###") print(valid_atlases) +print("### Invalid atlases ###") print(invalid_atlases) From 9402b66e0fdcab656061dbcb81f926da21f0accd Mon Sep 17 00:00:00 2001 From: alessandrofelder Date: Fri, 3 Nov 2023 11:04:57 +0000 Subject: [PATCH 06/27] tidy up validation script, remove weird test_git --- bg_atlasgen/test_git.py | 21 --------------------- bg_atlasgen/validate_atlases.py | 31 ++++++++++++++++--------------- 2 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 bg_atlasgen/test_git.py diff --git a/bg_atlasgen/test_git.py b/bg_atlasgen/test_git.py deleted file mode 100644 index 1488fed..0000000 --- a/bg_atlasgen/test_git.py +++ /dev/null @@ -1,21 +0,0 @@ -from pathlib import Path - -from git import Repo - -GENERATION_DICT = dict(example_mouse=[100]) - - -cwd = Path.home() / "bg_auto" -cwd.mkdir(exist_ok=True) - - -if __name__ == "__main__": - repo_path = cwd / "atlas_repo" - atlas_gen_path = Path(__file__).parent - - repo = Repo(repo_path) - - # repo.git.add(".") - # repo.git.commit('-m', 'test commit', author='luigi.petrucco@gmail.com') - repo.git.pull() - repo.git.push() diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index d6734f0..7c55337 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -95,18 +95,19 @@ def validate_atlas(atlas_name, version): ), "Atlas object validation failed" -valid_atlases = [] -invalid_atlases = [] -for atlas_name, version in get_all_atlases_lastversions().items(): - try: - validate_atlas(atlas_name, version) - valid_atlases.append(atlas_name) - except AssertionError as e: - invalid_atlases.append((atlas_name, e)) - continue - -print("Summary") -print("### Valid atlases ###") -print(valid_atlases) -print("### Invalid atlases ###") -print(invalid_atlases) +if __name__ == "__main__": + valid_atlases = [] + invalid_atlases = [] + for atlas_name, version in get_all_atlases_lastversions().items(): + try: + validate_atlas(atlas_name, version) + valid_atlases.append(atlas_name) + except AssertionError as e: + invalid_atlases.append((atlas_name, e)) + continue + + print("Summary") + print("### Valid atlases ###") + print(valid_atlases) + print("### Invalid atlases ###") + print(invalid_atlases) From 598a0e18b5c64cd8f44b950621bc3d95e28fa8d7 Mon Sep 17 00:00:00 2001 From: alessandrofelder Date: Fri, 3 Nov 2023 11:06:13 +0000 Subject: [PATCH 07/27] add dev install, make test structure, initial tests --- pyproject.toml | 18 ++++++++++++------ tests/__init__.py | 0 tests/test_unit/test_validation.py | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/test_unit/test_validation.py diff --git a/pyproject.toml b/pyproject.toml index 798c8f2..484ecf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,18 @@ allenmouse = [ "allensdk", ] +dev = [ + "pytest", + "pytest-cov", + "coverage", + "tox", + "black", + "mypy", + "pre-commit", + "ruff", + "setuptools_scm", +] + [build-system] requires = [ "setuptools>=45", @@ -59,12 +71,6 @@ include-package-data = true [tool.setuptools.packages.find] include = ["bg_atlasgen*"] -[tool.pytest.ini_options] -addopts = "--cov=bg_atlasgen" -filterwarnings = [ - "error", -] - [tool.black] target-version = ['py38', 'py39', 'py310', 'py311'] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py new file mode 100644 index 0000000..5c7433c --- /dev/null +++ b/tests/test_unit/test_validation.py @@ -0,0 +1,15 @@ +import pytest +from pathlib import Path +from bg_atlasgen.validate_atlases import validate_atlas_files +from bg_atlasapi import BrainGlobeAtlas +from bg_atlasapi.config import get_brainglobe_dir + +def test_valid_atlas_files(): + _ = BrainGlobeAtlas("allen_mouse_100um") + atlas_path = Path(get_brainglobe_dir()) / "allen_mouse_100um_v1.2" + assert validate_atlas_files(atlas_path) + +def test_invalid_atlas_path(): + atlas_path = Path.home() + with pytest.raises(AssertionError, match="Expected file not found"): + validate_atlas_files(atlas_path) \ No newline at end of file From 96c8584963b4686adae0dcb2f93e719e65f75685 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Nov 2023 11:06:49 +0000 Subject: [PATCH 08/27] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_unit/test_validation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py index 5c7433c..b92b8ce 100644 --- a/tests/test_unit/test_validation.py +++ b/tests/test_unit/test_validation.py @@ -1,15 +1,19 @@ -import pytest from pathlib import Path -from bg_atlasgen.validate_atlases import validate_atlas_files + +import pytest from bg_atlasapi import BrainGlobeAtlas from bg_atlasapi.config import get_brainglobe_dir +from bg_atlasgen.validate_atlases import validate_atlas_files + + def test_valid_atlas_files(): _ = BrainGlobeAtlas("allen_mouse_100um") atlas_path = Path(get_brainglobe_dir()) / "allen_mouse_100um_v1.2" assert validate_atlas_files(atlas_path) + def test_invalid_atlas_path(): atlas_path = Path.home() with pytest.raises(AssertionError, match="Expected file not found"): - validate_atlas_files(atlas_path) \ No newline at end of file + validate_atlas_files(atlas_path) From ffef504b71a9950b29fcd9ebdc3707652d10ab8b Mon Sep 17 00:00:00 2001 From: viktorpm Date: Fri, 3 Nov 2023 14:59:41 +0000 Subject: [PATCH 09/27] add tests and return for _assert_close() --- bg_atlasgen/validate_atlases.py | 1 + tests/test_unit/test_validation.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 7c55337..d7dbfcb 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -31,6 +31,7 @@ def _assert_close(mesh_coord, annotation_coord, pixel_size): assert ( abs(mesh_coord - annotation_coord) <= 10 * pixel_size ), f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" + return True def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py index b92b8ce..960121f 100644 --- a/tests/test_unit/test_validation.py +++ b/tests/test_unit/test_validation.py @@ -1,10 +1,10 @@ from pathlib import Path - +import numpy as np import pytest from bg_atlasapi import BrainGlobeAtlas from bg_atlasapi.config import get_brainglobe_dir -from bg_atlasgen.validate_atlases import validate_atlas_files +from bg_atlasgen.validate_atlases import validate_atlas_files, _assert_close, validate_mesh_matches_image_extents def test_valid_atlas_files(): @@ -17,3 +17,11 @@ def test_invalid_atlas_path(): atlas_path = Path.home() with pytest.raises(AssertionError, match="Expected file not found"): validate_atlas_files(atlas_path) + + +def test_assert_close(): + assert _assert_close(99.5, 8, 10) + +def test_assert_close_negative(): + with pytest.raises(AssertionError, match="differ by more than 10 times pixel size"): + _assert_close(99.5, 30, 2) From 92e94e6080949b289f2d5b15c6560f4e3927acbf Mon Sep 17 00:00:00 2001 From: viktorpm Date: Fri, 3 Nov 2023 15:23:45 +0000 Subject: [PATCH 10/27] add test for validate mesh matches annotation --- pyproject.toml | 1 + tests/test_unit/test_validation.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 484ecf5..20d9259 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ allenmouse = [ dev = [ "pytest", "pytest-cov", + "pytest-mock", "coverage", "tox", "black", diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py index 960121f..99c3b96 100644 --- a/tests/test_unit/test_validation.py +++ b/tests/test_unit/test_validation.py @@ -7,6 +7,16 @@ from bg_atlasgen.validate_atlases import validate_atlas_files, _assert_close, validate_mesh_matches_image_extents +def test_validate_mesh_matches_image_extents(): + atlas = BrainGlobeAtlas("allen_mouse_100um") + assert validate_mesh_matches_image_extents(atlas) + +def test_validate_mesh_matches_image_extents_negative(mocker): + atlas = BrainGlobeAtlas("allen_mouse_100um") + flipped_annotation_image = np.transpose(atlas.annotation) + annotation_mock = mocker.patch("bg_atlasapi.BrainGlobeAtlas.annotation", new_callable=mocker.PropertyMock, return_value=flipped_annotation_image) + with pytest.raises(AssertionError, match="differ by more than 10 times pixel size"): + validate_mesh_matches_image_extents(atlas) def test_valid_atlas_files(): _ = BrainGlobeAtlas("allen_mouse_100um") atlas_path = Path(get_brainglobe_dir()) / "allen_mouse_100um_v1.2" From 29343dc6388c57150de8c965a1b68f895573da1c Mon Sep 17 00:00:00 2001 From: viktorpm Date: Fri, 3 Nov 2023 15:38:36 +0000 Subject: [PATCH 11/27] fix linting --- tests/test_unit/test_validation.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py index 99c3b96..ce4cb8b 100644 --- a/tests/test_unit/test_validation.py +++ b/tests/test_unit/test_validation.py @@ -1,22 +1,36 @@ from pathlib import Path + import numpy as np import pytest from bg_atlasapi import BrainGlobeAtlas from bg_atlasapi.config import get_brainglobe_dir -from bg_atlasgen.validate_atlases import validate_atlas_files, _assert_close, validate_mesh_matches_image_extents +from bg_atlasgen.validate_atlases import ( + _assert_close, + validate_atlas_files, + validate_mesh_matches_image_extents, +) def test_validate_mesh_matches_image_extents(): atlas = BrainGlobeAtlas("allen_mouse_100um") assert validate_mesh_matches_image_extents(atlas) + def test_validate_mesh_matches_image_extents_negative(mocker): atlas = BrainGlobeAtlas("allen_mouse_100um") flipped_annotation_image = np.transpose(atlas.annotation) - annotation_mock = mocker.patch("bg_atlasapi.BrainGlobeAtlas.annotation", new_callable=mocker.PropertyMock, return_value=flipped_annotation_image) - with pytest.raises(AssertionError, match="differ by more than 10 times pixel size"): + mocker.patch( + "bg_atlasapi.BrainGlobeAtlas.annotation", + new_callable=mocker.PropertyMock, + return_value=flipped_annotation_image, + ) + with pytest.raises( + AssertionError, match="differ by more than 10 times pixel size" + ): validate_mesh_matches_image_extents(atlas) + + def test_valid_atlas_files(): _ = BrainGlobeAtlas("allen_mouse_100um") atlas_path = Path(get_brainglobe_dir()) / "allen_mouse_100um_v1.2" @@ -32,6 +46,9 @@ def test_invalid_atlas_path(): def test_assert_close(): assert _assert_close(99.5, 8, 10) -def test_assert_close_negative(): - with pytest.raises(AssertionError, match="differ by more than 10 times pixel size"): + +def test_assert_close_negative(): + with pytest.raises( + AssertionError, match="differ by more than 10 times pixel size" + ): _assert_close(99.5, 30, 2) From 5995c43adc76a2d10e74c87296da0afa791c512c Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Tue, 7 Nov 2023 16:00:18 +0000 Subject: [PATCH 12/27] update version for actions --- .github/workflows/test_and_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index ca332f7..cfe580b 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -9,7 +9,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: neuroinformatics-unit/actions/lint@v1 + - uses: neuroinformatics-unit/actions/lint@v2 test: needs: lint @@ -29,6 +29,6 @@ jobs: python-version: "3.8" steps: - - uses: neuroinformatics-unit/actions/test@v1 + - uses: neuroinformatics-unit/actions/test@v2 with: python-version: ${{ matrix.python-version }} From cb9cc0251f7e3562cb8b2901d5a55619f562135c Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Tue, 7 Nov 2023 16:07:16 +0000 Subject: [PATCH 13/27] drop py3.8 in tox, run pytest in tox --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index e8310ab..b5197b1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,8 @@ [tox] -envlist = py{38,39,310,311} +envlist = py{39,310,311} [gh-actions] python = - 3.8: py38 3.9: py39 3.10: py310 3.11: py311 @@ -11,5 +10,6 @@ python = [testenv] extras = dev -commands = - python -c "import bg_atlasgen" +commands = + pytest -v --color=yes --cov=brainrender_napari --cov-report=xml + From 85419d80f6362c434d2a303d8b8a4124a023baa7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:07:24 +0000 Subject: [PATCH 14/27] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index b5197b1..a5a6a27 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,5 @@ python = [testenv] extras = dev -commands = +commands = pytest -v --color=yes --cov=brainrender_napari --cov-report=xml - From dc4aebc8a171632faf10806732c803e05a7c1c9d Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Tue, 7 Nov 2023 16:11:27 +0000 Subject: [PATCH 15/27] fix copy-paste error in pytest command --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a5a6a27..a53937f 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,4 @@ python = extras = dev commands = - pytest -v --color=yes --cov=brainrender_napari --cov-report=xml + pytest -v --color=yes --cov=bg_atlasgen --cov-report=xml From a59da92162c553688617f7e257d4a0da02048700 Mon Sep 17 00:00:00 2001 From: Alessandro Felder Date: Tue, 7 Nov 2023 16:17:53 +0000 Subject: [PATCH 16/27] drop py3.8 from gh action workflow file too --- .github/workflows/test_and_deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index cfe580b..7831c08 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -25,8 +25,6 @@ jobs: python-version: "3.10" - os: windows-latest python-version: "3.9" - - os: ubuntu-latest - python-version: "3.8" steps: - uses: neuroinformatics-unit/actions/test@v2 From f06c82f196b0bed2676ab41b0b765436ab5b8b5e Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Wed, 8 Nov 2023 10:27:35 +0000 Subject: [PATCH 17/27] Adding docstrings to validation script --- bg_atlasgen/validate_atlases.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index d7dbfcb..ffd0149 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -1,3 +1,6 @@ +"""Script to validate atlases""" + + from pathlib import Path import numpy as np @@ -11,6 +14,8 @@ def validate_atlas_files(atlas_path: Path): + """Checks if basic files exist in the atlas folder""" + assert atlas_path.exists(), f"Atlas path {atlas_path} not found" expected_files = [ "annotation.tiff", @@ -28,6 +33,7 @@ def validate_atlas_files(atlas_path: Path): def _assert_close(mesh_coord, annotation_coord, pixel_size): + """Helper function to check if the mesh and the annotation coordinate are closer to each other than 10 times the pixel size""" assert ( abs(mesh_coord - annotation_coord) <= 10 * pixel_size ), f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" @@ -35,6 +41,8 @@ def _assert_close(mesh_coord, annotation_coord, pixel_size): def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): + """Checks if the mesh and the image extents are similar""" + root_mesh = atlas.mesh_from_structure("root") annotation_image = atlas.annotation resolution = atlas.resolution @@ -82,6 +90,8 @@ def check_additional_references(): def validate_atlas(atlas_name, version): + """Validates the latest version of a given atlas""" + print(atlas_name, version) atlas = BrainGlobeAtlas(atlas_name) updated = get_atlases_lastversions()[atlas_name]["updated"] From dace6b3a40ce17d4bc8d84c8df0a598f7fc66c74 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Fri, 24 Nov 2023 11:56:26 +0000 Subject: [PATCH 18/27] Making path tests stricter, breaking up long strings, adding diff_tolerance argument to _assert_close function --- bg_atlasgen/validate_atlases.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index ffd0149..fe264ac 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -16,7 +16,7 @@ def validate_atlas_files(atlas_path: Path): """Checks if basic files exist in the atlas folder""" - assert atlas_path.exists(), f"Atlas path {atlas_path} not found" + assert atlas_path.is_dir(), f"Atlas path {atlas_path} not found" expected_files = [ "annotation.tiff", "reference.tiff", @@ -27,16 +27,20 @@ def validate_atlas_files(atlas_path: Path): for expected_file_name in expected_files: expected_path = Path(atlas_path / expected_file_name) assert ( - expected_path.exists() + expected_path.is_file() ), f"Expected file not found at {expected_path}" return True - -def _assert_close(mesh_coord, annotation_coord, pixel_size): - """Helper function to check if the mesh and the annotation coordinate are closer to each other than 10 times the pixel size""" - assert ( - abs(mesh_coord - annotation_coord) <= 10 * pixel_size - ), f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord} differ by more than 10 times pixel size {pixel_size}" +def _assert_close(mesh_coord, annotation_coord, pixel_size, diff_tolerance=10): + """ + Helper function to check if the mesh and the annotation coordinate + are closer to each other than an arbitrary tolerance value times the pixel size. + The default tolerance value is 10. + """ + assert abs(mesh_coord - annotation_coord) <= diff_tolerance * pixel_size, ( + f"Mesh coordinate {mesh_coord} and annotation coordinate {annotation_coord}", + f"differ by more than {diff_tolerance} times pixel size {pixel_size}", + ) return True From 9faf48f363f7ec9ce3f2b93857bc8a478619f276 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:48:49 +0000 Subject: [PATCH 19/27] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- bg_atlasgen/validate_atlases.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index fe264ac..c286a90 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -31,6 +31,7 @@ def validate_atlas_files(atlas_path: Path): ), f"Expected file not found at {expected_path}" return True + def _assert_close(mesh_coord, annotation_coord, pixel_size, diff_tolerance=10): """ Helper function to check if the mesh and the annotation coordinate From 777d30961cfb4cab20b91f29df55363c151b9be9 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Wed, 29 Nov 2023 16:32:50 +0000 Subject: [PATCH 20/27] restructuring validate_mesh_matches_image_extents function, adding comments --- bg_atlasgen/validate_atlases.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index fe264ac..5eed572 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -31,6 +31,7 @@ def validate_atlas_files(atlas_path: Path): ), f"Expected file not found at {expected_path}" return True + def _assert_close(mesh_coord, annotation_coord, pixel_size, diff_tolerance=10): """ Helper function to check if the mesh and the annotation coordinate @@ -51,25 +52,31 @@ def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): annotation_image = atlas.annotation resolution = atlas.resolution + # minimum and maximum values of the annotation image (z, y, x) z_range, y_range, x_range = np.nonzero(annotation_image) z_min, z_max = np.min(z_range), np.max(z_range) y_min, y_max = np.min(y_range), np.max(y_range) x_min, x_max = np.min(x_range), np.max(x_range) + # minimum and maximum values of the annotation image scaled by the atlas resolution + z_min_scaled, z_max_scaled = z_min * resolution[0], z_max * resolution[0] + y_min_scaled, y_max_scaled = y_min * resolution[1], y_max * resolution[1] + x_min_scaled, x_max_scaled = x_min * resolution[2], x_max * resolution[2] + + # z, y and x coordinates of the root mesh (extent of the whole object) mesh_points = root_mesh.points z_coords, y_coords, x_coords = ( mesh_points[:, 0], mesh_points[:, 1], mesh_points[:, 2], ) + + # minimum and maximum coordinates of the root mesh z_min_mesh, z_max_mesh = np.min(z_coords), np.max(z_coords) y_min_mesh, y_max_mesh = np.min(y_coords), np.max(y_coords) x_min_mesh, x_max_mesh = np.min(x_coords), np.max(x_coords) - z_min_scaled, z_max_scaled = z_min * resolution[0], z_max * resolution[0] - y_min_scaled, y_max_scaled = y_min * resolution[1], y_max * resolution[1] - x_min_scaled, x_max_scaled = x_min * resolution[2], x_max * resolution[2] - + # checking if root mesh and image are on the same scale _assert_close(z_min_mesh, z_min_scaled, resolution[0]) _assert_close(z_max_mesh, z_max_scaled, resolution[0]) _assert_close(y_min_mesh, y_min_scaled, resolution[1]) From 8736701299b393698fac6eaa3e213fa62db4c1b2 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Wed, 3 Jan 2024 13:31:28 +0000 Subject: [PATCH 21/27] testing expected files and meshes directory separately --- bg_atlasgen/validate_atlases.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 5eed572..5578186 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -22,13 +22,15 @@ def validate_atlas_files(atlas_path: Path): "reference.tiff", "metadata.json", "structures.json", - "meshes", ] for expected_file_name in expected_files: expected_path = Path(atlas_path / expected_file_name) assert ( expected_path.is_file() ), f"Expected file not found at {expected_path}" + + meshes_path = atlas_path / "meshes" + assert meshes_path.is_dir(), f"Meshes path {meshes_path} not found" return True From b517507cecf5855c3b327cf50af2913f0d6ae75d Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Mon, 8 Jan 2024 16:40:00 +0000 Subject: [PATCH 22/27] looping through validation functions and parameters to catch individual errors --- bg_atlasgen/validate_atlases.py | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 5578186..c67efbc 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -89,11 +89,11 @@ def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): return True -def open_for_visual_check(atlas): +def open_for_visual_check(): pass -def validate_checksum(atlas): +def validate_checksum(): pass @@ -119,6 +119,36 @@ def validate_atlas(atlas_name, version): ), "Atlas object validation failed" +all_validation_functions = [ + validate_atlas_files, + validate_mesh_matches_image_extents, + open_for_visual_check, + validate_checksum, + check_additional_references, + validate_atlas, +] + +all_validation_parameters = [ + ( + Path( + "/mnt/ceph/Viktor/brainglobe/atlas_validation/allen_mouse_100um_v1.2" + ), + ), + (BrainGlobeAtlas("allen_mouse_100um"),), + (), + (), + ("allen_mouse_100um", 1.0), +] + +failed_validations = [] + +for i, validation_function in enumerate(all_validation_functions): + try: + validation_function(*all_validation_parameters[i]) + except AssertionError as error: + failed_validations.append((i, error)) + continue + if __name__ == "__main__": valid_atlases = [] invalid_atlases = [] From 26b9dcfc18a4e39459b4ed26f942dd1fa9760043 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Tue, 9 Jan 2024 17:53:09 +0000 Subject: [PATCH 23/27] removing hard coded path, generalising to all atlases --- bg_atlasgen/validate_atlases.py | 45 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index c67efbc..24767aa 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -119,6 +119,7 @@ def validate_atlas(atlas_name, version): ), "Atlas object validation failed" +# list to store the validation functions all_validation_functions = [ validate_atlas_files, validate_mesh_matches_image_extents, @@ -128,26 +129,36 @@ def validate_atlas(atlas_name, version): validate_atlas, ] -all_validation_parameters = [ - ( - Path( - "/mnt/ceph/Viktor/brainglobe/atlas_validation/allen_mouse_100um_v1.2" - ), - ), - (BrainGlobeAtlas("allen_mouse_100um"),), - (), - (), - ("allen_mouse_100um", 1.0), -] +# list to store atlas specific parameters for all validation function +all_validation_function_parameters = [] +# list to store the errors of the failed validations failed_validations = [] -for i, validation_function in enumerate(all_validation_functions): - try: - validation_function(*all_validation_parameters[i]) - except AssertionError as error: - failed_validations.append((i, error)) - continue +for atlas_name, version in get_all_atlases_lastversions().items(): + validation_function_parameters = [ + # validate_atlas_files(atlas_path: Path) + (Path(get_brainglobe_dir() / f"{atlas_name}_v{version}"),), + # validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas) + (BrainGlobeAtlas(atlas_name),), + # open_for_visual_check() + (), + # validate_checksum() + (), + # check_additional_references() + (), + # validate_atlas(atlas_name, version) + (atlas_name, version), + ] + # all_validation_function_parameters.append(validation_function_parameters) + + for i, validation_function in enumerate(all_validation_functions): + try: + validation_function(*validation_function_parameters[i]) + except AssertionError as error: + failed_validations.append((i, error)) + continue + if __name__ == "__main__": valid_atlases = [] From f7fa093724ae0472c114c1a8e5e70a809290b462 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Wed, 10 Jan 2024 10:30:08 +0000 Subject: [PATCH 24/27] adding successful_validations list --- bg_atlasgen/validate_atlases.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 24767aa..b10a54f 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -134,6 +134,8 @@ def validate_atlas(atlas_name, version): # list to store the errors of the failed validations failed_validations = [] +successful_validations = [] + for atlas_name, version in get_all_atlases_lastversions().items(): validation_function_parameters = [ @@ -155,9 +157,9 @@ def validate_atlas(atlas_name, version): for i, validation_function in enumerate(all_validation_functions): try: validation_function(*validation_function_parameters[i]) + successful_validations.append((atlas_name, validation_function)) except AssertionError as error: - failed_validations.append((i, error)) - continue + failed_validations.append((atlas_name, validation_function, error)) if __name__ == "__main__": From af84ec38590597922f60cec85f44b252fae479cd Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Tue, 16 Jan 2024 14:46:53 +0000 Subject: [PATCH 25/27] tidying up duplications --- bg_atlasgen/validate_atlases.py | 64 ++++++++++++++------------------- 1 file changed, 27 insertions(+), 37 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index b10a54f..3e3f885 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -102,42 +102,16 @@ def check_additional_references(): pass -def validate_atlas(atlas_name, version): +def validate_atlas(atlas_name, version, all_validation_functions): """Validates the latest version of a given atlas""" print(atlas_name, version) - atlas = BrainGlobeAtlas(atlas_name) + BrainGlobeAtlas(atlas_name) updated = get_atlases_lastversions()[atlas_name]["updated"] if not updated: update_atlas(atlas_name) - atlas_path = Path(get_brainglobe_dir()) / f"{atlas_name}_v{version}" - assert validate_atlas_files( - atlas_path - ), f"Atlas file {atlas_path} validation failed" - assert validate_mesh_matches_image_extents( - atlas - ), "Atlas object validation failed" - - -# list to store the validation functions -all_validation_functions = [ - validate_atlas_files, - validate_mesh_matches_image_extents, - open_for_visual_check, - validate_checksum, - check_additional_references, - validate_atlas, -] - -# list to store atlas specific parameters for all validation function -all_validation_function_parameters = [] - -# list to store the errors of the failed validations -failed_validations = [] -successful_validations = [] - - -for atlas_name, version in get_all_atlases_lastversions().items(): + Path(get_brainglobe_dir()) / f"{atlas_name}_v{version}" + validation_function_parameters = [ # validate_atlas_files(atlas_path: Path) (Path(get_brainglobe_dir() / f"{atlas_name}_v{version}"),), @@ -152,7 +126,10 @@ def validate_atlas(atlas_name, version): # validate_atlas(atlas_name, version) (atlas_name, version), ] - # all_validation_function_parameters.append(validation_function_parameters) + + # list to store the errors of the failed validations + failed_validations = [] + successful_validations = [] for i, validation_function in enumerate(all_validation_functions): try: @@ -161,17 +138,30 @@ def validate_atlas(atlas_name, version): except AssertionError as error: failed_validations.append((atlas_name, validation_function, error)) + return successful_validations, failed_validations + if __name__ == "__main__": + # list to store the validation functions + all_validation_functions = [ + validate_atlas_files, + validate_mesh_matches_image_extents, + open_for_visual_check, + validate_checksum, + check_additional_references, + validate_atlas, + ] + valid_atlases = [] invalid_atlases = [] for atlas_name, version in get_all_atlases_lastversions().items(): - try: - validate_atlas(atlas_name, version) - valid_atlases.append(atlas_name) - except AssertionError as e: - invalid_atlases.append((atlas_name, e)) - continue + successful_validations, failed_validations = validate_atlas( + atlas_name, version, all_validation_functions + ) + for item in successful_validations: + valid_atlases.append(item) + for item in failed_validations: + invalid_atlases.append(item) print("Summary") print("### Valid atlases ###") From bd1f1854d818b29c897e57f54628e751b209d765 Mon Sep 17 00:00:00 2001 From: alessandrofelder Date: Tue, 16 Jan 2024 15:23:56 +0000 Subject: [PATCH 26/27] fix recursive bug --- bg_atlasgen/validate_atlases.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index 3e3f885..ceba77c 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -149,7 +149,6 @@ def validate_atlas(atlas_name, version, all_validation_functions): open_for_visual_check, validate_checksum, check_additional_references, - validate_atlas, ] valid_atlases = [] From d0f81ab6af1fa39799784f832f872cf81bdea576 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Mon, 22 Jan 2024 16:57:11 +0000 Subject: [PATCH 27/27] addressing Niko's final comments, cleaning code --- bg_atlasgen/validate_atlases.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index ceba77c..f886af4 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -90,10 +90,12 @@ def validate_mesh_matches_image_extents(atlas: BrainGlobeAtlas): def open_for_visual_check(): + # implement visual checks later pass def validate_checksum(): + # implement later pass @@ -110,7 +112,6 @@ def validate_atlas(atlas_name, version, all_validation_functions): updated = get_atlases_lastversions()[atlas_name]["updated"] if not updated: update_atlas(atlas_name) - Path(get_brainglobe_dir()) / f"{atlas_name}_v{version}" validation_function_parameters = [ # validate_atlas_files(atlas_path: Path) @@ -123,8 +124,6 @@ def validate_atlas(atlas_name, version, all_validation_functions): (), # check_additional_references() (), - # validate_atlas(atlas_name, version) - (atlas_name, version), ] # list to store the errors of the failed validations