mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-28 21:30:05 +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
|
||||
interpolation in routines such as ``skimage.transform.rescale`` and
|
||||
``skimage.transform.resize``.
|
||||
interpolation in routines such as `skimage.transform.rescale` and
|
||||
`skimage.transform.resize`.
|
||||
"""
|
||||
from skimage._shared.interpolation import extend_image
|
||||
import skimage.data
|
||||
|
||||
@@ -5,13 +5,13 @@ from .utils import _mode_deprecations
|
||||
|
||||
|
||||
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())
|
||||
return coord_map(dim, coord, mode_c)
|
||||
|
||||
|
||||
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
|
||||
----------
|
||||
@@ -31,11 +31,11 @@ def extend_image(image, pad=10, mode='constant', cval=0):
|
||||
extended : ndarray
|
||||
The extended version of the input image.
|
||||
|
||||
Note
|
||||
----
|
||||
For image padding, ``skimage.util.pad`` should be used instead. This
|
||||
function is intended only for testing get_pixel2d and demonstrating the
|
||||
coordinate mapping modes implemented in ``coord_map``.
|
||||
Notes
|
||||
-----
|
||||
For image padding, `skimage.util.pad` should be used instead. This
|
||||
function is intended only for testing `get_pixel2d` and demonstrating the
|
||||
coordinate mapping modes implemented in `coord_map`.
|
||||
"""
|
||||
mode = _mode_deprecations(mode)
|
||||
cdef:
|
||||
|
||||
@@ -166,11 +166,11 @@ def assert_nD(array, ndim, arg_name='image'):
|
||||
|
||||
|
||||
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`."""
|
||||
if mode.lower() == 'nearest':
|
||||
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."))
|
||||
mode = 'edge'
|
||||
return mode
|
||||
|
||||
@@ -13,8 +13,7 @@ from ._warps_cy import _warp_fast
|
||||
|
||||
|
||||
def _to_ndimage_mode(mode):
|
||||
""" Convert from a numpy.pad mode name to the corresponding ndimage
|
||||
mode. """
|
||||
"""Convert from `numpy.pad` mode name to the corresponding ndimage mode."""
|
||||
mode = _mode_deprecations(mode.lower())
|
||||
mode_translation_dict = dict(edge='nearest', symmetric='reflect',
|
||||
reflect='mirror')
|
||||
|
||||
@@ -5,12 +5,13 @@ __all__ = ['apply_parallel']
|
||||
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> _get_chunks((4, 4), 4)
|
||||
((2, 2), (2, 2))
|
||||
>>> _get_chunks((4, 4), 2)
|
||||
@@ -77,8 +78,8 @@ def apply_parallel(function, array, chunks=None, depth=0, mode=None,
|
||||
|
||||
Notes
|
||||
-----
|
||||
Numpy edge modes `symmetric`, `wrap` and `edge` are converted to the
|
||||
equivalent `dask` boundary modes `reflect`, `periodic` and `nearest`,
|
||||
Numpy edge modes 'symmetric', 'wrap', and 'edge' are converted to the
|
||||
equivalent `dask` boundary modes 'reflect', 'periodic' and 'nearest',
|
||||
respectively.
|
||||
"""
|
||||
import dask.array as da
|
||||
|
||||
Reference in New Issue
Block a user