From f20aa5e66191cb80b1e04725b85b4bf08da5cf75 Mon Sep 17 00:00:00 2001 From: "Josh Warner (Mac)" Date: Sat, 12 Oct 2013 09:32:46 -0500 Subject: [PATCH] FIX: Better handling of skimage.data.camera for Python3 compatibility --- skimage/util/tests/test_random_noise.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/skimage/util/tests/test_random_noise.py b/skimage/util/tests/test_random_noise.py index b1dece36..4d1752a0 100644 --- a/skimage/util/tests/test_random_noise.py +++ b/skimage/util/tests/test_random_noise.py @@ -29,7 +29,7 @@ def test_salt(): def test_pepper(): seed = 42 cam = img_as_float(camera()) - data_signed = (cam / 255.) * 2. - 1. # Same image, on range [-1, 1] + data_signed = cam * 2. - 1. # Same image, on range [-1, 1] cam_noisy = random_noise(cam, seed=seed, mode='pepper', amount=0.15) peppermask = cam != cam_noisy @@ -109,8 +109,8 @@ def test_poisson(): def test_clip_poisson(): seed = 42 - data = camera() # 512x512 grayscale uint8 - data_signed = (data / 255.) * 2. - 1. # Same image, on range [-1, 1] + data = camera() # 512x512 grayscale uint8 + data_signed = img_as_float(data) * 2. - 1. # Same image, on range [-1, 1] # Signed and unsigned, clipped cam_poisson = random_noise(data, mode='poisson', seed=seed, clip=True) @@ -129,8 +129,8 @@ def test_clip_poisson(): def test_clip_gaussian(): seed = 42 - data = camera() # 512x512 grayscale uint8 - data_signed = (data / 255.) * 2. - 1. # Same image, on range [-1, 1] + data = camera() # 512x512 grayscale uint8 + data_signed = img_as_float(data) * 2. - 1. # Same image, on range [-1, 1] # Signed and unsigned, clipped cam_gauss = random_noise(data, mode='gaussian', seed=seed, clip=True) @@ -149,8 +149,8 @@ def test_clip_gaussian(): def test_clip_speckle(): seed = 42 - data = camera() # 512x512 grayscale uint8 - data_signed = (data / 255.) * 2. - 1. # Same image, on range [-1, 1] + data = camera() # 512x512 grayscale uint8 + data_signed = img_as_float(data) * 2. - 1. # Same image, on range [-1, 1] # Signed and unsigned, clipped cam_speckle = random_noise(data, mode='speckle', seed=seed, clip=True)