Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 5, 2024
1 parent 62daf11 commit 629bfd7
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tests/tests/test_image/test_heatmap.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import numpy as np
import importlib.resources as pkg_resources

import numpy as np
import pytest
from tifffile import imread
from brainglobe_utils.image.heatmap import rescale_array, heatmap_from_points

from brainglobe_utils.image.heatmap import heatmap_from_points, rescale_array

points = np.array([[5, 5, 5], [10, 10, 10], [15, 15, 15]])
heatmap_validate_path = pkg_resources.path("tests.data.image", "heatmap.tif")


@pytest.fixture
def mask_array():
"""
Expand All @@ -24,18 +26,21 @@ def test_rescale_array(mask_array):
resized_array = rescale_array(mask_array, small_array)
assert resized_array.shape == small_array.shape


def test_heatmap_from_points(tmp_path, mask_array):
output_filename = tmp_path / "test_heatmap.tif"

heatmap_test = heatmap_from_points(points,
2,
(20, 20, 20),
bin_sizes=(2, 2, 2),
output_filename=output_filename,
smoothing=5,
mask_image=mask_array)
heatmap_test = heatmap_from_points(
points,
2,
(20, 20, 20),
bin_sizes=(2, 2, 2),
output_filename=output_filename,
smoothing=5,
mask_image=mask_array,
)
heatmap_validate = imread(heatmap_validate_path)
assert np.array_equal(heatmap_validate, heatmap_test)

heatmap_file = imread(output_filename)
assert np.array_equal(heatmap_validate, heatmap_file)
assert np.array_equal(heatmap_validate, heatmap_file)

0 comments on commit 629bfd7

Please sign in to comment.