B
<FdD @ s d Z ddlmZmZmZ ddlZdgZd3ddZdd Z d4ddZ
d5d
dZd6ddZd7ddZ
d8ddZd9ddZd:ddZd;ddZd<ddZd=ddZd>dd Zd?d!d"Zd@d#d$ZdAd%d&ZdBd'd(ZdCd)d*ZdDd+d,ZdEd.d/Zd0d1 Zd2d ZdS )Fzl
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.
)divisionabsolute_importprint_functionNpadFc s t fddt| jD }|s8td d }nt dd}||}x0tD ]$\}}|j| |kr^|j||d}q^W |S )a
Create an ndarray of `shape` with increments along specified `axis`
Parameters
----------
arr : ndarray
Input array of arbitrary shape.
shape : tuple of ints
Shape of desired array. Should be equivalent to `arr.shape` except
`shape[axis]` which may have any positive value.
axis : int
Axis to increment along.
reverse : bool
If False, increment in a positive fashion from 1 to `shape[axis]`,
inclusive. If True, the bounds are the same but the order reversed.
Returns
-------
padarr : ndarray
Output array sized to pad `arr` along `axis`, with linear range from
1 to `shape[axis]` along specified `axis`.
Notes
-----
The range is deliberately 1-indexed for this specific use case. Think of
this algorithm as broadcasting `np.arange` to a single `axis` of an
arbitrarily shaped ndarray.
c 3 s&