mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 18:25:32 +08:00
Fix test cases for new deprecation behavior
This commit is contained in:
@@ -211,11 +211,13 @@ def test_adapthist_grayscale():
|
||||
img = skimage.img_as_float(data.astronaut())
|
||||
img = rgb2gray(img)
|
||||
img = np.dstack((img, img, img))
|
||||
with expected_warnings(['precision loss|non-contiguous input',
|
||||
with expected_warnings(['precision loss|non-contiguous input',
|
||||
'deprecated']):
|
||||
adapted_old = exposure.equalize_adapthist(img, 10, 9, clip_limit=0.001,
|
||||
nbins=128)
|
||||
adapted = exposure.equalize_adapthist(img, kernel_size=(57, 51), clip_limit=0.01, nbins=128)
|
||||
with expected_warnings(['precision loss|non-contiguous input']):
|
||||
adapted = exposure.equalize_adapthist(img, kernel_size=(57, 51),
|
||||
clip_limit=0.01, nbins=128)
|
||||
assert img.shape == adapted.shape
|
||||
assert_almost_equal(peak_snr(img, adapted), 102.078, 3)
|
||||
assert_almost_equal(norm_brightness_err(img, adapted), 0.0529, 3)
|
||||
@@ -230,7 +232,7 @@ def test_adapthist_color():
|
||||
warnings.simplefilter('always')
|
||||
hist, bin_centers = exposure.histogram(img)
|
||||
assert len(w) > 0
|
||||
with expected_warnings(['precision loss', 'deprecated']):
|
||||
with expected_warnings(['precision loss']):
|
||||
adapted = exposure.equalize_adapthist(img, clip_limit=0.01)
|
||||
|
||||
assert_almost_equal = np.testing.assert_almost_equal
|
||||
@@ -249,7 +251,7 @@ def test_adapthist_alpha():
|
||||
img = skimage.img_as_float(data.astronaut())
|
||||
alpha = np.ones((img.shape[0], img.shape[1]), dtype=float)
|
||||
img = np.dstack((img, alpha))
|
||||
with expected_warnings(['precision loss', 'deprecated']):
|
||||
with expected_warnings(['precision loss']):
|
||||
adapted = exposure.equalize_adapthist(img)
|
||||
assert adapted.shape != img.shape
|
||||
img = img[:, :, :3]
|
||||
|
||||
Reference in New Issue
Block a user