mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
Merge pull request #1638 from ahojnnes/doc-fixes
DOC: Docstring fixes for recently merged code
This commit is contained in:
@@ -4,8 +4,8 @@ Interpolation: Edge Modes
|
|||||||
=========================
|
=========================
|
||||||
|
|
||||||
This example illustrates the different edge modes available during
|
This example illustrates the different edge modes available during
|
||||||
interpolation in routines such as ``skimage.transform.rescale`` and
|
interpolation in routines such as `skimage.transform.rescale` and
|
||||||
``skimage.transform.resize``.
|
`skimage.transform.resize`.
|
||||||
"""
|
"""
|
||||||
from skimage._shared.interpolation import extend_image
|
from skimage._shared.interpolation import extend_image
|
||||||
import skimage.data
|
import skimage.data
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ from .utils import _mode_deprecations
|
|||||||
|
|
||||||
|
|
||||||
def coord_map_py(Py_ssize_t dim, long coord, mode):
|
def coord_map_py(Py_ssize_t dim, long coord, mode):
|
||||||
"""interpolation.coord_map python wrapper"""
|
"""Python wrapper for `interpolation.coord_map`."""
|
||||||
cdef char mode_c = ord(mode[0].upper())
|
cdef char mode_c = ord(mode[0].upper())
|
||||||
return coord_map(dim, coord, mode_c)
|
return coord_map(dim, coord, mode_c)
|
||||||
|
|
||||||
|
|
||||||
def extend_image(image, pad=10, mode='constant', cval=0):
|
def extend_image(image, pad=10, mode='constant', cval=0):
|
||||||
"""Pad a 2D image by ``pad`` pixels on each side.
|
"""Pad a 2D image by `pad` pixels on each side.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@@ -31,11 +31,11 @@ def extend_image(image, pad=10, mode='constant', cval=0):
|
|||||||
extended : ndarray
|
extended : ndarray
|
||||||
The extended version of the input image.
|
The extended version of the input image.
|
||||||
|
|
||||||
Note
|
Notes
|
||||||
----
|
-----
|
||||||
For image padding, ``skimage.util.pad`` should be used instead. This
|
For image padding, `skimage.util.pad` should be used instead. This
|
||||||
function is intended only for testing get_pixel2d and demonstrating the
|
function is intended only for testing `get_pixel2d` and demonstrating the
|
||||||
coordinate mapping modes implemented in ``coord_map``.
|
coordinate mapping modes implemented in `coord_map`.
|
||||||
"""
|
"""
|
||||||
mode = _mode_deprecations(mode)
|
mode = _mode_deprecations(mode)
|
||||||
cdef:
|
cdef:
|
||||||
|
|||||||
@@ -166,11 +166,11 @@ def assert_nD(array, ndim, arg_name='image'):
|
|||||||
|
|
||||||
|
|
||||||
def _mode_deprecations(mode):
|
def _mode_deprecations(mode):
|
||||||
""" to be used by functions to update deprecated mode names in
|
"""Used to update deprecated mode names in
|
||||||
`skimage._shared.interpolation.pyx`."""
|
`skimage._shared.interpolation.pyx`."""
|
||||||
if mode.lower() == 'nearest':
|
if mode.lower() == 'nearest':
|
||||||
warnings.warn(skimage_deprecation(
|
warnings.warn(skimage_deprecation(
|
||||||
"Mode 'nearest' has been renamed 'edge'. Mode 'nearest' will be "
|
"Mode 'nearest' has been renamed to 'edge'. Mode 'nearest' will be "
|
||||||
"removed in a future release."))
|
"removed in a future release."))
|
||||||
mode = 'edge'
|
mode = 'edge'
|
||||||
return mode
|
return mode
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ from ._warps_cy import _warp_fast
|
|||||||
|
|
||||||
|
|
||||||
def _to_ndimage_mode(mode):
|
def _to_ndimage_mode(mode):
|
||||||
""" Convert from a numpy.pad mode name to the corresponding ndimage
|
"""Convert from `numpy.pad` mode name to the corresponding ndimage mode."""
|
||||||
mode. """
|
|
||||||
mode = _mode_deprecations(mode.lower())
|
mode = _mode_deprecations(mode.lower())
|
||||||
mode_translation_dict = dict(edge='nearest', symmetric='reflect',
|
mode_translation_dict = dict(edge='nearest', symmetric='reflect',
|
||||||
reflect='mirror')
|
reflect='mirror')
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ __all__ = ['apply_parallel']
|
|||||||
|
|
||||||
|
|
||||||
def _get_chunks(shape, ncpu):
|
def _get_chunks(shape, ncpu):
|
||||||
"""
|
"""Split the array into equal sized chunks based on the number of
|
||||||
Split the array into equal sized chunks based on the number of
|
|
||||||
available processors. The last chunk in each dimension absorbs the
|
available processors. The last chunk in each dimension absorbs the
|
||||||
remainder array elements if the number of cpus does not divide evenly into
|
remainder array elements if the number of CPUs does not divide evenly into
|
||||||
the number of array elements.
|
the number of array elements.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
>>> _get_chunks((4, 4), 4)
|
>>> _get_chunks((4, 4), 4)
|
||||||
((2, 2), (2, 2))
|
((2, 2), (2, 2))
|
||||||
>>> _get_chunks((4, 4), 2)
|
>>> _get_chunks((4, 4), 2)
|
||||||
@@ -77,8 +78,8 @@ def apply_parallel(function, array, chunks=None, depth=0, mode=None,
|
|||||||
|
|
||||||
Notes
|
Notes
|
||||||
-----
|
-----
|
||||||
Numpy edge modes `symmetric`, `wrap` and `edge` are converted to the
|
Numpy edge modes 'symmetric', 'wrap', and 'edge' are converted to the
|
||||||
equivalent `dask` boundary modes `reflect`, `periodic` and `nearest`,
|
equivalent `dask` boundary modes 'reflect', 'periodic' and 'nearest',
|
||||||
respectively.
|
respectively.
|
||||||
"""
|
"""
|
||||||
import dask.array as da
|
import dask.array as da
|
||||||
|
|||||||
Reference in New Issue
Block a user