Skip to content

Commit

Permalink
TST: test _wavelet_threshold with a single scalar value for all levels
Browse files Browse the repository at this point in the history
  • Loading branch information
grlee77 committed Aug 15, 2016
1 parent 062b734 commit 80fa35d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions skimage/restoration/tests/test_denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,21 @@ def test_wavelet_denoising():
assert np.sum(res1**2) <= np.sum(res2**2)


def test_wavelet_threshold():
rstate = np.random.RandomState(1234)

img = astro_gray
sigma = 0.1
noisy = img + sigma * rstate.randn(*(img.shape))
noisy = np.clip(noisy, 0, 1)

# employ a single, uniform threshold instead of BayesShrink sigmas
denoised = _wavelet_threshold(noisy, wavelet='db1', threshold=sigma)
psnr_noisy = compare_psnr(img, noisy)
psnr_denoised = compare_psnr(img, denoised)
assert psnr_denoised > psnr_noisy


def test_wavelet_denoising_nd():
rstate = np.random.RandomState(1234)
for ndim in range(1, 5):
Expand Down

0 comments on commit 80fa35d

Please sign in to comment.