Misc doc string fixes

This commit is contained in:
Johannes Schönberger
2013-10-02 17:07:23 +02:00
parent c3d40447f8
commit 3e3a52331d
4 changed files with 13 additions and 12 deletions
+3 -3
View File
@@ -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
+3 -2
View File
@@ -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
-------
+5 -5
View File
@@ -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)
+2 -2
View File
@@ -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