Added docs, tests for downsample() in skimage.transform._warps

This commit is contained in:
Ankit Agrawal
2013-07-04 17:31:27 +08:00
parent 329cf37ca2
commit 7282f561d4
5 changed files with 103 additions and 62 deletions
+12
View File
@@ -230,3 +230,15 @@ def view_as_windows(arr_in, window_shape):
arr_out = as_strided(arr_in, shape=new_shape, strides=new_strides)
return arr_out
def _pad_asymmetric_zeros(arr, pad_amt, axis=-1):
"""Pads `arr` with zeros by `pad_amt` along specified `axis`"""
if axis == -1:
axis = arr.ndim - 1
zeroshape = tuple([x if i != axis else pad_amt
for (i, x) in enumerate(arr.shape)])
return np.concatenate((arr, np.zeros(zeroshape, dtype=arr.dtype)),
axis=axis)