diff --git a/skimage/util/_regular_grid.py b/skimage/util/_regular_grid.py index e304be20..898a4aed 100644 --- a/skimage/util/_regular_grid.py +++ b/skimage/util/_regular_grid.py @@ -3,7 +3,7 @@ import numpy as np def regular_grid(ar_shape, n_points): """Find `n_points` regularly spaced along `ar_shape`. - + The returned points (as slices) should be as close to cubically-spaced as possible. Essentially, the points are spaced by the Nth root of the input array size, where N is the number of dimensions. However, if an array @@ -13,7 +13,7 @@ def regular_grid(ar_shape, n_points): Parameters ---------- ar_shape : array-like of ints - The shape of the space embedding the grid. `len(ar_shape)` is the + The shape of the space embedding the grid. ``len(ar_shape)`` is the number of dimensions. n_points : int The (approximate) number of points to embed in the space. @@ -66,7 +66,7 @@ def regular_grid(ar_shape, n_points): break starts = stepsizes // 2 stepsizes = np.round(stepsizes) - slices = [slice(start, None, step) for + slices = [slice(start, None, step) for start, step in zip(starts, stepsizes)] slices = [slices[i] for i in unsort_dim_idxs] return slices diff --git a/skimage/util/montage.py b/skimage/util/montage.py index bdafe6ed..805b78a8 100644 --- a/skimage/util/montage.py +++ b/skimage/util/montage.py @@ -10,7 +10,7 @@ def montage2d(arr_in, fill='mean', rescale_intensity=False, grid_shape=None): """Create a 2-dimensional 'montage' from a 3-dimensional input array representing an ensemble of equally shaped 2-dimensional images. - For example, montage2d(arr_in, fill) with the following `arr_in` + For example, ``montage2d(arr_in, fill)`` with the following `arr_in` +---+---+---+ | 1 | 2 | 3 | @@ -37,7 +37,8 @@ def montage2d(arr_in, fill='mean', rescale_intensity=False, grid_shape=None): rescale_intensity: bool, optional Whether to rescale the intensity of each image to [0, 1]. grid_shape: tuple, optional - The desired grid shape for the montage (tiles_y, tiles_x). Tthe default aspect ratio is square. + The desired grid shape for the montage (tiles_y, tiles_x). + The default aspect ratio is square. Returns ------- diff --git a/skimage/util/shape.py b/skimage/util/shape.py index 1d606b42..5fe27a36 100644 --- a/skimage/util/shape.py +++ b/skimage/util/shape.py @@ -208,11 +208,11 @@ def view_as_windows(arr_in, window_shape, step=1): # -- basic checks on arguments if not isinstance(arr_in, np.ndarray): - raise TypeError("'arr_in' must be a numpy ndarray") + raise TypeError("`arr_in` must be a numpy ndarray") if not isinstance(window_shape, tuple): - raise TypeError("'window_shape' must be a tuple") + raise TypeError("`window_shape` must be a tuple") if not (len(window_shape) == arr_in.ndim): - raise ValueError("'window_shape' is incompatible with 'arr_in.shape'") + raise ValueError("`window_shape` is incompatible with `arr_in.shape`") if step < 1: raise ValueError("`step` must be >= 1") @@ -221,10 +221,10 @@ def view_as_windows(arr_in, window_shape, step=1): window_shape = np.array(window_shape, dtype=arr_shape.dtype) if ((arr_shape - window_shape) < 0).any(): - raise ValueError("'window_shape' is too large") + raise ValueError("`window_shape` is too large") if ((window_shape - 1) < 0).any(): - raise ValueError("'window_shape' is too small") + raise ValueError("`window_shape` is too small") # -- build rolling window view arr_in = np.ascontiguousarray(arr_in) diff --git a/skimage/util/unique.py b/skimage/util/unique.py index e65c05ce..16a83f6b 100644 --- a/skimage/util/unique.py +++ b/skimage/util/unique.py @@ -9,12 +9,12 @@ def unique_rows(ar): Parameters ---------- - ar : 2D np.ndarray + ar : 2-D ndarray The input array. Returns ------- - ar_out : 2D np.ndarray + ar_out : 2-D ndarray A copy of the input array with repeated rows removed. Raises