Current File : //proc/self/root/proc/self/root/lib64/python2.7/site-packages/numpy/lib/arraypad.pyc |
�
E�`Qc @ s� d Z d d l Z d g Z d � Z d � Z d � Z d � Z d � Z d � Z d
� Z
d � Z d � Z d
� Z
d � Z d � Z d � Z d � Z d d � Z d S( sk
The arraypad module contains a group of functions to pad values onto the edges
of an n-dimensional array.
i����Nt padc C s4 | | | d *| d d k r0 | | | d )n | S( s
Private function which creates the padded vector.
Parameters
----------
vector : ndarray of rank 1, length N + pad_tuple[0] + pad_tuple[1]
Input vector including blank padded values. `N` is the lenth of the
original vector.
pad_tuple : tuple
This tuple represents the (before, after) width of the padding along
this particular iaxis.
before_val : scalar or ndarray of rank 1, length pad_tuple[0]
This is the value(s) that will pad the beginning of `vector`.
after_val : scalar or ndarray of rank 1, length pad_tuple[1]
This is the value(s) that will pad the end of the `vector`.
Returns
-------
_create_vector : ndarray
Vector with before_val and after_val replacing the blank pad values.
i i ( ( t vectort pad_tuplet
before_valt after_val( ( s8 /usr/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt _create_vector s c
C s� d } t t j | � � } t | t � r@ | | f f | } n<t | t t f � r� t | d t t f � r� t | � | k r� | } x� | D]4 } t | � d k r� d } t | | f � � q� q� Wn� t | t t f � r)t | d t t t
f � r)t | � d k r)| d | d f f | } nS t | t t f � r|t | d t t t
f � r|t | � d k r|| f | } n | d k r�d } t | | f � � n | S( s+
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, 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 where `N` is rank of `narray`.
((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
-------
_normalize_shape : 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), ...)
i i s/ Unable to create correctly shaped tuple from %si N( t Nonet lent npt shapet
isinstancet intt tuplet listt
ValueErrort floatt long( t narrayR t normshpt shapelent it fmt( ( s8 /usr/lib64/python2.7/site-packages/numpy/lib/arraypad.pyt _normalize_shape+ s0
c C su t t j | � � } t | | � } xJ | D]B } | d d k sQ | d d k r+ d } t | | f � � q+ q+ W| 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), ...)
i i s"