관리-도구
편집 파일: arraypad.cpython-37.pyc
B ��FdD� � @ s d Z ddlmZmZmZ ddlZdgZd3dd�Zdd � Z d4dd�Z d5d d�Zd6dd�Zd7dd�Z d8dd�Zd9dd�Zd:dd�Zd;dd�Zd<dd�Zd=dd�Zd>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. � )�division�absolute_import�print_functionN�padFc s� t � �fdd�t| j�D ��}|s8t�d�� d �}nt��� dd�}|�|�}x0t��D ]$\}}|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&