Skip to content

Commit

Permalink
Adapting Edited Files to comply with PEP8 Standards
Browse files Browse the repository at this point in the history
Changing Indentation as per PEP8 Guidelines
  • Loading branch information
sumitbinnani committed Oct 7, 2015
1 parent 0bae5f9 commit bfba746
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
20 changes: 11 additions & 9 deletions skimage/filter/__init__.py
Expand Up @@ -14,28 +14,30 @@
from ..filters.lpi_filter import inverse, wiener, LPIFilter2D
from ..filters._gaussian import gaussian
from ..filters.edges import (sobel, hsobel, vsobel, sobel_h, sobel_v,
scharr, hscharr, vscharr, scharr_h, scharr_v,
prewitt, hprewitt, vprewitt, prewitt_h, prewitt_v,
roberts, roberts_positive_diagonal,
roberts_negative_diagonal, roberts_pos_diag,
roberts_neg_diag)
scharr, hscharr, vscharr, scharr_h, scharr_v,
prewitt, hprewitt, vprewitt, prewitt_h, prewitt_v,
roberts, roberts_positive_diagonal,
roberts_negative_diagonal, roberts_pos_diag,
roberts_neg_diag)
from ..filters._rank_order import rank_order
from ..filters._gabor import gabor_kernel, gabor
from ..filters.thresholding import (threshold_adaptive, threshold_otsu, threshold_yen,
threshold_isodata)
threshold_isodata)
from ..filters import rank
from ..filters.rank import median

from .._shared.utils import deprecated
from .. import restoration
denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\
(restoration.denoise_bilateral)
(restoration.denoise_bilateral)
denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\
(restoration.denoise_tv_bregman)
(restoration.denoise_tv_bregman)
denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\
(restoration.denoise_tv_chambolle)
(restoration.denoise_tv_chambolle)

# Backward compatibility v<0.11


@deprecated('skimage.feature.canny')
def canny(*args, **kwargs):
# Hack to avoid circular import
Expand Down
10 changes: 6 additions & 4 deletions skimage/filters/__init__.py
Expand Up @@ -16,17 +16,19 @@
from .._shared.utils import deprecated, copy_func
from .. import restoration
denoise_bilateral = deprecated('skimage.restoration.denoise_bilateral')\
(restoration.denoise_bilateral)
(restoration.denoise_bilateral)
denoise_tv_bregman = deprecated('skimage.restoration.denoise_tv_bregman')\
(restoration.denoise_tv_bregman)
(restoration.denoise_tv_bregman)
denoise_tv_chambolle = deprecated('skimage.restoration.denoise_tv_chambolle')\
(restoration.denoise_tv_chambolle)
(restoration.denoise_tv_chambolle)
gaussian_filter = copy_func(gaussian, name='gaussian_filter')
gaussian_filter = deprecated('skimage.filters.gaussian')(gaussian_filter)
gabor_filter = copy_func(gabor, name='gabor_filter')
gabor_filter = deprecated('skimage.filters.gabor')(gabor_filter)

# Backward compatibility v<0.11


@deprecated('skimage.feature.canny')
def canny(*args, **kwargs):
# Hack to avoid circular import
Expand Down Expand Up @@ -70,5 +72,5 @@ def canny(*args, **kwargs):
'threshold_otsu',
'threshold_yen',
'threshold_isodata',
'threshold_li',
'threshold_li',
'rank']
2 changes: 1 addition & 1 deletion skimage/filters/_gabor.py
Expand Up @@ -95,7 +95,7 @@ def gabor_kernel(frequency, theta=0, bandwidth=1, sigma_x=None, sigma_y=None,


def gabor(image, frequency, theta=0, bandwidth=1, sigma_x=None,
sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0):
sigma_y=None, n_stds=3, offset=0, mode='reflect', cval=0):
"""Return real and imaginary responses to Gabor filter.
The real and imaginary parts of the Gabor filter kernel are applied to the
Expand Down
2 changes: 1 addition & 1 deletion skimage/filters/_gaussian.py
Expand Up @@ -10,7 +10,7 @@


def gaussian(image, sigma, output=None, mode='nearest', cval=0,
multichannel=None):
multichannel=None):
"""Multi-dimensional Gaussian filter
Parameters
Expand Down
8 changes: 4 additions & 4 deletions skimage/filters/tests/test_gabor.py
Expand Up @@ -15,7 +15,7 @@ def test_gabor_kernel_size():
kernel = gabor_kernel(0, theta=0, sigma_x=sigma_x, sigma_y=sigma_y)
assert_equal(kernel.shape, (size_y, size_x))

