diff --git a/skimage/util/process.py b/skimage/util/process.py index e0463fec..c03b1c5b 100644 --- a/skimage/util/process.py +++ b/skimage/util/process.py @@ -27,7 +27,8 @@ def _get_chunks(shape, ncpu): return tuple(chunks) -def process_chunks(function, array, args=(), kwargs={} chunks=None, depth=0, mode=None): +def process_chunks(function, array, args=(), kwargs={}, chunks=None, depth=0, + mode=None): """Map a function in parallel across an array. Split an array into possibly overlapping chunks of a given depth and @@ -56,7 +57,7 @@ def process_chunks(function, array, args=(), kwargs={} chunks=None, depth=0, mod a chunk. """ - if chunks == None: + if chunks is None: shape = array.shape ncpu = cpu_count() chunks = _get_chunks(shape, ncpu) diff --git a/skimage/util/tests/test_process.py b/skimage/util/tests/test_process.py index 3710cece..52fe248c 100644 --- a/skimage/util/tests/test_process.py +++ b/skimage/util/tests/test_process.py @@ -4,6 +4,7 @@ from numpy.testing import assert_array_almost_equal from skimage.filters import threshold_adaptive, gaussian_filter from skimage.util import process_chunks + def test_process_chunks(): # data a = np.arange(144).reshape(12, 12).astype(float) @@ -31,6 +32,7 @@ def test_process_chunks(): def test_no_chunks(): a = np.ones(1 * 4 * 8 * 9).reshape(1, 4, 8, 9) + def add_42(arr): return arr + 42