%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyo

�
�9Zc@`s:dZddlmZmZmZddlZdgZed�Z	d�Z
dd�Zdd	�Zdd
�Z
dd�Zdd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed�Zd�Zd�ZdS(sl
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.

i(tdivisiontabsolute_importtprint_functionNtpadc`s�t��fd�t|j�D��}|sKtjd��d�}ntj��dd�}|j|�}xEt��D]7\}}|j||kr�|j|d|�}q�q�W|S(s�
    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.

    c3`s1|]'\}}|�kr!dn��VqdS(iN((t.0titx(taxistshape(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>0siii����R(ttuplet	enumerateRtnptarangetreshapetrepeat(tarrRRtreverset	initshapetpadarrRtdim((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_arange_ndarrayscC`s,tj|tj�r(|jd|�ndS(s�
    Rounds arr inplace if destination dtype is integer.

    Parameters
    ----------
    arr : ndarray
        Input array.
    dtype : dtype
        The dtype of the destination array.

    toutN(Rt
issubdtypetintegertround(Rtdtype((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_round_ifneeded=si����c`s��dkr|St��fd�t|j�D��}|dkrotjtj|d|j�|fd��Stjtj|�|j|j�|fd��SdS(s
    Prepend constant `val` along `axis` of `arr`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    val : scalar
        Constant value to use. For best results should be of type `arr.dtype`;
        if not `arr.dtype` will be cast to `arr.dtype`.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` constant `val` prepended along `axis`.

    ic3`s-|]#\}}|�kr!|n�VqdS(N((RRR(Rtpad_amt(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>esRRN(R	R
RRtconcatenatetzerosRtastype(RRtvalRtpadshape((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_prepend_constMs$"c`s��dkr|St��fd�t|j�D��}|dkrotj|tj|d|j�fd��Stj|tj|�|j|j�fd��SdS(s
    Append constant `val` along `axis` of `arr`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    val : scalar
        Constant value to use. For best results should be of type `arr.dtype`;
        if not `arr.dtype` will be cast to `arr.dtype`.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` constant `val` appended along `axis`.

    ic3`s-|]#\}}|�kr!|n�VqdS(N((RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRRN(R	R
RRRRRR(RRRRR ((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt
_append_constos$c`s�|dkr|St�fd�t|j�D��}t�fd�t|j�D��}||j|�}tj|j|d��|fd��S(s�
    Prepend `pad_amt` to `arr` along `axis` by extending edge values.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, extended by `pad_amt` edge values appended along `axis`.

    ic3`s3|])\}}|�kr'td�ndVqdS(iN(tslicetNone(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sR(R	R
RR
RRR(RRRt
edge_slicet
pad_singletontedge_arr((RsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt
_prepend_edge�s!c`s�|dkr�St��fd�t�j�D��}t�fd�t�j�D��}�|j|�}tj�|j|d��fd��S(s�
    Append `pad_amt` to `arr` along `axis` by extending edge values.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, extended by `pad_amt` edge values prepended along
        `axis`.

    ic3`s>|]4\}}|�kr'td�n�j�dVqdS(iN(R#R$R(RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sR(R	R
RR
RRR(RRRR%R&R'((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_edge�s!c
`s"�dkr|St��fd�t|j�D��}t||�dt�jtj�}t�fd�t|j�D��}t�fd�t|j�D��}||j|�j	���}||t
��}	||	}||7}t||j�tj
|j|j�|fd��S(sF
    Prepend linear ramp along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    end : scalar
        Constal value to use. For best results should be of type `arr.dtype`;
        if not `arr.dtype` will be cast to `arr.dtype`.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values prepended along `axis`. The
        prepended region ramps linearly from the edge value to `end`.

    ic3`s-|]#\}}|�kr!|n�VqdS(N((RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRc3`s3|])\}}|�kr'td�ndVqdS(iN(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sR(R	R
RRtTrueRRtfloat64R
RtfloatRRR(
RRtendRR tramp_arrR%R&tedge_padtslope((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt
_prepend_ramp�s 

c
`s"�dkr|St��fd�t|j�D��}t||�dt�jtj�}t�fd�t|j�D��}t�fd�t|j�D��}||j|�j	���}||t
��}	||	}||7}t||j�tj
||j|j�fd��S(sB
    Append linear ramp along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    end : scalar
        Constal value to use. For best results should be of type `arr.dtype`;
        if not `arr.dtype` will be cast to `arr.dtype`.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        appended region ramps linearly from the edge value to `end`.

    ic3`s-|]#\}}|�kr!|n�VqdS(N((RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>&sRc3`s3|])\}}|�kr'td�ndVqdS(i����N(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>.sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>2sR(R	R
RRtFalseRRR+R
RR,RRR(
RRR-RR R.R%R&R/R0((RRsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_ramps 

c`s�|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWnt��fd�t|j�D��}t�fd�t|j�D��}||jd��j|�}tj|j	|d��|fd��S(sS
    Prepend `pad_amt` maximum values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    num : int
        Depth into `arr` along `axis` to calculate maximum.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        prepended region is the maximum of the first `num` values along
        `axis`.

    iic3`s9|]/\}}|�kr'td�n	t��VqdS(N(R#R$(RRR(Rtnum(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>gsc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>ksRN(
R(R$RR	R
tmaxR
RRR(RRR4Rt	max_sliceR&t	max_chunk((RR4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_prepend_maxBs!c`s'|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWn|j�d��dk	r�t���fd�t|j�D��}ntd�|jD��}t�fd�t|j�D��}||jd��j|�}tj||j	|d��fd��S(s_
    Pad one `axis` of `arr` with the maximum of the last `num` elements.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    num : int
        Depth into `arr` along `axis` to calculate maximum.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        appended region is the maximum of the final `num` values along `axis`.

    iic3`sC|]9\}}|�kr'td�nt���d�VqdS(i����N(R#R$(RRR(RR-R4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�scs`s|]}td�VqdS(N(R#R$(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRN(
R)R$RR	R
R5R
RRR(RRR4RR6R&R7((RR-R4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_maxvs$!c`s|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWnt��fd�t|j�D��}t�fd�t|j�D��}||j��j|�}t||j�t	j
|j|��j|j�|fd��S(sC
    Prepend `pad_amt` mean values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    num : int
        Depth into `arr` along `axis` to calculate mean.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values prepended along `axis`. The
        prepended region is the mean of the first `num` values along `axis`.

    iic3`s9|]/\}}|�kr'td�n	t��VqdS(N(R#R$(RRR(RR4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRN(
R(R$RR	R
tmeanR
RRRRRR(RRR4Rt
mean_sliceR&t
mean_chunk((RR4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt
_prepend_mean�s!c`s@|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWn|j�d��dk	r�t���fd�t|j�D��}ntd�|jD��}t�fd�t|j�D��}||jd��j|�}t||j�t	j
||j|��j|j�fd��S(sB
    Append `pad_amt` mean values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    num : int
        Depth into `arr` along `axis` to calculate mean.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        appended region is the maximum of the final `num` values along `axis`.

    iic3`sC|]9\}}|�kr'td�nt���d�VqdS(i����N(R#R$(RRR(RR-R4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>	scs`s|]}td�VqdS(N(R#R$(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>sRN(
R)R$RR	R
R:R
RRRRRR(RRR4RR;R&R<((RR-R4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_mean�s&c`s|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWnt��fd�t|j�D��}t�fd�t|j�D��}tj||d��j|�}t||j	�tj
|j|��j|j	�|fd��S(sI
    Prepend `pad_amt` median values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    num : int
        Depth into `arr` along `axis` to calculate median.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values prepended along `axis`. The
        prepended region is the median of the first `num` values along `axis`.

    iic3`s9|]/\}}|�kr'td�n	t��VqdS(N(R#R$(RRR(RR4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>?sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>CsRN(
R(R$RR	R
RtmedianR
RRRRR(RRR4Rt	med_sliceR&t	med_chunk((RR4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_prepend_meds"c`sC|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWn|j�d��dk	r�t���fd�t|j�D��}ntd�|jD��}t�fd�t|j�D��}tj||d��j|�}t||j	�tj
||j|��j|j	�fd��S(sE
    Append `pad_amt` median values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    num : int
        Depth into `arr` along `axis` to calculate median.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        appended region is the median of the final `num` values along `axis`.

    iic3`sC|]9\}}|�kr'td�nt���d�VqdS(i����N(R#R$(RRR(RR-R4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>vscs`s|]}td�VqdS(N(R#R$(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>ysc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>|sRN(
R)R$RR	R
RR?R
RRRRR(RRR4RR@R&RA((RR-R4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_medOs&"c`s�|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWnt��fd�t|j�D��}t�fd�t|j�D��}||jd��j|�}tj|j	|d��|fd��S(sT
    Prepend `pad_amt` minimum values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to prepend.
    num : int
        Depth into `arr` along `axis` to calculate minimum.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values prepended along `axis`. The
        prepended region is the minimum of the first `num` values along
        `axis`.

    iic3`s9|]/\}}|�kr'td�n	t��VqdS(N(R#R$(RRR(RR4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRN(
R(R$RR	R
tminR
RRR(RRR4Rt	min_sliceR&t	min_chunk((RR4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_prepend_min�s!c`s'|dkr|S�dkr,t||��S�dk	rW�|j�krWd�qWn|j�d��dk	r�t���fd�t|j�D��}ntd�|jD��}t�fd�t|j�D��}||jd��j|�}tj||j	|d��fd��S(sG
    Append `pad_amt` median values along `axis`.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : int
        Amount of padding to append.
    num : int
        Depth into `arr` along `axis` to calculate minimum.
        Range: [1, `arr.shape[axis]`] or None (entire axis)
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt` values appended along `axis`. The
        appended region is the minimum of the final `num` values along `axis`.

    iic3`sC|]9\}}|�kr'td�nt���d�VqdS(i����N(R#R$(RRR(RR-R4(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�scs`s|]}td�VqdS(N(R#R$(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sRN(
R)R$RR	R
RDR
RRR(RRR4RRER&RF((RR-R4sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_append_min�s$!c`s#�ddkr$�ddkr$|St��fd�t|j�D��}||}t�fd�t|j�D��}�ddkr�|j|�}nd|kr�ddkrt�fd�t|j�D��}||j|�}d||}~n|j��dd�|j�d�t���fd�t|j�D��}t�fd	�t|j�D��}	|||	}
�ddkr�|
j|�}
nd|krt�fd
�t|j�D��}||j|�}d||
}
~ntj|||
fd��S(s�
    Pad `axis` of `arr` by reflection.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : tuple of ints, length 2
        Padding to (prepend, append) along `axis`.
    method : str
        Controls method of reflection; options are 'even' or 'odd'.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt[0]` values prepended and `pad_amt[1]`
        values appended along `axis`. Both regions are padded with reflected
        values from the original array.

    Notes
    -----
    This algorithm does not pad with repetition, i.e. the edges are not
    repeated in the reflection. For that behavior, use `mode='symmetric'`.

    The modes 'reflect', 'symmetric', and 'wrap' must be padded with a
    single function, lest the indexing tricks in non-integer multiples of the
    original shape would violate repetition in the final iteration.

    iic3`sC|]9\}}|�kr'td�nt�ddd�VqdS(ii����N(R#R$(RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>"stoddc3`s3|])\}}|�kr'td�ndVqdS(iN(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>)sic3`s<|]2\}}|�kr'td�nt���VqdS(N(R#R$(RRR(RR-tstart(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>5sc3`s?|]5\}}|�kr'td�ntddd�VqdS(i����N(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>7sc3`s3|])\}}|�kr'td�ndVqdS(i����N(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>?sR(R	R
RR
RR(RRtmethodRt	ref_slicet
ref_chunk1R&tedge_slice1t
edge_chunktrev_idxt
ref_chunk2tedge_slice2((RR-RRJsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_pad_ref�s>! 
c`s�ddkr$�ddkr$|St��fd�t|j�D��}t�fd�t|j�D��}|||}t�fd�t|j�D��}�ddkr�|j|�}nd|kr.�ddkr.t�fd�t|j�D��}||j|�}	d|	|}~	n|j��d�|j��t���fd	�t|j�D��}|||}
�ddkr�|
j|�}
nd|krt�fd
�t|j�D��}||j|�}	d|	|
}
~	ntj|||
fd��S(s�
    Pad `axis` of `arr` by symmetry.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : tuple of ints, length 2
        Padding to (prepend, append) along `axis`.
    method : str
        Controls method of symmetry; options are 'even' or 'odd'.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt[0]` values prepended and `pad_amt[1]`
        values appended along `axis`. Both regions are padded with symmetric
        values from the original array.

    Notes
    -----
    This algorithm DOES pad with repetition, i.e. the edges are repeated.
    For padding without repeated edges, use `mode='reflect'`.

    The modes 'reflect', 'symmetric', and 'wrap' must be padded with a
    single function, lest the indexing tricks in non-integer multiples of the
    original shape would violate repetition in the final iteration.

    iic3`s@|]6\}}|�kr'td�ntd�d�VqdS(iN(R#R$(RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>qsc3`s?|]5\}}|�kr'td�ntddd�VqdS(i����N(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>ssc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>xsRIc3`s3|])\}}|�kr'td�ndVqdS(iN(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>sic3`s<|]2\}}|�kr'td�nt���VqdS(N(R#R$(RRR(RR-RJ(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s3|])\}}|�kr'td�ndVqdS(i����N(R#R$(RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sR(R	R
RR
RR(RRRKRt	sym_sliceRPt
sym_chunk1R&RNROt
sym_chunk2RR((RR-RRJsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_pad_symIs>! 
c`s2�ddkr$�ddkr$|S|j��d�|j��t���fd�t|j�D��}||}t�fd�t|j�D��}�ddkr�|j|�}nt��fd�t|j�D��}||}�ddkr|j|�}ntj|||fd��S(s1
    Pad `axis` of `arr` via wrapping.

    Parameters
    ----------
    arr : ndarray
        Input array of arbitrary shape.
    pad_amt : tuple of ints, length 2
        Padding to (prepend, append) along `axis`.
    axis : int
        Axis along which to pad `arr`.

    Returns
    -------
    padarr : ndarray
        Output array, with `pad_amt[0]` values prepended and `pad_amt[1]`
        values appended along `axis`. Both regions are padded wrapped values
        from the opposite end of `axis`.

    Notes
    -----
    This method of padding is also known as 'tile' or 'tiling'.

    The modes 'reflect', 'symmetric', and 'wrap' must be padded with a
    single function, lest the indexing tricks in non-integer multiples of the
    original shape would violate repetition in the final iteration.

    iic3`s<|]2\}}|�kr'td�nt���VqdS(N(R#R$(RRR(RR-RJ(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s-|]#\}}|�kr!|ndVqdS(iN((RRR(R(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sc3`s@|]6\}}|�kr'td�ntd�d�VqdS(iiN(R#R$(RRR(RR(sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>�sR(RR	R
R
RR(RRRt
wrap_slicetwrap_chunk1R&twrap_chunk2((RR-RRJsE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt	_pad_wrap�s" 


cC`s�|j}|dkrd
|Stj|�}|jdkr�|jdksY|jdkr~tj|dfd|j�|}ql|jd
kr�|tjdd�fj|dd�}qld}t	||f��n�|jdkrS|jddkr!|jd|kr!|jddd�}ql|jd|kr7qld}t	||f��nd}t	||f��|t
kr�tj|�jt
�}ntd�|j�D��S(sZ
    Private function which does some checks and normalizes the possibly
    much simpler representations of 'pad_width', 'stat_length',
    'constant_values', 'end_values'.

    Parameters
    ----------
    narray : ndarray
        Input ndarray
    shape : {sequence, array_like, float, int}, optional
        The width of padding (pad_width), the number of elements on the
        edge of the narray used for statistics (stat_length), the constant
        value(s) to use when filling padded regions (constant_values), or the
        endpoint target(s) for linear ramps (end_values).
        ((before_1, after_1), ... (before_N, after_N)) unique number of
        elements for each axis where `N` is rank of `narray`.
        ((before, after),) yields same before and after constants for each
        axis.
        (constant,) or val is a shortcut for before = after = constant for
        all axes.
    cast_to_int : bool, optional
        Controls if values in ``shape`` will be rounded and cast to int
        before being returned.

    Returns
    -------
    normalized_shape : tuple of tuples
        val                               => ((val, val), (val, val), ...)
        [[val1, val2], [val3, val4], ...] => ((val1, val2), (val3, val4), ...)
        ((val1, val2), (val3, val4), ...) => no change
        [[val1, val2], ]                  => ((val1, val2), (val1, val2), ...)
        ((val1, val2), )                  => ((val1, val2), (val1, val2), ...)
        [[val ,     ], ]                  => ((val, val), (val, val), ...)
        ((val ,     ), )                  => ((val, val), (val, val), ...)

    iiRNRis/Unable to create correctly shaped tuple from %scs`s|]}t|�VqdS(N(R	(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pys	<genexpr>-s(NN((NN((i(i(tndimR$RtasarrayRtonesRtnewaxisRt
ValueErrorR*RRtintR	ttolist(tndarrayRtcast_to_inttndimsRtfmt((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_normalize_shape�s.%	%+&cC`s�t||�}x�|D]�}g|D]}|dkr;dn|^q#}g|D]}|dkrfdnd^qN}|ddks�|ddkrd}t||f��qqW|S(s�
    Private function which does some checks and reformats pad_width and
    stat_length using _normalize_shape.

    Parameters
    ----------
    narray : ndarray
        Input ndarray
    number_elements : {sequence, int}, optional
        The width of padding (pad_width) or the number of elements on the edge
        of the narray used for statistics (stat_length).
        ((before_1, after_1), ... (before_N, after_N)) unique number of
        elements for each axis.
        ((before, after),) yields same before and after constants for each
        axis.
        (constant,) or int is a shortcut for before = after = constant for all
        axes.

    Returns
    -------
    _validate_lengths : tuple of tuples
        int                               => ((int, int), (int, int), ...)
        [[int1, int2], [int3, int4], ...] => ((int1, int2), (int3, int4), ...)
        ((int1, int2), (int3, int4), ...) => no change
        [[int1, int2], ]                  => ((int1, int2), (int1, int2), ...)
        ((int1, int2), )                  => ((int1, int2), (int1, int2), ...)
        [[int ,     ], ]                  => ((int, int), (int, int), ...)
        ((int ,     ), )                  => ((int, int), (int, int), ...)

    iii����s"%s cannot contain negative values.N(RgR$R`(tnarraytnumber_elementstnormshpRRtchkRf((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt_validate_lengths0s
++ cK`s�tj|�jjdks*td��ntj|�}t||�}i
dgd6gd6dgd6dgd	6dgd
6dgd6dgd6d
gd6d
gd6gd6}idd6dd6dd6dd
6}t|tj	j
�r�x;|D]3}|||kr�td|||f��q�q�Wx&||D]}|j|||�q,WxQ|D]X}	|	dkr}t|||	�||	<n|	dkrQt
|||	dt�||	<qQqQWn�|}
ttt|j���}g|D]}	tj||	�^q�}g|D]0}	t||	d||	d|j|	�^q�}
tj|j�|}tj||j�}|||
<x.|D]&}tj|
||||||�qpW|S|j�}|dkrxtt||d��D]H\}\\}}\}}t||||�}t||||�}q�Wn�|dkrux�t|�D]6\}\}}t|||�}t|||�}q8Wn\|dkr�xMtt||d��D]H\}\\}}\}}t||||�}t||||�}q�Wn�|d	kr_x�tt||d��D]H\}\\}}\}}t ||||�}t!||||�}qWnr|d
kr�xctt||d��D]H\}\\}}\}}t"||||�}t#||||�}q�Wn�|dkrIx�tt||d��D]H\}\\}}\}}t$||||�}t%||||�}q�Wn�|dkr�xytt||d��D]H\}\\}}\}}t&||||�}t'||||�}qoWn|dkrxt|�D]'\}\}}|dks|dkr>|j|dkr>t|||�}t|||�}q�n|d
}|j|d}x�||kst||kr�t(||||�}t(||||�}t)|||f||�}||8}||8}|||7}q\Wt)|||f||�}q�Wn�|dkr�x�t|�D]�\}\}}|d
}|j|}x�||ksb||kr�t(||||�}t(||||�}t*|||f||�}||8}||8}|||7}qJWt*|||f||�}qWn�|dkr�x�t|�D]�\}\}}|j|}x�||ksF||kr�t(||||�}t(||||�}t+|||f|�}||8}||8}|||7}q.Wt+|||f|�}qWn|S(s�
    Pads an array.

    Parameters
    ----------
    array : array_like of rank N
        Input array
    pad_width : {sequence, array_like, int}
        Number of values padded to the edges of each axis.
        ((before_1, after_1), ... (before_N, after_N)) unique pad widths
        for each axis.
        ((before, after),) yields same before and after pad for each axis.
        (pad,) or int is a shortcut for before = after = pad width for all
        axes.
    mode : str or function
        One of the following string values or a user supplied function.

        'constant'
            Pads with a constant value.
        'edge'
            Pads with the edge values of array.
        'linear_ramp'
            Pads with the linear ramp between end_value and the
            array edge value.
        'maximum'
            Pads with the maximum value of all or part of the
            vector along each axis.
        'mean'
            Pads with the mean value of all or part of the
            vector along each axis.
        'median'
            Pads with the median value of all or part of the
            vector along each axis.
        'minimum'
            Pads with the minimum value of all or part of the
            vector along each axis.
        'reflect'
            Pads with the reflection of the vector mirrored on
            the first and last values of the vector along each
            axis.
        'symmetric'
            Pads with the reflection of the vector mirrored
            along the edge of the array.
        'wrap'
            Pads with the wrap of the vector along the axis.
            The first values are used to pad the end and the
            end values are used to pad the beginning.
        <function>
            Padding function, see Notes.
    stat_length : sequence or int, optional
        Used in 'maximum', 'mean', 'median', and 'minimum'.  Number of
        values at edge of each axis used to calculate the statistic value.

        ((before_1, after_1), ... (before_N, after_N)) unique statistic
        lengths for each axis.

        ((before, after),) yields same before and after statistic lengths
        for each axis.

        (stat_length,) or int is a shortcut for before = after = statistic
        length for all axes.

        Default is ``None``, to use the entire axis.
    constant_values : sequence or int, optional
        Used in 'constant'.  The values to set the padded values for each
        axis.

        ((before_1, after_1), ... (before_N, after_N)) unique pad constants
        for each axis.

        ((before, after),) yields same before and after constants for each
        axis.

        (constant,) or int is a shortcut for before = after = constant for
        all axes.

        Default is 0.
    end_values : sequence or int, optional
        Used in 'linear_ramp'.  The values used for the ending value of the
        linear_ramp and that will form the edge of the padded array.

        ((before_1, after_1), ... (before_N, after_N)) unique end values
        for each axis.

        ((before, after),) yields same before and after end values for each
        axis.

        (constant,) or int is a shortcut for before = after = end value for
        all axes.

        Default is 0.
    reflect_type : {'even', 'odd'}, optional
        Used in 'reflect', and 'symmetric'.  The 'even' style is the
        default with an unaltered reflection around the edge value.  For
        the 'odd' style, the extented part of the array is created by
        subtracting the reflected values from two times the edge value.

    Returns
    -------
    pad : ndarray
        Padded array of rank equal to `array` with shape increased
        according to `pad_width`.

    Notes
    -----
    .. versionadded:: 1.7.0

    For an array with rank greater than 1, some of the padding of later
    axes is calculated from padding of previous axes.  This is easiest to
    think about with a rank 2 array where the corners of the padded array
    are calculated by using padded values from the first axis.

    The padding function, if used, should return a rank 1 array equal in
    length to the vector argument with padded values replaced. It has the
    following signature::

        padding_func(vector, iaxis_pad_width, iaxis, **kwargs)

    where

        vector : ndarray
            A rank 1 array already padded with zeros.  Padded values are
            vector[:pad_tuple[0]] and vector[-pad_tuple[1]:].
        iaxis_pad_width : tuple
            A 2-tuple of ints, iaxis_pad_width[0] represents the number of
            values padded at the beginning of vector where
            iaxis_pad_width[1] represents the number of values padded at
            the end of vector.
        iaxis : int
            The axis currently being calculated.
        kwargs : misc
            Any keyword arguments the function requires.

    Examples
    --------
    >>> a = [1, 2, 3, 4, 5]
    >>> np.lib.pad(a, (2,3), 'constant', constant_values=(4, 6))
    array([4, 4, 1, 2, 3, 4, 5, 6, 6, 6])

    >>> np.lib.pad(a, (2, 3), 'edge')
    array([1, 1, 1, 2, 3, 4, 5, 5, 5, 5])

    >>> np.lib.pad(a, (2, 3), 'linear_ramp', end_values=(5, -4))
    array([ 5,  3,  1,  2,  3,  4,  5,  2, -1, -4])

    >>> np.lib.pad(a, (2,), 'maximum')
    array([5, 5, 1, 2, 3, 4, 5, 5, 5])

    >>> np.lib.pad(a, (2,), 'mean')
    array([3, 3, 1, 2, 3, 4, 5, 3, 3])

    >>> np.lib.pad(a, (2,), 'median')
    array([3, 3, 1, 2, 3, 4, 5, 3, 3])

    >>> a = [[1, 2], [3, 4]]
    >>> np.lib.pad(a, ((3, 2), (2, 3)), 'minimum')
    array([[1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1],
           [3, 3, 3, 4, 3, 3, 3],
           [1, 1, 1, 2, 1, 1, 1],
           [1, 1, 1, 2, 1, 1, 1]])

    >>> a = [1, 2, 3, 4, 5]
    >>> np.lib.pad(a, (2, 3), 'reflect')
    array([3, 2, 1, 2, 3, 4, 5, 4, 3, 2])

    >>> np.lib.pad(a, (2, 3), 'reflect', reflect_type='odd')
    array([-1,  0,  1,  2,  3,  4,  5,  6,  7,  8])

    >>> np.lib.pad(a, (2, 3), 'symmetric')
    array([2, 1, 1, 2, 3, 4, 5, 5, 4, 3])

    >>> np.lib.pad(a, (2, 3), 'symmetric', reflect_type='odd')
    array([0, 1, 1, 2, 3, 4, 5, 5, 6, 7])

    >>> np.lib.pad(a, (2, 3), 'wrap')
    array([4, 5, 1, 2, 3, 4, 5, 1, 2, 3])

    >>> def padwithtens(vector, pad_width, iaxis, kwargs):
    ...     vector[:pad_width[0]] = 10
    ...     vector[-pad_width[1]:] = 10
    ...     return vector

    >>> a = np.arange(6)
    >>> a = a.reshape((2, 3))

    >>> np.lib.pad(a, 2, padwithtens)
    array([[10, 10, 10, 10, 10, 10, 10],
           [10, 10, 10, 10, 10, 10, 10],
           [10, 10,  0,  1,  2, 10, 10],
           [10, 10,  3,  4,  5, 10, 10],
           [10, 10, 10, 10, 10, 10, 10],
           [10, 10, 10, 10, 10, 10, 10]])
    Rs%`pad_width` must be of integral type.tconstant_valuestconstanttedget
end_valuestlinear_ramptstat_lengthtmaximumR:R?tminimumtreflect_typetreflectt	symmetrictwrapitevens%%s keyword not in allowed keywords %sRdiN(RpRm(,RR]Rtkindt	TypeErrortarrayRlR$t
isinstancetcompatt
basestringR`t
setdefaultRgR2tlisttrangetlenRtsumR#Rtapply_along_axistcopyR
tzipR!R"R(R)R1R3R8R9R=R>RBRCRGRHRDRSRWR[(R|t	pad_widthtmodetkwargsRht
allowedkwargst
kwdefaultstkeytkwRtfunctiontrankttotal_dim_increaset
offset_slicest	new_shapetnewmattiaxisRt
pad_beforet	pad_aftert
before_valt	after_valtchunk_beforetchunk_afterRKtsafe_padt
pad_iter_bt
pad_iter_a((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyR]s�











&:

	555555
	

"

	

"


( t__doc__t
__future__RRRtnumpyRt__all__R2RRR!R"R(R)R1R3R8R9R=R>RBRCRGRHRSRWR[R*RgRlR(((sE/opt/alt/python27/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt<module>s2	+	""!"7748494948UT@S	-

Zerion Mini Shell 1.0