kernel = gabor_kernel(0, theta=np.pi/2, sigma_x=sigma_x, sigma_y=sigma_y)
kernel = gabor_kernel(0, theta=np.pi / 2, sigma_x=sigma_x, sigma_y=sigma_y)
assert_equal(kernel.shape, (size_x, size_y))


Expand All @@ -39,7 +39,7 @@ def test_gabor_kernel_sum():
for sigma_x in range(1, 10, 2):
for sigma_y in range(1, 10, 2):
for frequency in range(0, 10, 2):
kernel = gabor_kernel(frequency+0.1, theta=0,
kernel = gabor_kernel(frequency + 0.1, theta=0,
sigma_x=sigma_x, sigma_y=sigma_y)
# make sure gaussian distribution is covered nearly 100%
assert_almost_equal(np.abs(kernel).sum(), 1, 2)
Expand All @@ -50,9 +50,9 @@ def test_gabor_kernel_theta():
for sigma_y in range(1, 10, 2):
for frequency in range(0, 10, 2):
for theta in range(0, 10, 2):
kernel0 = gabor_kernel(frequency+0.1, theta=theta,
kernel0 = gabor_kernel(frequency + 0.1, theta=theta,
sigma_x=sigma_x, sigma_y=sigma_y)
kernel180 = gabor_kernel(frequency, theta=theta+np.pi,
kernel180 = gabor_kernel(frequency, theta=theta + np.pi,
sigma_x=sigma_x, sigma_y=sigma_y)

assert_array_almost_equal(np.abs(kernel0),
Expand Down
10 changes: 5 additions & 5 deletions skimage/filters/tests/test_gaussian.py
Expand Up @@ -30,23 +30,23 @@ def test_multichannel():
a = np.zeros((5, 5, 3))
a[1, 1] = np.arange(1, 4)
gaussian_rgb_a = gaussian(a, sigma=1, mode='reflect',
multichannel=True)
multichannel=True)
# Check that the mean value is conserved in each channel
# (color channels are not mixed together)
assert np.allclose([a[..., i].mean() for i in range(3)],
[gaussian_rgb_a[..., i].mean() for i in range(3)])
[gaussian_rgb_a[..., i].mean() for i in range(3)])
# Test multichannel = None
with expected_warnings(['multichannel']):
gaussian_rgb_a = gaussian(a, sigma=1, mode='reflect')
# Check that the mean value is conserved in each channel
# (color channels are not mixed together)
assert np.allclose([a[..., i].mean() for i in range(3)],
[gaussian_rgb_a[..., i].mean() for i in range(3)])
[gaussian_rgb_a[..., i].mean() for i in range(3)])
# Iterable sigma
gaussian_rgb_a = gaussian(a, sigma=[1, 2], mode='reflect',
multichannel=True)
multichannel=True)
assert np.allclose([a[..., i].mean() for i in range(3)],
[gaussian_rgb_a[..., i].mean() for i in range(3)])
[gaussian_rgb_a[..., i].mean() for i in range(3)])


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions skimage/util/tests/test_apply_parallel.py
Expand Up @@ -14,8 +14,8 @@ def test_apply_parallel():
# apply the filter
expected1 = threshold_adaptive(a, 3)
result1 = apply_parallel(threshold_adaptive, a, chunks=(6, 6), depth=5,
extra_arguments=(3,),
extra_keywords={'mode': 'reflect'})
extra_arguments=(3,),
extra_keywords={'mode': 'reflect'})

assert_array_almost_equal(result1, expected1)

Expand Down Expand Up @@ -56,6 +56,6 @@ def wrapped(arr):
a = np.arange(144).reshape(12, 12).astype(float)
expected = gaussian(a, 1, mode='nearest')
result = apply_parallel(wrapped, a, chunks=(6, 6), depth={0: 5, 1: 5},
mode='nearest')
mode='nearest')

assert_array_almost_equal(result, expected)

0 comments on commit bfba746

Please sign in to comment.