From 3236dd8e20a2a5929d3224868b616898338a5a77 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Tue, 9 Jul 2024 23:37:40 -0400 Subject: [PATCH 1/2] cast scalar value to array (needed to produce output of correct dtype with NumPy 2.0) --- python/cucim/src/cucim/skimage/segmentation/_chan_vese.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/cucim/src/cucim/skimage/segmentation/_chan_vese.py b/python/cucim/src/cucim/skimage/segmentation/_chan_vese.py index 789518cb1..ea33f26b5 100644 --- a/python/cucim/src/cucim/skimage/segmentation/_chan_vese.py +++ b/python/cucim/src/cucim/skimage/segmentation/_chan_vese.py @@ -429,6 +429,7 @@ def chan_vese( energies = [] phivar = tol + 1 + dt = cp.asarray(dt, dtype=float_dtype) while phivar > tol and i < max_num_iter: # Save old level set values oldphi = phi From cc787fd64d3e5e97b96eddcc4c64c120dd910c50 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Tue, 9 Jul 2024 23:44:16 -0400 Subject: [PATCH 2/2] bump tolerance in stain_extraction_pca test rtol of 1e-6 is sufficient given that the precision used internally is always float32 --- python/cucim/tests/unit/core/test_stain_normalizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cucim/tests/unit/core/test_stain_normalizer.py b/python/cucim/tests/unit/core/test_stain_normalizer.py index aa969c523..34a44384c 100644 --- a/python/cucim/tests/unit/core/test_stain_normalizer.py +++ b/python/cucim/tests/unit/core/test_stain_normalizer.py @@ -137,7 +137,7 @@ def test_result_value(self, image, expected): stain_extraction_pca(image) else: result = stain_extraction_pca(image) - cp.testing.assert_allclose(result, expected) + cp.testing.assert_allclose(result, expected, rtol=1e-6) class TestStainNormalizerMacenko: