Skip to content

Commit

Permalink
test: check for precision loss in a 512 cube
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Dec 7, 2023
1 parent 303f9f3 commit e7bd140
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ def test_statistics(order):
assert stats["voxel_counts"][1] == 1000
assert stats["voxel_counts"][2] == 10 * 10 * 11

assert np.all(stats["centroids"][1,:] == [14.5,14.5,14.5])
assert np.all(stats["centroids"][2,:] == [44.5,44.5,45])
assert np.all(np.isclose(stats["centroids"][1,:], [14.5,14.5,14.5]))
assert np.all(np.isclose(stats["centroids"][2,:], [44.5,44.5,45]))

assert np.all(stats["bounding_boxes"][0] == (slice(0,123), slice(0,128), slice(0,125)))
assert np.all(stats["bounding_boxes"][1] == (slice(10,20), slice(10,20), slice(10,20)))
Expand All @@ -968,6 +968,11 @@ def test_statistics(order):
"centroids": None
}

labels = np.zeros((512,512,512), dtype=np.uint8, order=order)
stats = cc3d.statistics(labels)
assert np.all(stats["centroids"][0] == np.array([255.5,255.5,255.5]))


@pytest.mark.parametrize("connectivity", (8, 18, 26))
@pytest.mark.parametrize("dtype", TEST_TYPES)
@pytest.mark.parametrize("order", ("C", "F"))
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311
envlist = py38,py39,py310,py311,py312

[testenv]
platform = darwin
Expand Down

0 comments on commit e7bd140

Please sign in to comment.