
:Ic        /   @   s  d  Z  d d d d d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ g/ Z d0 d1 k Z d0 d1 k Z d0 d1 k i i Z d0 d2 k l Z l	 Z	 l
 Z
 l Z l Z l Z l Z l Z l Z l Z l Z d0 d3 k l Z l Z l Z l Z l Z l Z l Z d0 d4 k l Z l Z l Z l Z l Z l  Z  l! Z! l" Z" l# Z# l$ Z$ l% Z% l& Z& l' Z' d0 d5 k( l) Z) l* Z* l+ Z+ l, Z, l- Z- d0 d6 k. l/ Z/ l0 Z0 d0 d7 k1 l2 Z2 l3 Z3 d0 d8 k4 l5 Z5 d0 d9 k6 l7 Z7 l8 Z8 d0 d: k6 l9 Z9 l: Z: l; Z< d0 d; k= l> Z> d0 d1 k? Z@ d< eA eB d=  ZC d< eA d> d?  ZD d@   ZE dA d1 eB d1 d1 dB  ZG dA d1 eB d1 dC  ZH d1 d1 eB dD  ZI dE   ZJ dF   ZK dG dH  ZL dI   ZM dJ   ZN dK d0 dL  ZO d1 d1 dM  Z; dG dN  ZP e d0 dO  ZQ dP   ZR dQ dR  ZS d0 d1 kT ZT eT iU dS j  o d0 dT kV lW ZX n dU   ZY dV   ZZ dW   Z[ d1 dX  Z\ d1 dY  Z] d1 dZ  Z^ d1 d[  Z_ d1 d\  Z` d1 d]  Za d1 eA d^  Zb d0 d1 kc Zc d_   Zd d ee f d`     YZf d1 dK dG da  Zg d1 dK dG db  Zh dc   Zi dd   Zj de   Zk df   Zl dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz d{ d| d} d~ d d d d d d g Zm d d d d d d d d d d d d d d d d d d d d d d d d d g Zn d   Zo d   Zp d   Zq d   Zr d   Zs d   Zt d   Zu d1 d1 eB d  Zv d1 d d0 d  Zw d   Zx d   Zy d1 d  Zz d1 d  Z{ d1 d  Z| d1 S(   s   restructuredtext ent   logspacet   linspacet   selectt	   piecewiset
   trim_zerost   copyt   iterablet   difft   gradientt   anglet   unwrapt   sort_complext   dispt   uniquet   extractt   placet   nansumt   nanmaxt	   nanargmaxt	   nanargmint   nanmint	   vectorizet   asarray_chkfinitet   averaget	   histogramt   histogramddt   bincountt   digitizet   covt   corrcoeft   msortt   mediant   sinct   hammingt   hanningt   bartlettt   blackmant   kaisert   trapzt   i0t
   add_newdoct   add_docstringt   meshgridt   deletet   insertt   appendt   interpiN(   t   onest   zerost   aranget   concatenatet   arrayt   asarrayt
   asanyarrayt   emptyt
   empty_liket   ndarrayt   around(   t
   ScalarTypet   dott   wheret   newaxist   intpt   integert   isscalar(   t   pit   multiplyt   addt   arctan2t
   frompyfunct   isnant   cost
   less_equalt   sqrtt   sint   modt   expt   log10(   t   ravelt   nonzerot   chooset   sortt   mean(   t	   typecodest   number(   t
   atleast_1dt
   atleast_2d(   t   diag(   t   _insertR)   (   R   R   R.   (   t	   setdiff1di2   c         C   s   t  |  } | d j o t g  t  S| oa | d j o t t |   g  S| |  t | d  } t i d |  | |  } | | d <n/ | |  t |  } t i d |  | |  } | o | | f S| Sd S(   sH  
    Return evenly spaced numbers over a specified interval.

    Returns `num` evenly spaced samples, calculated over the
    interval [`start`, `stop` ].

    The endpoint of the interval can optionally be excluded.

    Parameters
    ----------
    start : scalar
        The starting value of the sequence.
    stop : scalar
        The end value of the sequence, unless `endpoint` is set to False.
        In that case, the sequence consists of all but the last of ``num + 1``
        evenly spaced samples, so that `stop` is excluded.  Note that the step
        size changes when `endpoint` is False.
    num : int, optional
        Number of samples to generate. Default is 50.
    endpoint : bool, optional
        If True, `stop` is the last sample. Otherwise, it is not included.
        Default is True.
    retstep : bool, optional
        If True, return (`samples`, `step`), where `step` is the spacing
        between samples.

    Returns
    -------
    samples : ndarray
        There are `num` equally spaced samples in the closed interval
        ``[start, stop]`` or the half-open interval ``[start, stop)``
        (depending on whether `endpoint` is True or False).
    step : float (only if `retstep` is True)
        Size of spacing between samples.


    See Also
    --------
    arange : Similiar to `linspace`, but uses a step size (instead of the
             number of samples).
    logspace : Samples uniformly distributed in log space.

    Examples
    --------
    >>> np.linspace(2.0, 3.0, num=5)
        array([ 2.  ,  2.25,  2.5 ,  2.75,  3.  ])
    >>> np.linspace(2.0, 3.0, num=5, endpoint=False)
        array([ 2. ,  2.2,  2.4,  2.6,  2.8])
    >>> np.linspace(2.0, 3.0, num=5, retstep=True)
        (array([ 2.  ,  2.25,  2.5 ,  2.75,  3.  ]), 0.25)

    Graphical illustration:

    >>> import matplotlib.pyplot as plt
    >>> N = 8
    >>> y = np.zeros(N)
    >>> x1 = np.linspace(0, 10, N, endpoint=True)
    >>> x2 = np.linspace(0, 10, N, endpoint=False)
    >>> plt.plot(x1, y, 'o')
    >>> plt.plot(x2, y + 0.5, 'o')
    >>> plt.ylim([-0.5, 1])
    >>> plt.show()

    i    i   iN(   t   intR3   t   floatt   _nxR1   (   t   startt   stopt   numt   endpointt   retstept   stept   y(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   #   s    Ag      $@c         C   s+   t  |  | d | d | } t i | |  S(   s,	  
    Return numbers spaced evenly on a log scale.

    In linear space, the sequence starts at ``base ** start``
    (`base` to the power of `start`) and ends with ``base ** stop``
    (see `endpoint` below).

    Parameters
    ----------
    start : float
        ``base ** start`` is the starting value of the sequence.
    stop : float
        ``base ** stop`` is the final value of the sequence, unless `endpoint`
        is False.  In that case, ``num + 1`` values are spaced over the
        interval in log-space, of which all but the last (a sequence of
        length ``num``) are returned.
    num : integer, optional
        Number of samples to generate.  Default is 50.
    endpoint : boolean, optional
        If true, `stop` is the last sample. Otherwise, it is not included.
        Default is True.
    base : float, optional
        The base of the log space. The step size between the elements in
        ``ln(samples) / ln(base)`` (or ``log_base(samples)``) is uniform.
        Default is 10.0.

    Returns
    -------
    samples : ndarray
        `num` samples, equally spaced on a log scale.

    See Also
    --------
    arange : Similiar to linspace, with the step size specified instead of the
             number of samples. Note that, when used with a float endpoint, the
             endpoint may or may not be included.
    linspace : Similar to logspace, but with the samples uniformly distributed
               in linear space, instead of log space.

    Notes
    -----
    Logspace is equivalent to the code

    >>> y = linspace(start, stop, num=num, endpoint=endpoint)
    >>> power(base, y)

    Examples
    --------
    >>> np.logspace(2.0, 3.0, num=4)
        array([  100.        ,   215.443469  ,   464.15888336,  1000.        ])
    >>> np.logspace(2.0, 3.0, num=4, endpoint=False)
        array([ 100.        ,  177.827941  ,  316.22776602,  562.34132519])
    >>> np.logspace(2.0, 3.0, num=4, base=2.0)
        array([ 4.        ,  5.0396842 ,  6.34960421,  8.        ])

    Graphical illustration:

    >>> import matplotlib.pyplot as plt
    >>> N = 10
    >>> x1 = np.logspace(0.1, 1, N, endpoint=True)
    >>> x2 = np.logspace(0.1, 1, N, endpoint=False)
    >>> y = np.zeros(N)
    >>> plt.plot(x1, y, 'o')
    >>> plt.plot(x2, y + 0.5, 'o')
    >>> plt.ylim([-0.5, 1])
    >>> plt.show()

    R_   R`   (   R   R\   t   power(   R]   R^   R_   R`   t   baseRc   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR    u   s    Ec         C   s   y t  |   Wn d SXd S(   Ni    i   (   t   iter(   Rc   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR      s
      i
   c         C   s  | t  j o8t i d t  t |   i   }  | d j	 o* | \ } } | | j o t d  qf n t |  p | d j o |  i	   |  i
   f } n g  } | D] }	 | |	 d q ~ \ } } | | j o | d 8} | d 7} n t | | | d t  } nS | o t d  t d  n t |  } t i |  d j  i   o t d  n | d j	 o t d	  n d
 }
 t |  |
   i |  } xA t |
 |  i |
  D]* } | t |  | | |
 ! i |  7} qWt | t |   g g  } | d | d  } | o, | d | d } d |  i | | | f S| | f Sn| t d g j o| t j o t i d t  n t |   }  | d j	 oE t |  } t i | i |  i j  o t d  n | i   } n |  i   }  | d j	 o* | \ } } | | j o t d  qn t |  p | d j o |  i	   |  i
   f } n g  } | D] }	 | |	 d q[~ \ } } | | j o | d 8} | d 7} n t | | | d d t } n6 t |  } t i |  d j  i   o t d  n | d j o
 t } n
 | i } t i | i |  } d
 }
 | d j ou xKt d t |   |
  D]T } t |  | | |
 ! } | t i | i | d  d  | i | d d  f 7} qVWn t d d | } x t d t |   |
  D] } |  | | |
 !} | | | |
 !} t i |  } | | } | | } t i | g | i    f  } t i | i | d  d  | i | d d  f } | | | 7} qWt i |  } | t  j o | | f S| t j o1 t t i |  t!  } | | | i"   | f Sn d S(   s  
    Compute the histogram of a set of data.

    Parameters
    ----------
    a : array_like
        Input data.
    bins : int or sequence of scalars, optional
        If `bins` is an int, it defines the number of equal-width
        bins in the given range (10, by default). If `bins` is a sequence,
        it defines the bin edges, including the rightmost edge, allowing
        for non-uniform bin widths.
    range : (float, float), optional
        The lower and upper range of the bins.  If not provided, range
        is simply ``(a.min(), a.max())``.  Values outside the range are
        ignored. Note that with `new` set to False, values below
        the range are ignored, while those above the range are tallied
        in the rightmost bin.
    normed : bool, optional
        If False, the result will contain the number of samples
        in each bin.  If True, the result is the value of the
        probability *density* function at the bin, normalized such that
        the *integral* over the range is 1. Note that the sum of the
        histogram values will often not be equal to 1; it is not a
        probability *mass* function.
    weights : array_like, optional
        An array of weights, of the same shape as `a`.  Each value in `a`
        only contributes its associated weight towards the bin count
        (instead of 1).  If `normed` is True, the weights are normalized,
        so that the integral of the density over the range remains 1.
        The `weights` keyword is only available with `new` set to True.
    new : {None, True, False}, optional
        Whether to use the new semantics for histogram:
          * None : the new behaviour is used, no warning is printed.
          * True : the new behaviour is used and a warning is raised about
            the future removal of the `new` keyword.
          * False : the old behaviour is used and a DeprecationWarning
            is raised.
        As of NumPy 1.3, this keyword should not be used explicitly since it
        will disappear in NumPy 1.4.

    Returns
    -------
    hist : array
        The values of the histogram. See `normed` and `weights` for a
        description of the possible semantics.
    bin_edges : array of dtype float
        Return the bin edges ``(length(hist)+1)``.
        With ``new=False``, return the left bin edges (``length(hist)``).

    See Also
    --------
    histogramdd

    Notes
    -----
    All but the last (righthand-most) bin is half-open.  In other words, if
    `bins` is::

      [1, 2, 3, 4]

    then the first bin is ``[1, 2)`` (including 1, but excluding 2) and the
    second ``[2, 3)``.  The last bin, however, is ``[3, 4]``, which *includes*
    4.

    Examples
    --------
    >>> np.histogram([1,2,1], bins=[0,1,2,3])
    (array([0, 2, 1]), array([0, 1, 2, 3]))

    s   
        The histogram semantics being used is now deprecated and
        will disappear in NumPy 1.4.  Please update your code to
        use the default semantics.
        s/   max must be larger than min in range parameter.g        g      ?R`   s*   Use new=True to pass bin edges explicitly.i    s!   bins must increase monotonically.s)   weights are only available with new=True.i   i   ig      ?s   
            The new semantics of histogram is now the default and the `new`
            keyword will be removed in NumPy 1.4.
            s(   weights should have the same shape as a.t   leftt   rightt   dtypeN(#   t   Falset   warningst   warnt   DeprecationWarningR4   RN   t   Nonet   AttributeErrorR   t   mint   maxR   t
   ValueErrort   npR   t   anyRQ   t   searchsortedt   xranget   sizeR2   t   lent   Truet   Warningt   shapeRZ   Ri   R0   R1   t   r_R3   t   argsortt   cumsumR[   t   sum(   t   at   binst   ranget   normedt   weightst   newt   mnt   mxt   _[1]t   mit   blockt   nt   it   dbt   _[2]t   ntypet   sat   zerot   tmp_at   tmp_wt   sorting_indext   swt   cwt	   bin_index(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR      s    I
+
	 (+
 
	 # 

c         C   sv  y |  i  \ } } Wn7 t t f j
 o% t |   i }  |  i  \ } } n Xt | t  } | d g } | d g }	 | d j	 o t |  } n y* t	 |  }
 |
 | j o t d  n Wn  t
 j
 o | | g } n X| d j o@ t t |  i d  t   } t t |  i d  t   } nH t |  } t |  } x, t |  D] } | | \ | | <| | <qRWxW t t	 |   D]C } | | | | j o( | | d | | <| | d | | <qqWx t |  D] } t | |  o< | | d | | <t | | | | | | d  | | <n0 t | | t  | | <t	 | |  d | | <t | |  |	 | <qWt |  } h  } x; t |  D]- } t |  d d  | f | |  | | <qWt | t  } x t |  D]{ } t t |	 | i     d } t t |  d d  | f |  t | | d |  j  d } | | | c d 8<qWt | i   t  } | i   } g  } t | t  } xC t d | d  D]. } | | | | | | | d i   7} qW| | | d 7} t	 |  d j o t | d t  | f St | |  } t t	 |   } | | | <| i t |   } xV t | i  D]E } | i   | } | i | |  } | | | | | | <| | <qiW| t  d d  g } | | } | oi | i!   } xL t |  D]> } t" | t  } | | d | | <| |	 | i |  } qW| | :} n | i  | d j i#   o t$ d	   n | | f S(
   s  
    Compute the multidimensional histogram of some data.

    Parameters
    ----------
    sample : array_like
        Data to histogram passed as a sequence of D arrays of length N, or
        as an (N,D) array.
    bins : sequence or int, optional
        The bin specification:

        * A sequence of arrays describing the bin edges along each dimension.
        * The number of bins for each dimension (nx, ny, ... =bins)
        * The number of bins for all dimensions (nx=ny=...=bins).

    range : sequence, optional
        A sequence of lower and upper bin edges to be used if the edges are
        not given explicitely in `bins`. Defaults to the minimum and maximum
        values along each dimension.
    normed : boolean, optional
        If False, returns the number of samples in each bin. If True, returns
        the bin density, ie, the bin count divided by the bin hypervolume.
    weights : array_like (N,), optional
        An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`.
        Weights are normalized to 1 if normed is True. If normed is False, the
        values of the returned histogram are equal to the sum of the weights
        belonging to the samples falling into each bin.

    Returns
    -------
    H : ndarray
        The multidimensional histogram of sample x. See normed and weights for
        the different possible semantics.
    edges : list
        A list of D arrays describing the bin edges for each dimension.

    See Also
    --------
    histogram: 1D histogram
    histogram2d: 2D histogram

    Examples
    --------
    >>> r = np.random.randn(100,3)
    >>> H, edges = np.histogramdd(r, bins = (5, 8, 4))
    >>> H.shape, edges[0].size, edges[1].size, edges[2].size
    ((5,8,4), 6, 9, 5)

    sE   The dimension of bins must be equal to the dimension of the sample x.i    g      ?i   i   Ni   is   Internal Shape Error(%   R{   Ro   Rr   RV   t   TR6   RZ   Rn   R4   Rx   t	   TypeErrorRU   R3   Rp   R[   Rq   R0   R1   R@   R   R   R   RM   R<   R9   t   prodR}   R   t   reshapeRQ   Rw   t   swapaxest   sliceR   R/   Rt   t   RuntimeError(   t   sampleR   R   R   R   t   Nt   Dt   nbint   edgest   dedgest   Mt   smint   smaxR   t   Ncountt   outlierst   decimalt   on_edget   histt   niR{   t   xyt	   flatcountR   t   jt   coret   s(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    3"   * + !- ,
 !
 c         C   s  t  |  t i  p t i |   }  n | d j o/ |  i |  } | i i |  i | i  } n|  d }  t i	 | d |  i d d } |  i
 | i
 j o | d j o t d  n | i d j o t d  n | i
 d |  i
 | j o t d  n t i	 | d d d	 |  i i d
 |  } n | i d |  } | d j i   o t d  n t i |  |  i |  | } | o! t i | d  | } | | f S| Sd S(   s  
    Return the weighted average of array over the specified axis.

    Parameters
    ----------
    a : array_like
        Data to be averaged.
    axis : int, optional
        Axis along which to average `a`. If `None`, averaging is done over the
        entire array irrespective of its shape.
    weights : array_like, optional
        The importance that each datum has in the computation of the average.
        The weights array can either be 1-D (in which case its length must be
        the size of `a` along the given axis) or of the same shape as `a`.
        If `weights=None`, then all data in `a` are assumed to have a
        weight equal to one.
    returned : bool, optional
        Default is `False`. If `True`, the tuple (`average`, `sum_of_weights`)
        is returned, otherwise only the average is returned.  Note that
        if `weights=None`, `sum_of_weights` is equivalent to the number of
        elements over which the average is taken.

    Returns
    -------
    average, [sum_of_weights] : {array_type, double}
        Return the average along the specified axis. When returned is `True`,
        return a tuple with the average as the first element and the sum
        of the weights as the second element. The return type is `Float`
        if `a` is of integer type, otherwise it is of the same type as `a`.
        `sum_of_weights` is of the same type as `average`.

    Raises
    ------
    ZeroDivisionError
        When all weights along axis are zero. See `numpy.ma.average` for a
        version robust to this type of error.
    TypeError
        When the length of 1D `weights` is not the same as the shape of `a`
        along axis.

    See Also
    --------
    ma.average : average for masked arrays

    Examples
    --------
    >>> data = range(1,5)
    >>> data
    [1, 2, 3, 4]
    >>> np.average(data)
    2.5
    >>> np.average(range(1,11), weights=range(10,0,-1))
    4.0

    g        Ri   R   i    s;   Axis must be specified when shapes of a and weights differ.i   s8   1D weights expected when shapes of a and weights differ.s5   Length of weights not compatible with specified axis.t   ndminit   axiss(   Weights sum to zero, can't be normalizedN(   t
   isinstanceRs   t   matrixR4   Rn   RR   Ri   t   typeRw   R3   R{   R   t   ndimRr   R   R   Rt   t   ZeroDivisionErrorRB   (   R   R   R   t   returnedt   avgt   sclt   wgt(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   (  s.    8 
.c         C   s`   t  |   }  |  i i t d j o9 t i |   i   p t i |   i   o t d  n |  S(   s7  
    Convert the input to an array, checking for NaNs or Infs.

    Parameters
    ----------
    a : array_like
        Input data, in any form that can be converted to an array.  This
        includes lists, lists of tuples, tuples, tuples of tuples, tuples
        of lists and ndarrays.  Success requires no NaNs or Infs.
    dtype : data-type, optional
        By default, the data-type is inferred from the input data.
    order : {'C', 'F'}, optional
        Whether to use row-major ('C') or column-major ('FORTRAN') memory
        representation.  Defaults to 'C'.

    Returns
    -------
    out : ndarray
        Array interpretation of `a`.  No copy is performed if the input
        is already an ndarray.  If `a` is a subclass of ndarray, a base
        class ndarray is returned.

    Raises
    ------
    ValueError
        Raises ValueError if `a` contains NaN (Not a Number) or Inf (Infinity).

    See Also
    --------
    asarray : Create and array.
    asanyarray : Similar function which passes through subclasses.
    ascontiguousarray : Convert input to a contiguous array.
    asfarray : Convert input to a floating point ndarray.
    asfortranarray : Convert input to an ndarray with column-major
                     memory order.
    fromiter : Create an array from an iterator.
    fromfunction : Construct an array by executing a function on grid
                   positions.

    Examples
    --------
    Convert a list into an array.  If all elements are finite
    ``asarray_chkfinite`` is identical to ``asarray``.

    >>> a = [1, 2]
    >>> np.asarray_chkfinite(a)
    array([1, 2])

    Raises ValueError if array_like contains Nans or Infs.

    >>> a = [1, 2, np.inf]
    >>> try:
    ...     np.asarray_chkfinite(a)
    ... except ValueError:
    ...     print 'ValueError'
    ...
    ValueError

    t   AllFloats#   array must not contain infs or NaNs(	   R4   Ri   t   charRS   R\   RF   Rt   t   isinfRr   (   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s
    <,c         O   sC  t  |   }  t |  } t |  p) t | d t  p t | d t  o | g } n g  } | D] } | t | d t qf ~ } t |  } | | d j oN | d }	 x% t d |  D] }
 |	 | |
 O}	 q W| i	 |	  | d 7} n | | j o t
 d  n t } |  i d j ot |  d }  t } g  } xQ t |  D]C }
 | |
 i d j o | |
 d } n | |
 } | i	 |  qFW| } n t |  i |  i  } xy t |  D]k }
 | |
 } t |  p | | | |
 <q|  | |
 } | i d j o | | | |  | | |
 <qqW| o | i   } n | S(   sM  
    Evaluate a piecewise-defined function.

    Given a set of conditions and corresponding functions, evaluate each
    function on the input data wherever its condition is true.

    Parameters
    ----------
    x : (N,) ndarray
        The input domain.
    condlist : list of M (N,)-shaped boolean arrays
        Each boolean array corresponds to a function in `funclist`.  Wherever
        `condlist[i]` is True, `funclist[i](x)` is used as the output value.

        Each boolean array in `condlist` selects a piece of `x`,
        and should therefore be of the same shape as `x`.

        The length of `condlist` must correspond to that of `funclist`.
        If one extra function is given, i.e. if the length of `funclist` is
        M+1, then that extra function is the default value, used wherever
        all conditions are false.
    funclist : list of M or M+1 callables, f(x,*args,**kw), or values
        Each function is evaluated over `x` wherever its corresponding
        condition is True.  It should take an array as input and give an array
        or a scalar value as output.  If, instead of a callable,
        a value is provided then a constant function (``lambda x: value``) is
        assumed.
    args : tuple, optional
        Any further arguments given to `piecewise` are passed to the functions
        upon execution, i.e., if called ``piecewise(...,...,1,'a')``, then
        each function is called as ``f(x,1,'a')``.
    kw : dictionary, optional
        Keyword arguments used in calling `piecewise` are passed to the
        functions upon execution, i.e., if called
        ``piecewise(...,...,lambda=1)``, then each function is called as
        ``f(x,lambda=1)``.

    Returns
    -------
    out : ndarray
        The output is the same shape and type as x and is found by
        calling the functions in `funclist` on the appropriate portions of `x`,
        as defined by the boolean arrays in `condlist`.  Portions not covered
        by any condition have undefined values.

    Notes
    -----
    This is similar to choose or select, except that functions are
    evaluated on elements of `x` that satisfy the corresponding condition from
    `condlist`.

    The result is::

            |--
            |funclist[0](x[condlist[0]])
      out = |funclist[1](x[condlist[1]])
            |...
            |funclist[n2](x[condlist[n2]])
            |--

    Examples
    --------
    Define the sigma function, which is -1 for ``x < 0`` and +1 for ``x >= 0``.

    >>> x = np.arange(6) - 2.5 # x runs from -2.5 to 2.5 in steps of 1
    >>> np.piecewise(x, [x < 0, x >= 0.5], [-1,1])
    array([-1., -1., -1.,  1.,  1.,  1.])

    Define the absolute value, which is ``-x`` for ``x <0`` and ``x`` for
    ``x >= 0``.

    >>> np.piecewise(x, [x < 0, x >= 0], [lambda x: -x, lambda x: x])
    array([ 2.5,  1.5,  0.5,  0.5,  1.5,  2.5])

    i    Ri   i   s1   function list and condition list must be the sameN(   R5   Rx   R@   R   t   listR8   R4   t   boolR   R-   Rr   Rj   R   Rn   Ry   R0   R{   Ri   t   callableRw   t   squeeze(   t   xt   condlistt   funclistt   argst   kwt   n2R   t   cR   t   totlistt   kt   zerodt   newcondlistt	   conditionRc   t   itemt   vals(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     sR    L-
 
 

 
"i    c      	   C   s  t  |   } t  |  } | | j o t d  n | g | } d } d } xh t d | d  D]S } | | | t |  | d  7} | | j  o  | d t |  | d  9} q_ q_ Wt |  t j p t t |  i  d j o t d  } x, t | d  D] } | t | |  } qWt |  t j o& | t t |  i t |   } q|| t t |  i | i	  } n t
 | t |   S(   s  
    Return an array drawn from elements in choicelist, depending on conditions.

    Parameters
    ----------
    condlist : list of N boolean arrays of length M
            The conditions C_0 through C_(N-1) which determine
            from which vector the output elements are taken.
    choicelist : list of N arrays of length M
            Th vectors V_0 through V_(N-1), from which the output
            elements are chosen.

    Returns
    -------
    output : 1-dimensional array of length M
            The output at position m is the m-th element of the first
            vector V_n for which C_n[m] is non-zero.  Note that the
            output depends on the order of conditions, since the
            first satisfied condition is used.

    Notes
    -----
    Equivalent to:
    ::

                output = []
                for m in range(M):
                    output += [V[m] for V,C in zip(values,cond) if C[m]]
                              or [default]

    Examples
    --------
    >>> t = np.arange(10)
    >>> s = np.arange(10)*100
    >>> condlist = [t == 4, t > 5]
    >>> choicelist = [s, t]
    >>> np.select(condlist, choicelist)
    array([  0,   0,   0,   0, 400,   0,   6,   7,   8,   9])

    s7   list of cases must be same length as list of conditionsi    i   (   Rx   Rr   R   R4   R   R:   Rq   R{   R/   Ri   RP   t   tuple(   R   t
   choicelistt   defaultR   R   t   St   pfacR   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   >  s*    )  $/ &#c         C   s   t  |  d t S(   s:  
    Return an array copy of the given object.

    Parameters
    ----------
    a : array_like
        Input data.

    Returns
    -------
    arr : ndarray
        Array interpretation of `a`.

    Notes
    -----
    This is equivalent to

    >>> np.array(a, copy=True)

    Examples
    --------
    Create an array x, with a reference y and a copy z:

    >>> x = np.array([1, 2, 3])
    >>> y = x
    >>> z = np.copy(x)

    Note that, when we modify x, y changes, but not z:

    >>> x[0] = 10
    >>> x[0] == y[0]
    True
    >>> x[0] == z[0]
    False

    R   (   R3   Ry   (   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   ~  s    %c         G   s0  t  |  i  } t  |  } | d j o d g | } nI | d j o | d g | } n' | | j o t |  } n
 t d  g  } t d  g | } t d  g | } t d  g | } |  i i }	 |	 d j o
 d }	 n x,t |  D]}
 t	 |  i |  i i  } t d d	  | |
 <t d
 d  | |
 <t d d  | |
 <|  | |  | d | | <d | |
 <d | |
 <d | |
 <|  | |  | | | <d	 | |
 <d	 | |
 <d | |
 <|  | |  | | | <| i
 | | |
  t d  | |
 <t d  | |
 <t d  | |
 <q W| d j o	 | d S| Sd S(   sQ  
    Return the gradient of an N-dimensional array.

    The gradient is computed using central differences in the interior
    and first differences at the boundaries. The returned gradient hence has
    the same shape as the input array.

    Parameters
    ----------
    f : array_like
      An N-dimensional array containing samples of a scalar function.
    `*varargs` : scalars
      0, 1, or N scalars specifying the sample distances in each direction,
      that is: `dx`, `dy`, `dz`, ... The default distance is 1.


    Returns
    -------
    g : ndarray
      N arrays of the same shape as `f` giving the derivative of `f` with
      respect to each dimension.

    Examples
    --------
    >>> np.gradient(np.array([[1,1],[3,4]]))
    [array([[ 2.,  3.],
           [ 2.,  3.]]),
     array([[ 0.,  0.],
           [ 1.,  1.]])]

    i    g      ?i   s   invalid number of argumentst   ft   dt   FR   ii   ig       @N(   R   R   R   R   (   Rx   R{   R   t   SyntaxErrorR   Rn   Ri   R   R   R0   R-   (   R   t   varargsR   R   t   dxt   outvalst   slice1t   slice2t   slice3t   otypeR   t   out(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     sL     	
 





	i   c         C   s   | d j o |  S| d j  o t  d t |   n t |   }  t |  i  } t d  g | } t d  g | } t d d  | | <t d d  | | <t |  } t |  } | d j o$ t |  | |  | | d d | S|  | |  | Sd S(   s&  
    Calculate the nth order discrete difference along given axis.

    Parameters
    ----------
    a : array_like
        Input array
    n : int, optional
        The number of times values are differenced.
    axis : int, optional
        The axis along which the difference is taken.

    Returns
    -------
    out : ndarray
        The `n` order differences.  The shape of the output is the same as `a`
        except along `axis` where the dimension is `n` less.

    Examples
    --------
    >>> x = np.array([0,1,3,9,5,10])
    >>> np.diff(x)
    array([ 1,  2,  6, -4,  5])
    >>> np.diff(x,n=2)
    array([  1,   4, -10,   9])
    >>> x = np.array([[1,3,6,10],[0,5,6,8]])
    >>> np.diff(x)
    array([[2, 3, 4],
    [5, 1, 2]])
    >>> np.diff(x,axis=0)
    array([[-1,  2,  0, -2]])

    i    s#   order must be non-negative but got i   iR   N(	   Rr   t   reprR5   Rx   R{   R   Rn   R   R   (   R   R   R   t   ndR   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR      s    "$c         C   sS   t  |  t t t f  o  t |  g | | | |  i   St |  | | | |  Sd S(   s  
    One-dimensional linear interpolation.

    Returns the one-dimensional piecewise linear interpolant to a function
    with given values at discrete data-points.

    Parameters
    ----------
    x : array_like
        The x-coordinates of the interpolated values.

    xp : 1-D sequence of floats
        The x-coordinates of the data points, must be increasing.

    fp : 1-D sequence of floats
        The y-coordinates of the data points, same length as `xp`.

    left : float, optional
        Value to return for `x < xp[0]`, default is `fp[0]`.

    right : float, optional
        Value to return for `x > xp[-1]`, defaults is `fp[-1]`.

    Returns
    -------
    y : {float, ndarray}
        The interpolated values, same shape as `x`.

    Raises
    ------
    ValueError
        If `xp` and `fp` have different length

    Notes
    -----
    Does not check that the x-coordinate sequence `xp` is increasing.
    If `xp` is not increasing, the results are nonsense.
    A simple check for increasingness is::

        np.all(np.diff(xp) > 0)


    Examples
    --------
    >>> xp = [1, 2, 3]
    >>> fp = [3, 2, 0]
    >>> np.interp(2.5, xp, fp)
    1.0
    >>> np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp)
    array([ 3. ,  3. ,  2.5,  0.56,  0. ])
    >>> UNDEF = -99.0
    >>> np.interp(3.14, xp, fp, right=UNDEF)
    -99.0

    Plot an interpolant to the sine function:

    >>> x = np.linspace(0, 2*np.pi, 10)
    >>> y = np.sin(x)
    >>> xvals = np.linspace(0, 2*np.pi, 50)
    >>> yinterp = np.interp(xvals, x, y)
    >>> import matplotlib.pyplot as plt
    >>> plt.plot(x, y, 'o')
    >>> plt.plot(xvals, yinterp, '-x')
    >>> plt.show()

    N(   R   R[   RZ   RT   t   compiled_interpR   (   R   t   xpt   fpRg   Rh   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR.   3  s    C c         C   ss   | o d t  } n d } t |   }  t |  i i t i  o |  i } |  i } n d } |  } t	 | |  | S(   s  
    Return the angle of the complex argument.

    Parameters
    ----------
    z : array_like
        A complex number or sequence of complex numbers.
    deg : bool, optional
        Return angle in degrees if True, radians if False (default).

    Returns
    -------
    angle : {ndarray, scalar}
        The counterclockwise angle from the positive real axis on
        the complex plane, with dtype as numpy.float64.

    See Also
    --------
    arctan2

    Examples
    --------
    >>> np.angle([1.0, 1.0j, 1+1j])               # in radians
    array([ 0.        ,  1.57079633,  0.78539816])
    >>> np.angle(1+1j, deg=True)                  # in degrees
    45.0

    i   g      ?i    (
   RA   R4   t
   issubclassRi   R   R\   t   complexfloatingt   imagt   realRD   (   t   zt   degt   factt   zimagt   zreal(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR	   |  s    	c   	      C   s   t  |   }  t |  i  } t |  d | } t d d  g | } t d d  | | <t | t d t  t } t i	 | | t j | d j @t  | | } t i	 | t
 |  | j  d  t |  d t d d } |  | | i |  | | <| S(	   s  
    Unwrap by changing deltas between values to 2*pi complement.

    Unwrap radian phase `p` by changing absolute jumps greater than
    `discont` to their 2*pi complement along the given axis.

    Parameters
    ----------
    p : array_like
        Input array.
    discont : float
        Maximum discontinuity between values.
    axis : integer
        Axis along which unwrap will operate.

    Returns
    -------
    out : ndarray
        Output array

    R   i   i   i    R   Ri   R   N(   R4   Rx   R{   R   R   Rn   RK   RA   R\   t   putmaskt   absR3   Ry   R~   (	   t   pt   discontR   R   t   ddR   t   ddmodt
   ph_correctt   up(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR
     s    $
c         C   s   t  |  d t } | i   t | i i t i  pS | i i d j o | i	 d  S| i i d j o | i	 d  S| i	 d  Sn | Sd S(   s  
    Sort a complex array using the real part first, then the imaginary part.

    Parameters
    ----------
    a : array_like
        Input array

    Returns
    -------
    out : complex ndarray
        Always returns a sorted complex array.

    Examples
    --------
    >>> np.sort_complex([5, 3, 6, 2, 1])
    array([ 1.+0.j,  2.+0.j,  3.+0.j,  5.+0.j,  6.+0.j])

    >>> np.sort_complex([1 + 2j, 2 - 1j, 3 - 2j, 3 - 3j, 3 + 5j])
    array([ 1.+2.j,  2.-1.j,  3.-5.j,  3.-3.j,  3.+2.j])

    R   t   bhBHR   t   gt   GR   N(
   R3   Ry   RQ   R   Ri   R   R\   R   R   t   astype(   R   t   b(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    
t   fbc         C   s   d } | i    } d | j o1 x. |  D]" } | d j o Pq& | d } q& Wn t |   } d | j o> x; |  d d d  D]" } | d j o Pq} | d } q} Wn |  | | !S(   s3  
    Trim the leading and/or trailing zeros from a 1-D array or sequence.

    Parameters
    ----------
    filt : 1-D array or sequence
        Input array.
    trim : str, optional
        A string with 'f' representing trim from front and 'b' to trim from
        back. Default is 'fb', trim zeros from both front and back of the
        array.

    Returns
    -------
    trimmed : 1-D array or sequence
        The result of trimming the input. The input data type is preserved.

    Examples
    --------
    >>> a = np.array((0, 0, 0, 1, 2, 3, 0, 2, 1, 0))
    >>> np.trim_zeros(a)
    array([1, 2, 3, 0, 2, 1])

    >>> np.trim_zeros(a, 'b')
    array([0, 0, 0, 1, 2, 3, 0, 2, 1])

    The input data type is preserved, list/tuple in means list/tuple out.

    >>> np.trim_zeros([0, 1, 2, 0])
    [1, 2]

    i    R   g        i   t   BNi(   t   upperRx   (   t   filtt   trimt   firstR   t   last(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s     !    i  (   t   Setc      	   C   s   yZ |  i    } | i d j o | S| i   t t g | d | d  j f  } | | SWn6 t j
 o* t t |    } | i   t |  SXd S(   s  
    Return the sorted, unique elements of an array or sequence.

    Parameters
    ----------
    x : ndarray or sequence
        Input array.

    Returns
    -------
    y : ndarray
        The sorted, unique elements are returned in a 1-D array.

    Examples
    --------
    >>> np.unique([1, 1, 2, 2, 3, 3])
    array([1, 2, 3])
    >>> a = np.array([[1, 1], [2, 3]])
    >>> np.unique(a)
    array([1, 2, 3])

    >>> np.unique([True, True, False])
    array([False,  True], dtype=bool)

    i    i   iN(	   t   flattenRw   RQ   R2   Ry   Ro   R   t   setR4   (   R   t   tmpt   idxt   items(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    
#
c         C   s&   t  i t |  t t |    d  S(   s	  
    Return the elements of an array that satisfy some condition.

    This is equivalent to ``np.compress(ravel(condition), ravel(arr))``.  If
    `condition` is boolean ``np.extract`` is equivalent to ``arr[condition]``.

    Parameters
    ----------
    condition : array_like
        An array whose nonzero or True entries indicate the elements of `arr`
        to extract.
    arr : array_like
        Input array of the same size as `condition`.

    See Also
    --------
    take, put, putmask

    Examples
    --------
    >>> arr = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])
    >>> arr
    array([[ 1,  2,  3,  4],
           [ 5,  6,  7,  8],
           [ 9, 10, 11, 12]])
    >>> condition = np.mod(arr, 3)==0
    >>> condition
    array([[False, False,  True, False],
           [False,  True, False, False],
           [ True, False, False,  True]], dtype=bool)
    >>> np.extract(condition, arr)
    array([ 3,  6,  9, 12])

    If `condition` is boolean:

    >>> arr[condition]
    array([ 3,  6,  9, 12])

    i    (   R\   t   takeRN   RO   (   R   t   arr(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   D  s    (c         C   s   t  |  | |  S(   sS  
    Changes elements of an array based on conditional and input values.

    Similar to ``putmask(a, mask, vals)`` but the 1D array `vals` has the
    same number of elements as the non-zero values of `mask`. Inverse of
    ``extract``.

    Sets `a`.flat[n] = `values`\[n] for each n where `mask`.flat[n] is true.

    Parameters
    ----------
    a : array_like
        Array to put data into.
    mask : array_like
        Boolean mask array.
    values : array_like, shape(number of non-zero `mask`, )
        Values to put into `a`.

    See Also
    --------
    putmask, put, take

    (   RX   (   R  t   maskR   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   n  s    c         C   sj   t  | d t } t |  } | i   o t i St | i i t i	  p | | | <n |  | d | S(   s  
    General operation on arrays with not-a-number values.

    Parameters
    ----------
    op : callable
        Operation to perform.
    fill : float
        NaN values are set to fill before doing the operation.
    a : array-like
        Input array.
    axis : {int, None}, optional
        Axis along which the operation is computed.
        By default the input is flattened.

    Returns
    -------
    y : {ndarray, scalar}
        Processed data.

    t   subokR   (
   R3   Ry   RF   t   allRs   t   nanR   Ri   R   R?   (   t   opt   fillR   R   Rc   R  (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   _nanop  s    c         C   s   t  t i d |  |  S(   s  
    Return the sum of array elements over a given axis treating
    Not a Numbers (NaNs) as zero.

    Parameters
    ----------
    a : array_like
        Array containing numbers whose sum is desired. If `a` is not an
        array, a conversion is attempted.
    axis : int, optional
        Axis along which the sum is computed. The default is to compute
        the sum of the flattened array.

    Returns
    -------
    y : ndarray
        An array with the same shape as a, with the specified axis removed.
        If a is a 0-d array, or if axis is None, a scalar is returned with
        the same dtype as `a`.

    See Also
    --------
    numpy.sum : Sum across array including Not a Numbers.
    isnan : Shows which elements are Not a Number (NaN).
    isfinite: Shows which elements are not: Not a Number, positive and
             negative infinity

    Notes
    -----
    Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic
    (IEEE 754). This means that Not a Number is not equivalent to infinity.
    If positive or negative infinity are present the result is positive or
    negative infinity. But if both positive and negative infinity are present,
    the result is Not A Number (NaN).

    Arithmetic is modular when using integer types (all elements of `a` must
    be finite i.e. no elements that are NaNs, positive infinity and negative
    infinity because NaNs are floating point types), and no error is raised
    on overflow.


    Examples
    --------
    >>> np.nansum(1)
    1
    >>> np.nansum([1])
    1
    >>> np.nansum([1, np.nan])
    1.0
    >>> a = np.array([[1, 1], [1, np.nan]])
    >>> np.nansum(a)
    3.0
    >>> np.nansum(a, axis=0)
    array([ 2.,  1.])

    When positive infinity and negative infinity are present

    >>> np.nansum([1, np.nan, np.inf])
    inf
    >>> np.nansum([1, np.nan, np.NINF])
    -inf
    >>> np.nansum([1, np.nan, np.inf, np.NINF])
    nan

    i    (   R  Rs   R   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    Bc         C   s   t  t i t i |  |  S(   s  
    Return the minimum of array elements over the given axis ignoring any NaNs.

    Parameters
    ----------
    a : array_like
        Array containing numbers whose sum is desired. If `a` is not
        an array, a conversion is attempted.
    axis : int, optional
        Axis along which the minimum is computed.The default is to compute
        the minimum of the flattened array.

    Returns
    -------
    y : {ndarray, scalar}
        An array with the same shape as `a`, with the specified axis removed.
        If `a` is a 0-d array, or if axis is None, a scalar is returned. The
        the same dtype as `a` is returned.


    See Also
    --------
    numpy.amin : Minimum across array including any Not a Numbers.
    numpy.nanmax : Maximum across array ignoring any Not a Numbers.
    isnan : Shows which elements are Not a Number (NaN).
    isfinite: Shows which elements are not: Not a Number, positive and
             negative infinity

    Notes
    -----
    Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic
    (IEEE 754). This means that Not a Number is not equivalent to infinity.
    Positive infinity is treated as a very large number and negative infinity
    is treated as a very small (i.e. negative) number.

    If the input has a integer type, an integer type is returned unless
    the input contains NaNs and infinity.


    Examples
    --------
    >>> a = np.array([[1, 2], [3, np.nan]])
    >>> np.nanmin(a)
    1.0
    >>> np.nanmin(a, axis=0)
    array([ 1.,  2.])
    >>> np.nanmin(a, axis=1)
    array([ 1.,  3.])

    When positive infinity and negative infinity are present:

    >>> np.nanmin([1, 2, np.nan, np.inf])
    1.0
    >>> np.nanmin([1, 2, np.nan, np.NINF])
    -inf

    (   R  Rs   Rp   t   inf(   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    :c         C   s   t  t i t i |  |  S(   s   
    Return indices of the minimum values along an axis, ignoring NaNs.


    See Also
    --------
    nanargmax : corresponding function for maxima; see for details.

    (   R  Rs   t   argminR  (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   (  s    
c         C   s   t  t i t i |  |  S(   s  
    Return the maximum of array elements over the given axis ignoring any NaNs.

    Parameters
    ----------
    a : array_like
        Array containing numbers whose maximum is desired. If `a` is not
        an array, a conversion is attempted.
    axis : int, optional
        Axis along which the maximum is computed.The default is to compute
        the maximum of the flattened array.

    Returns
    -------
    y : ndarray
        An array with the same shape as `a`, with the specified axis removed.
        If `a` is a 0-d array, or if axis is None, a scalar is returned. The
        the same dtype as `a` is returned.

    See Also
    --------
    numpy.amax : Maximum across array including any Not a Numbers.
    numpy.nanmin : Minimum across array ignoring any Not a Numbers.
    isnan : Shows which elements are Not a Number (NaN).
    isfinite: Shows which elements are not: Not a Number, positive and
             negative infinity

    Notes
    -----
    Numpy uses the IEEE Standard for Binary Floating-Point for Arithmetic
    (IEEE 754). This means that Not a Number is not equivalent to infinity.
    Positive infinity is treated as a very large number and negative infinity
    is treated as a very small (i.e. negative) number.

    If the input has a integer type, an integer type is returned unless
    the input contains NaNs and infinity.

    Examples
    --------
    >>> a = np.array([[1, 2], [3, np.nan]])
    >>> np.nanmax(a)
    3.0
    >>> np.nanmax(a, axis=0)
    array([ 3.,  2.])
    >>> np.nanmax(a, axis=1)
    array([ 2.,  3.])

    When positive infinity and negative infinity are present:

    >>> np.nanmax([1, 2, np.nan, np.NINF])
    2.0
    >>> np.nanmax([1, 2, np.nan, np.inf])
    inf

    (   R  Rs   Rq   R  (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   4  s    8c         C   s   t  t i t i |  |  S(   sr  
    Return indices of the maximum values over an axis, ignoring NaNs.

    Parameters
    ----------
    a : array_like
        Input data.
    axis : int, optional
        Axis along which to operate.  By default flattened input is used.

    Returns
    -------
    index_array : ndarray
        An array of indices or a single index value.

    See Also
    --------
    argmax, nanargmin

    Examples
    --------
    >>> a = np.array([[np.nan, 4], [2, 3]])
    >>> np.argmax(a)
    0
    >>> np.nanargmax(a)
    1
    >>> np.nanargmax(a, axis=0)
    array([1, 1])
    >>> np.nanargmax(a, axis=1)
    array([1, 0])

    (   R  Rs   t   argmaxR  (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   n  s    !c         C   sa   | d j o d d k } | i } n | o | i d |   n | i d |   | i   d S(   s{  
    Display a message on a device

    Parameters
    ----------
    mesg : string
        Message to display.
    device : device object with 'write' method
        Device to write message.  If None, defaults to ``sys.stdout`` which is
        very similar to ``print``.
    linefeed : bool, optional
        Option whether to print a line feed or not.  Defaults to True.

    iNs   %s
s   %s(   Rn   t   syst   stdoutt   writet   flush(   t   mesgt   devicet   linefeedR  (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    
c         C   sJ  t  |   p t d  n t |  d  og |  i } | i } |  i d  j	 o t |  i  } n d } t |  t	 i
  o | d 8} n | | f St i d  } y |    d	 SWn t j
 o{ } | i t |   } | oV t | i d   } t | i d   } t |  t	 i
  o | d 8} n | | f Sn Xt d |   d  S(
   Ns   Object is not callable.t	   func_codei    i   sG   .*? takes exactly (?P<exargs>\d+) argument(s|) \((?P<gargs>\d+) given\)t   exargst   gargss2   failed to determine the number of arguments for %s(   i    i    (   R   R   t   hasattrR  t   co_argcountt   func_defaultsRn   Rx   R   t   typest
   MethodTypet   ret   compilet   matcht   strRZ   t   groupRr   (   t   objt   fcodet   nargst	   ndefaultst   terrt   msgt   m(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt
   _get_nargs  s0    		c           B   s&   e  Z d  Z d d d  Z d   Z RS(   s  
    vectorize(pyfunc, otypes='', doc=None)

    Generalized function class.

    Define a vectorized function which takes a nested sequence
    of objects or numpy arrays as inputs and returns a
    numpy array as output. The vectorized function evaluates `pyfunc` over
    successive tuples of the input arrays like the python map function,
    except it uses the broadcasting rules of numpy.

    The data type of the output of `vectorized` is determined by calling
    the function with the first element of the input.  This can be avoided
    by specifying the `otypes` argument.

    Parameters
    ----------
    pyfunc : callable
        A python function or method.
    otypes : str or list of dtypes, optional
        The output data type. It must be specified as either a string of
        typecode characters or a list of data type specifiers. There should
        be one data type specifier for each output.
    doc : str, optional
        The docstring for the function. If None, the docstring will be the
        `pyfunc` one.

    Examples
    --------
    >>> def myfunc(a, b):
    ...     """Return a-b if a>b, otherwise return a+b"""
    ...     if a > b:
    ...         return a - b
    ...     else:
    ...         return a + b

    >>> vfunc = np.vectorize(myfunc)
    >>> vfunc([1, 2, 3, 4], 2)
    array([3, 4, 1, 2])

    The docstring is taken from the input function to `vectorize` unless it
    is specified

    >>> vfunc.__doc__
    'Return a-b if a>b, otherwise return a+b'
    >>> vfunc = np.vectorize(myfunc, doc='Vectorized `myfunc`')
    >>> vfunc.__doc__
    'Vectorized `myfunc`'

    The output type is determined by evaluating the first element of the input,
    unless it is specified

    >>> out = vfunc([1, 2, 3, 4], 2)
    >>> type(out[0])
    <type 'numpy.int32'>
    >>> vfunc = np.vectorize(myfunc, otypes=[np.float])
    >>> out = vfunc([1, 2, 3, 4], 2)
    >>> type(out[0])
    <type 'numpy.float64'>

    t    c   	      C   sH  | |  _  d  |  _ t |  \ } } | d j o# | d j o d  |  _ d  |  _ n | |  _ | | |  _ d  |  _ | d  j o | i |  _ n
 | |  _ t | t	  o? | |  _
 x |  i
 D]$ } | t d j o t d  q q WnT t |  o= d i g  } | D] } | t i |  i q~  |  _
 n
 t d  d |  _ d  S(   Ni    t   Alls   invalid otype specifiedR4  sL   output types must be a string of typecode characters or a list of data-types(   t   thefuncRn   t   ufuncR3  t   nint   nin_wo_defaultst   noutt   __doc__R   R*  t   otypesRS   Rr   R   t   joinR\   Ri   R   t   lastcallargs(	   t   selft   pyfuncR<  t   docR8  t   ndefaultR   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   __init__  s,    							
 =	c         G   sz  t  |  } |  i o1 | |  i j p | |  i j  o t d  qG n |  i | j o | |  _ d  |  _ d  |  _ n |  i d  j p |  i d j o g  } x( | D]  } | i	 t
 |  i d  q W|  i |   } t | t  o t  |  |  _ n d |  _ | f } |  i d j oS g  } x4 t |  i  D]# } | i	 t
 | |  i i  q1Wd i |  |  _ qrn |  i d  j o t |  i | |  i  |  _ n g  } | D]% } | t | d t d t d t q~ } |  i d j o2 t |  i |   d t d t d |  i d }	 n[ t g  }
 t |  i |   |  i  D]+ \ } } |
 t | d t d t d | q?~
  }	 |	 S(   Ns>   mismatch between python function inputs and received argumentsR4  i    i   R   R  Ri   (   Rx   R8  R9  Rr   R>  Rn   R7  R:  R<  R-   R4   t   flatR6  R   R   R   Ri   R   R=  RE   R3   Rj   Ry   t   objectt   zip(   R?  R   R.  t   newargst   argt   theoutR<  R   R   t   _resR   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   __call__!  sB    
 		  		 !9
PN(   t   __name__t
   __module__R;  Rn   RC  RK  (    (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s   =c   	      C   sc  t  |  d d d t } | i d d j o
 d } n | o d } t d	  t f } n d } t t d	  f } | d	 j	 o7 t  | d t d d d t } t | | f |  } n | | i d d |  | 8} | o | i d } n | i d } | o | d } n | d } | p! t	 | i
 | i    | i   St	 | | i
 i    | i   Sd	 S(
   s	  
    Estimate a covariance matrix, given data.

    Covariance indicates the level to which two variables vary together.
    If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`,
    then the covariance matrix element :math:`C_{ij}` is the covariance of
    :math:`x_i` and :math:`x_j`. The element :math:`C_{ii}` is the variance
    of :math:`x_i`.

    Parameters
    ----------
    m : array_like
        A 1-D or 2-D array containing multiple variables and observations.
        Each row of `m` represents a variable, and each column a single
        observation of all those variables. Also see `rowvar` below.
    y : array_like, optional
        An additional set of variables and observations. `y` has the same
        form as that of `m`.
    rowvar : int, optional
        If `rowvar` is non-zero (default), then each row represents a
        variable, with observations in the columns. Otherwise, the relationship
        is transposed: each column represents a variable, while the rows
        contain observations.
    bias : int, optional
        Default normalization is by ``(N-1)``, where ``N`` is the number of
        observations given (unbiased estimate). If `bias` is 1, then
        normalization is by ``N``.

    Returns
    -------
    out : ndarray
        The covariance matrix of the variables.

    See Also
    --------
    corrcoef : Normalized covariance matrix

    Examples
    --------
    Consider two variables, :math:`x_0` and :math:`x_1`, which
    correlate perfectly, but in opposite directions:

    >>> x = np.array([[0, 2], [1, 1], [2, 0]]).T
    >>> x
    array([[0, 1, 2],
           [2, 1, 0]])

    Note how :math:`x_0` increases while :math:`x_1` decreases. The covariance
    matrix shows this clearly:

    >>> np.cov(x)
    array([[ 1., -1.],
           [-1.,  1.]])

    Note that element :math:`C_{0,1}`, which shows the correlation between
    :math:`x_0` and :math:`x_1`, is negative.

    Further, note how `x` and `y` are combined:

    >>> x = [-2.1, -1,  4.3]
    >>> y = [3,  1.1,  0.12]
    >>> X = np.vstack((x,y))
    >>> print np.cov(X)
    [[ 11.71        -4.286     ]
     [ -4.286        2.14413333]]
    >>> print np.cov(x, y)
    [[ 11.71        -4.286     ]
     [ -4.286        2.14413333]]
    >>> print np.cov(x)
    11.71

    R   i   Ri   i    i   R   R   g      ?N(   R3   R[   R{   R   Rn   R=   Rj   R2   RR   R;   R   t   conjR   (	   R2  Rc   t   rowvart   biast   XR   t   tupR   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   N  s*    J

!c         C   sV   t  |  | | |  } y t |  } Wn t j
 o d SX| t t i | |   S(   s~  
    Return correlation coefficients.

    Please refer to the documentation for `cov` for more detail.  The
    relationship between the correlation coefficient matrix, P, and the
    covariance matrix, C, is

    .. math:: P_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }

    The values of P are between -1 and 1.

    See Also
    --------
    cov : Covariance matrix

    i   (   R   RW   Rr   RI   RB   t   outer(   R   Rc   RO  RP  R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR     s    c         C   s   |  d j  o t  g   S|  d j o t d t  St d |   } d d t d t | |  d  d t d t | |  d  S(   s
  
    Return the Blackman window.

    The Blackman window is a taper formed by using the the first
    three terms of a summation of cosines. It was designed to have close
    to the minimal leakage possible.
    It is close to optimal, only slightly worse than a Kaiser window.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an
        empty array is returned.

    Returns
    -------
    out : array
        The window, normalized to one (the value one
        appears only if the number of samples is odd).

    See Also
    --------
    bartlett, hamming, hanning, kaiser

    Notes
    -----
    The Blackman window is defined as

    .. math::  w(n) = 0.42 - 0.5 \cos(2\pi n/M) + 0.08 \cos(4\pi n/M)


    Most references to the Blackman window come from the signal processing
    literature, where it is used as one of many windowing functions for
    smoothing values.  It is also known as an apodization (which means
    "removing the foot", i.e. smoothing discontinuities at the beginning
    and end of the sampled signal) or tapering function. It is known as a
    "near optimal" tapering function, almost as good (by some measures)
    as the kaiser window.

    References
    ----------
    .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power
           spectra, Dover Publications, New York.
    .. [2] Wikipedia, "Window function",
           http://en.wikipedia.org/wiki/Window_function
    .. [3] Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing.
           Upper Saddle River, NJ: Prentice-Hall, 1999, pp. 468-471.

    Examples
    --------
    >>> from numpy import blackman
    >>> blackman(12)
    array([ -1.38777878e-17,   3.26064346e-02,   1.59903635e-01,
             4.14397981e-01,   7.36045180e-01,   9.67046769e-01,
             9.67046769e-01,   7.36045180e-01,   4.14397981e-01,
             1.59903635e-01,   3.26064346e-02,  -1.38777878e-17])


    Plot the window and the frequency response:

    >>> from numpy import clip, log10, array, bartlett
    >>> from scipy.fftpack import fft, fftshift
    >>> import matplotlib.pyplot as plt

    >>> window = blackman(51)
    >>> plt.plot(window)
    >>> plt.title("Blackman window")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("Sample")
    >>> plt.show()

    >>> A = fft(window, 2048) / 25.5
    >>> mag = abs(fftshift(A))
    >>> freq = linspace(-0.5,0.5,len(A))
    >>> response = 20*log10(mag)
    >>> response = clip(response,-100,100)
    >>> plt.plot(freq, response)
    >>> plt.title("Frequency response of Bartlett window")
    >>> plt.ylabel("Magnitude [dB]")
    >>> plt.xlabel("Normalized frequency [cycles per sample]")
    >>> plt.axis('tight'); plt.show()

    i   i    gzG?g      ?g       @g{Gz?g      @(   R3   R/   R[   R1   RG   RA   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR$     s    Tc         C   s   |  d j  o t  g   S|  d j o t d t  St d |   } t t | |  d d  d | |  d d d | |  d  S(   s:  
    Return the Bartlett window.

    The Bartlett window is very similar to a triangular window, except
    that the end points are at zero.  It is often used in signal
    processing for tapering a signal, without generating too much
    ripple in the frequency domain.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an
        empty array is returned.

    Returns
    -------
    out : array
        The triangular window, normalized to one (the value one
        appears only if the number of samples is odd), with the first
        and last samples equal to zero.

    See Also
    --------
    blackman, hamming, hanning, kaiser

    Notes
    -----
    The Bartlett window is defined as

    .. math:: w(n) = \frac{2}{M-1} \left(
              \frac{M-1}{2} - \left|n - \frac{M-1}{2}\right|
              \right)

    Most references to the Bartlett window come from the signal
    processing literature, where it is used as one of many windowing
    functions for smoothing values.  Note that convolution with this
    window produces linear interpolation.  It is also known as an
    apodization (which means"removing the foot", i.e. smoothing
    discontinuities at the beginning and end of the sampled signal) or
    tapering function. The fourier transform of the Bartlett is the product
    of two sinc functions.
    Note the excellent discussion in Kanasewich.

    References
    ----------
    .. [1] M.S. Bartlett, "Periodogram Analysis and Continuous Spectra",
           Biometrika 37, 1-16, 1950.
    .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics",
           The University of Alberta Press, 1975, pp. 109-110.
    .. [3] A.V. Oppenheim and R.W. Schafer, "Discrete-Time Signal
           Processing", Prentice-Hall, 1999, pp. 468-471.
    .. [4] Wikipedia, "Window function",
           http://en.wikipedia.org/wiki/Window_function
    .. [5] W.H. Press,  B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling,
           "Numerical Recipes", Cambridge University Press, 1986, page 429.


    Examples
    --------
    >>> np.bartlett(12)
    array([ 0.        ,  0.18181818,  0.36363636,  0.54545455,  0.72727273,
            0.90909091,  0.90909091,  0.72727273,  0.54545455,  0.36363636,
            0.18181818,  0.        ])

    Plot the window and its frequency response (requires SciPy and matplotlib):

    >>> from numpy import clip, log10, array, bartlett
    >>> from numpy.fft import fft
    >>> import matplotlib.pyplot as plt

    >>> window = bartlett(51)
    >>> plt.plot(window)
    >>> plt.title("Bartlett window")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("Sample")
    >>> plt.show()

    >>> A = fft(window, 2048) / 25.5
    >>> mag = abs(fftshift(A))
    >>> freq = linspace(-0.5,0.5,len(A))
    >>> response = 20*log10(mag)
    >>> response = clip(response,-100,100)
    >>> plt.plot(freq, response)
    >>> plt.title("Frequency response of Bartlett window")
    >>> plt.ylabel("Magnitude [dB]")
    >>> plt.xlabel("Normalized frequency [cycles per sample]")
    >>> plt.axis('tight'); plt.show()

    i   i    g       @(   R3   R/   R[   R1   R<   RH   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR#   *  s    Zc         C   sd   |  d j  o t  g   S|  d j o t d t  St d |   } d d t d t | |  d  S(   s
  
    Return the Hanning window.

    The Hanning window is a taper formed by using a weighted cosine.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an
        empty array is returned.

    Returns
    -------
    out : ndarray, shape(M,)
        The window, normalized to one (the value one
        appears only if `M` is odd).

    See Also
    --------
    bartlett, blackman, hamming, kaiser

    Notes
    -----
    The Hanning window is defined as

    .. math::  w(n) = 0.5 - 0.5cos\left(\frac{2\pi{n}}{M-1}\right)
               \qquad 0 \leq n \leq M-1

    The Hanning was named for Julius van Hann, an Austrian meterologist. It is
    also known as the Cosine Bell. Some authors prefer that it be called a
    Hann window, to help avoid confusion with the very similar Hamming window.

    Most references to the Hanning window come from the signal processing
    literature, where it is used as one of many windowing functions for
    smoothing values.  It is also known as an apodization (which means
    "removing the foot", i.e. smoothing discontinuities at the beginning
    and end of the sampled signal) or tapering function.

    References
    ----------
    .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power
           spectra, Dover Publications, New York.
    .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics",
           The University of Alberta Press, 1975, pp. 106-108.
    .. [3] Wikipedia, "Window function",
           http://en.wikipedia.org/wiki/Window_function
    .. [4] W.H. Press,  B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling,
           "Numerical Recipes", Cambridge University Press, 1986, page 425.

    Examples
    --------
    >>> from numpy import hanning
    >>> hanning(12)
    array([ 0.        ,  0.07937323,  0.29229249,  0.57115742,  0.82743037,
            0.97974649,  0.97974649,  0.82743037,  0.57115742,  0.29229249,
            0.07937323,  0.        ])

    Plot the window and its frequency response:

    >>> from numpy.fft import fft, fftshift
    >>> import matplotlib.pyplot as plt

    >>> window = np.hanning(51)
    >>> plt.subplot(121)
    >>> plt.plot(window)
    >>> plt.title("Hann window")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("Sample")

    >>> A = fft(window, 2048) / 25.5
    >>> mag = abs(fftshift(A))
    >>> freq = np.linspace(-0.5,0.5,len(A))
    >>> response = 20*np.log10(mag)
    >>> response = np.clip(response,-100,100)
    >>> plt.subplot(122)
    >>> plt.plot(freq, response)
    >>> plt.title("Frequency response of the Hann window")
    >>> plt.ylabel("Magnitude [dB]")
    >>> plt.xlabel("Normalized frequency [cycles per sample]")
    >>> plt.axis('tight'); plt.show()

    i   i    g      ?g       @(   R3   R/   R[   R1   RG   RA   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR"     s    Sc         C   sd   |  d j  o t  g   S|  d j o t d t  St d |   } d d t d t | |  d  S(   s
  
    Return the Hamming window.

    The Hamming window is a taper formed by using a weighted cosine.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an
        empty array is returned.

    Returns
    -------
    out : ndarray
        The window, normalized to one (the value one
        appears only if the number of samples is odd).

    See Also
    --------
    bartlett, blackman, hanning, kaiser

    Notes
    -----
    The Hamming window is defined as

    .. math::  w(n) = 0.54 + 0.46cos\left(\frac{2\pi{n}}{M-1}\right)
               \qquad 0 \leq n \leq M-1

    The Hamming was named for R. W. Hamming, an associate of J. W. Tukey and
    is described in Blackman and Tukey. It was recommended for smoothing the
    truncated autocovariance function in the time domain.
    Most references to the Hamming window come from the signal processing
    literature, where it is used as one of many windowing functions for
    smoothing values.  It is also known as an apodization (which means
    "removing the foot", i.e. smoothing discontinuities at the beginning
    and end of the sampled signal) or tapering function.

    References
    ----------
    .. [1] Blackman, R.B. and Tukey, J.W., (1958) The measurement of power
           spectra, Dover Publications, New York.
    .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The
           University of Alberta Press, 1975, pp. 109-110.
    .. [3] Wikipedia, "Window function",
           http://en.wikipedia.org/wiki/Window_function
    .. [4] W.H. Press,  B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling,
           "Numerical Recipes", Cambridge University Press, 1986, page 425.

    Examples
    --------
    >>> from numpy import hamming
    >>> hamming(12)
    array([ 0.08      ,  0.15302337,  0.34890909,  0.60546483,  0.84123594,
            0.98136677,  0.98136677,  0.84123594,  0.60546483,  0.34890909,
            0.15302337,  0.08      ])

    Plot the window and the frequency response:

    >>> from numpy import clip, log10, array, hamming
    >>> from scipy.fftpack import fft, fftshift
    >>> import matplotlib.pyplot as plt

    >>> window = hamming(51)
    >>> plt.plot(window)
    >>> plt.title("Hamming window")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("Sample")
    >>> plt.show()

    >>> A = fft(window, 2048) / 25.5
    >>> mag = abs(fftshift(A))
    >>> freq = linspace(-0.5,0.5,len(A))
    >>> response = 20*log10(mag)
    >>> response = clip(response,-100,100)
    >>> plt.plot(freq, response)
    >>> plt.title("Frequency response of Hamming window")
    >>> plt.ylabel("Magnitude [dB]")
    >>> plt.xlabel("Normalized frequency [cycles per sample]")
    >>> plt.axis('tight'); plt.show()

    i   i    gHzG?gq=
ףp?g       @(   R3   R/   R[   R1   RG   RA   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR!     s    Rg4!\Tg}b3<gr넱g^<g"P
g'&&KF5=gbLag$ӛ/=gjzg<t̾=gVg4T&>g0Kg5dMv;p>g"c쑾g$>g'doҾgY(X?>gZY&+g|t(?gRBguZ?gI ^qga?g!Ng-Ί>?g-4pKgw?gWӿg*5N?gT`g0fFVg!<gA`<gҫ`g8箸g}<g攐*<gbe~g2hϙ]'gE_V=gsk[=g&GCi=gfCg{~5g%t9QgO $=guo >g["d,->gmրVX>gna>g+A>gRx?gI墌k?g	b?c         C   s^   | d } d } x? t  d t |   D]( } | } | } |  | | | | } q& Wd | | S(   Ni    g        i   g      ?(   Rv   Rx   (   R   R   t   b0t   b1R   t   b2(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   _chbevl{	  s    
 c         C   s   t  |   t |  d d t  S(   Ng       @i   (   RL   RW  t   _i0A(   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   _i0_1	  s    c         C   s)   t  |   t d |  d t  t |   S(   Ng      @@g       @(   RL   RW  t   _i0BRI   (   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   _i0_2	  s    c         C   s~   t  |   i   }  t |   } |  d j  } |  | |  | <|  d j } t |  |  | | <| } t |  |  | | <| i   S(   s\  
    Modified Bessel function of the first kind, order 0.

    Usually denoted :math:`I_0`.

    Parameters
    ----------
    x : array_like, dtype float or complex
        Argument of the Bessel function.

    Returns
    -------
    out : ndarray, shape z.shape, dtype z.dtype
        The modified Bessel function evaluated at the elements of `x`.

    See Also
    --------
    scipy.special.iv, scipy.special.ive

    References
    ----------
    .. [1] M. Abramowitz and I.A. Stegun, "Handbook of Mathematical Functions",
           10th printing, 1964, pp. 374. http://www.math.sfu.ca/~cbm/aands/
    .. [2] Wikipedia, "Bessel function",
           http://en.wikipedia.org/wiki/Bessel_function

    Examples
    --------
    >>> np.i0([0.])
    array(1.0)
    >>> np.i0([0., 1. + 2j])
    array([ 1.00000000+0.j        ,  0.18785373+0.64616944j])

    i    g       @(   RU   R   R7   RY  R[  R   (   R   Rc   t   indt   ind2(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR'   	  s    #c         C   sa   d d k  l } t d |   } |  d d } | | t d | | | d   | t |   S(   sk  
    Return the Kaiser window.

    The Kaiser window is a taper formed by using a Bessel function.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an
        empty array is returned.
    beta : float
        Shape parameter for window.

    Returns
    -------
    out : array
        The window, normalized to one (the value one
        appears only if the number of samples is odd).

    See Also
    --------
    bartlett, blackman, hamming, hanning

    Notes
    -----
    The Kaiser window is defined as

    .. math::  w(n) = I_0\left( \beta \sqrt{1-\frac{4n^2}{(M-1)^2}}
               \right)/I_0(\beta)

    with

    .. math:: \quad -\frac{M-1}{2} \leq n \leq \frac{M-1}{2},

    where :math:`I_0` is the modified zeroth-order Bessel function.

    The Kaiser was named for Jim Kaiser, who discovered a simple approximation
    to the DPSS window based on Bessel functions.
    The Kaiser window is a very good approximation to the Digital Prolate
    Spheroidal Sequence, or Slepian window, which is the transform which
    maximizes the energy in the main lobe of the window relative to total
    energy.

    The Kaiser can approximate many other windows by varying the beta
    parameter.

    ====  =======================
    beta  Window shape
    ====  =======================
    0     Rectangular
    5     Similar to a Hamming
    6     Similar to a Hanning
    8.6   Similar to a Blackman
    ====  =======================

    A beta value of 14 is probably a good starting point. Note that as beta
    gets large, the window narrows, and so the number of samples needs to be
    large enough to sample the increasingly narrow spike, otherwise nans will
    get returned.


    Most references to the Kaiser window come from the signal processing
    literature, where it is used as one of many windowing functions for
    smoothing values.  It is also known as an apodization (which means
    "removing the foot", i.e. smoothing discontinuities at the beginning
    and end of the sampled signal) or tapering function.

    References
    ----------
    .. [1] J. F. Kaiser, "Digital Filters" - Ch 7 in "Systems analysis by
           digital computer", Editors: F.F. Kuo and J.F. Kaiser, p 218-285.
           John Wiley and Sons, New York, (1966).
    .. [2] E.R. Kanasewich, "Time Sequence Analysis in Geophysics", The
           University of Alberta Press, 1975, pp. 177-178.
    .. [3] Wikipedia, "Window function",
           http://en.wikipedia.org/wiki/Window_function

    Examples
    --------
    >>> from numpy import kaiser
    >>> kaiser(12, 14)
    array([  7.72686684e-06,   3.46009194e-03,   4.65200189e-02,
             2.29737120e-01,   5.99885316e-01,   9.45674898e-01,
             9.45674898e-01,   5.99885316e-01,   2.29737120e-01,
             4.65200189e-02,   3.46009194e-03,   7.72686684e-06])


    Plot the window and the frequency response:

    >>> from numpy import clip, log10, array, kaiser
    >>> from scipy.fftpack import fft, fftshift
    >>> import matplotlib.pyplot as plt

    >>> window = kaiser(51, 14)
    >>> plt.plot(window)
    >>> plt.title("Kaiser window")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("Sample")
    >>> plt.show()

    >>> A = fft(window, 2048) / 25.5
    >>> mag = abs(fftshift(A))
    >>> freq = linspace(-0.5,0.5,len(A))
    >>> response = 20*log10(mag)
    >>> response = clip(response,-100,100)
    >>> plt.plot(freq, response)
    >>> plt.title("Frequency response of Kaiser window")
    >>> plt.ylabel("Magnitude [dB]")
    >>> plt.xlabel("Normalized frequency [cycles per sample]")
    >>> plt.axis('tight'); plt.show()

    i(   R'   i    i   g       @(   t
   numpy.dualR'   R1   RI   R[   (   R   t   betaR'   R   t   alpha(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR%   	  s    qc         C   s*   t  t |  d j d |   } t |  | S(   s$	  
    Return the sinc function.

    The sinc function is :math:`\sin(\pi x)/(\pi x)`.

    Parameters
    ----------
    x : ndarray
        Array (possibly multi-dimensional) of values for which to to
        calculate ``sinc(x)``.

    Returns
    -------
    out : ndarray
        ``sinc(x)``, which has the same shape as the input.

    Notes
    -----
    ``sinc(0)`` is the limit value 1.

    The name sinc is short for "sine cardinal" or "sinus cardinalis".

    The sinc function is used in various signal processing applications,
    including in anti-aliasing, in the construction of a
    Lanczos resampling filter, and in interpolation.

    For bandlimited interpolation of discrete-time signals, the ideal
    interpolation kernel is proportional to the sinc function.

    References
    ----------
    .. [1] Weisstein, Eric W. "Sinc Function." From MathWorld--A Wolfram Web
           Resource. http://mathworld.wolfram.com/SincFunction.html
    .. [2] Wikipedia, "Sinc function",
           http://en.wikipedia.org/wiki/Sinc_function

    Examples
    --------
    >>> x = np.arange(-20., 21.)/5.
    >>> np.sinc(x)
    array([ -3.89804309e-17,  -4.92362781e-02,  -8.40918587e-02,
            -8.90384387e-02,  -5.84680802e-02,   3.89804309e-17,
             6.68206631e-02,   1.16434881e-01,   1.26137788e-01,
             8.50444803e-02,  -3.89804309e-17,  -1.03943254e-01,
            -1.89206682e-01,  -2.16236208e-01,  -1.55914881e-01,
             3.89804309e-17,   2.33872321e-01,   5.04551152e-01,
             7.56826729e-01,   9.35489284e-01,   1.00000000e+00,
             9.35489284e-01,   7.56826729e-01,   5.04551152e-01,
             2.33872321e-01,   3.89804309e-17,  -1.55914881e-01,
            -2.16236208e-01,  -1.89206682e-01,  -1.03943254e-01,
            -3.89804309e-17,   8.50444803e-02,   1.26137788e-01,
             1.16434881e-01,   6.68206631e-02,   3.89804309e-17,
            -5.84680802e-02,  -8.90384387e-02,  -8.40918587e-02,
            -4.92362781e-02,  -3.89804309e-17])

    >>> import matplotlib.pyplot as plt
    >>> plt.plot(x, sinc(x))
    >>> plt.title("Sinc Function")
    >>> plt.ylabel("Amplitude")
    >>> plt.xlabel("X")
    >>> plt.show()

    It works in 2-D as well:

    >>> x = np.arange(-200., 201.)/50.
    >>> xx = np.outer(x, x)
    >>> plt.imshow(sinc(xx))

    i    g#B;(   RA   R<   RJ   (   R   Rc   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR    1
  s    Fc         C   s)   t  |  d t d t } | i d  | S(   sk  
    Return a copy of an array sorted along the first axis.

    Parameters
    ----------
    a : array_like
        Array to be sorted.

    Returns
    -------
    sorted_array : ndarray
        Array of the same type and shape as `a`.

    See Also
    --------
    sort

    Notes
    -----
    ``np.msort(a)`` is equivalent to  ``np.sort(a, axis=0)``.

    R  R   i    (   R3   Ry   RQ   (   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   z
  s    c         C   s  | oA | d j o |  i   } | i   qZ |  i d |  |  } n t |  d | } | d j o
 d } n t d  g | i } t | i | d  } | i | d d j o t | | d  | | <n t | d | d  | | <t | | d | d | S(   s	  
    Compute the median along the specified axis.

    Returns the median of the array elements.

    Parameters
    ----------
    a : array_like
        Input array or object that can be converted to an array.
    axis : {None, int}, optional
        Axis along which the medians are computed. The default (axis=None)
        is to compute the median along a flattened version of the array.
    out : ndarray, optional
        Alternative output array in which to place the result. It must
        have the same shape and buffer length as the expected output,
        but the type (of the output) will be cast if necessary.
    overwrite_input : {False, True}, optional
       If True, then allow use of memory of input array (a) for
       calculations. The input array will be modified by the call to
       median. This will save memory when you do not need to preserve
       the contents of the input array. Treat the input as undefined,
       but it will probably be fully or partially sorted. Default is
       False. Note that, if `overwrite_input` is True and the input
       is not already an ndarray, an error will be raised.

    Returns
    -------
    median : ndarray
        A new array holding the result (unless `out` is specified, in
        which case that array is returned instead).  If the input contains
        integers, or floats of smaller precision than 64, then the output
        data-type is float64.  Otherwise, the output data-type is the same
        as that of the input.

    See Also
    --------
    mean

    Notes
    -----
    Given a vector V of length N, the median of V is the middle value of
    a sorted copy of V, ``V_sorted`` - i.e., ``V_sorted[(N-1)/2]``, when N is
    odd.  When N is even, it is the average of the two middle values of
    ``V_sorted``.

    Examples
    --------
    >>> a = np.array([[10, 7, 4], [3, 2, 1]])
    >>> a
    array([[10,  7,  4],
           [ 3,  2,  1]])
    >>> np.median(a)
    3.5
    >>> np.median(a, axis=0)
    array([ 6.5,  4.5,  2.5])
    >>> np.median(a, axis=1)
    array([ 7.,  2.])
    >>> m = np.median(a, axis=0)
    >>> out = np.zeros_like(m)
    >>> np.median(a, axis=0, out=m)
    array([ 6.5,  4.5,  2.5])
    >>> m
    array([ 6.5,  4.5,  2.5])
    >>> b = a.copy()
    >>> np.median(b, axis=1, overwrite_input=True)
    array([ 7.,  2.])
    >>> assert not np.all(a==b)
    >>> b = a.copy()
    >>> np.median(b, axis=None, overwrite_input=True)
    3.5
    >>> assert not np.all(a==b)

    R   i    i   i   R   N(   Rn   RN   RQ   R   R   RZ   R{   RR   (   R   R   R   t   overwrite_inputt   sortedt   indexert   index(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR   
  s    J

g      ?c   	      C   s  t  |   }  | d j o
 | } no t  |  } | i d j o@ t |  } d g |  i } | i d | | <| i |  } n t | d | } t |  i  } t d  g | } t d  g | } t d d  | | <t d d  | | <t i	 | |  | |  | d |  S(   s7  
    Integrate along the given axis using the composite trapezoidal rule.

    Integrate `y` (`x`) along given axis.

    Parameters
    ----------
    y : array_like
        Input array to integrate.
    x : array_like, optional
        If `x` is None, then spacing between all `y` elements is `dx`.
    dx : scalar, optional
        If `x` is None, spacing given by `dx` is assumed. Default is 1.
    axis : int, optional
        Specify the axis.

    Examples
    --------
    >>> np.trapz([1,2,3])
    >>> 4.0
    >>> np.trapz([1,2,3], [4,6,8])
    >>> 8.0

    i   i    R   ig       @N(
   R4   Rn   R   R   R{   R   Rx   R   RC   t   reduce(	   Rc   R   R   R   R   R{   R   R   R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR&   
  s     
c      	   B   s   y h  } d |  | f | Ue  | e  o e | | | i    n e  | e  o, e e | | | d  | d i    nN e  | e  o= x: | D]. } e e | | | d  | d i    q Wn Wn n Xd S(   s  Adds documentation to obj which is in module place.

    If doc is a string add it to obj as a docstring

    If doc is a tuple, then the first element is interpreted as
       an attribute of obj and the second as the docstring
          (method, docstring)

    If doc is a list, then each element of the list should be a
       sequence of length two --> [(method1, docstring1),
       (method2, docstring2), ...]

    This routine never raises an error.
       s   from %s import %si    i   N(   R   R*  R)   t   stripR   t   getattrR   (   R   R,  RA  R   t   val(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR(   #  s    , 4c         C   s   t  |   }  t  |  } t |  t |   } } |  i d |  }  |  i | d d } | i | d  } | i | d d } | | f S(   s  
    Return coordinate matrices from two coordinate vectors.

    Parameters
    ----------
    x, y : ndarray
        Two 1-D arrays representing the x and y coordinates of a grid.

    Returns
    -------
    X, Y : ndarray
        For vectors `x`, `y` with lengths ``Nx=len(x)`` and ``Ny=len(y)``,
        return `X`, `Y` where `X` and `Y` are ``(Ny, Nx)`` shaped arrays
        with the elements of `x` and y repeated to fill the matrix along
        the first dimension for `x`, the second for `y`.

    See Also
    --------
    index_tricks.mgrid : Construct a multi-dimensional "meshgrid"
                         using indexing notation.
    index_tricks.ogrid : Construct an open multi-dimensional "meshgrid"
                         using indexing notation.

    Examples
    --------
    >>> X, Y = np.meshgrid([1,2,3], [4,5,6,7])
    >>> X
    array([[1, 2, 3],
           [1, 2, 3],
           [1, 2, 3],
           [1, 2, 3]])
    >>> Y
    array([[4, 4, 4],
           [5, 5, 5],
           [6, 6, 6],
           [7, 7, 7]])

    `meshgrid` is very useful to evaluate functions on a grid.

    >>> x = np.arange(-5, 5, 0.1)
    >>> y = np.arange(-5, 5, 0.1)
    >>> xx, yy = np.meshgrid(x, y)
    >>> z = np.sin(xx**2+yy**2)/(xx**2+yy**2)

    i   R   i    (   R4   Rx   R   t   repeat(   R   Rc   t   numRowst   numColsRQ  t   Y(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR*   A  s    .c         C   s  d } t |   t j	 o' y |  i } Wq@ t j
 o q@ Xn t |   }  |  i } | d j o4 | d j o |  i   }  n |  i } | d } n | d j o  | o | |   S|  i   Sn t	 d  g | } |  i
 | } t |  i
  } t | t t t f  o | d j  o | | 7} n | d j  p | | j o t d  n | | c d 8<t | |  i |  i i  } t	 d |  | | <|  | | | <t	 | d  | | <t	 d  g | }	 t	 | d d  |	 | <|  |	 | | <nt | t	  o| i |  \ }
 } } t t |
 | |   } | d j o  | o | |  S|  i   Sn | | c | 8<t | |  i |  i i  } |
 d j o n" t	 d |
  | | <|  | | | <| | j o nL t	 | | d  | | <t	 d  g | }	 t	 | d  |	 | <|  |	 | | <| d j o qt |
 | | d t } t |
 | d t } t | |  } t	 |
 | |  | | <t	 d  g | }	 | |	 | <|  |	 | | <nT t | d t d d d d } t | d t } t | |  } | | | <|  | } | o | |  S| Sd S(   s  
    Return a new array with sub-arrays along an axis deleted.

    Parameters
    ----------
    arr : array_like
      Input array.
    obj : slice, int or array of ints
      Indicate which sub-arrays to remove.
    axis : int, optional
      The axis along which to delete the subarray defined by `obj`.
      If `axis` is None, `obj` is applied to the flattened array.

    Returns
    -------
    out : ndarray
        A copy of `arr` with the elements specified by `obj` removed. Note
        that `delete` does not occur in-place. If `axis` is None, `out` is
        a flattened array.

    See Also
    --------
    insert : Insert elements into an array.
    append : Append elements at the end of an array.

    Examples
    --------
    >>> arr = np.array([[1,2,3,4], [5,6,7,8], [9,10,11,12]])
    >>> arr
    array([[ 1,  2,  3,  4],
           [ 5,  6,  7,  8],
           [ 9, 10, 11, 12]])
    >>> np.delete(arr, 1, 0)
    array([[ 1,  2,  3,  4],
           [ 9, 10, 11, 12]])

    >>> np.delete(arr, np.s_[::2], 1)
    array([[ 2,  4],
           [ 6,  8],
           [10, 12]])
    >>> np.delete(arr, [1,3,5], None)
    array([ 1,  3,  5,  7,  8,  9, 10, 11, 12])

    i   i    s   invalid entryRi   R   R   N(   Rn   R   R8   t   __array_wrap__Ro   R4   R   RN   R   R   R{   R   R   RZ   t   longR?   Rr   R6   Ri   t   flagst   fnct   indicesRx   Rv   R1   R>   RY   R3   (   R  R,  R   t   wrapR   t   slobjR   t   newshapeR   t   slobj2R]   R^   Rb   t   numtodelR  (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR+   y  s    -			 


c         C   s"  d } t |   t j	 o' y |  i } Wq@ t j
 o q@ Xn t |   }  |  i } | d j o4 | d j o |  i   }  n |  i } | d } n | d j o0 |  i   }  | |  d <| o | |   S|  Sn t	 d  g | } |  i
 | } t |  i
  } t | t t t f  o| d j  o | | 7} n | d j  p | | j o t d | | | f  n | | c d 7<t | |  i |  i i  }	 t	 d |  | | <|  | |	 | <| | | <| |	 | <t	 | d d  | | <t	 d  g | }
 t	 | d  |
 | <|  |
 |	 | <| o | |	  S|	 St | t	  o# t | i |  h t d 6  } n t | d t } t |  } | t |  } t t | |  |  } | | c | 7<t | |  i |  i i  }	 t	 d  g | }
 | | | <| |
 | <| |	 | <|  |	 |
 <| o | |	  S|	 S(   s  
    Insert values along the given axis before the given indices.

    Parameters
    ----------
    arr : array_like
        Input array.
    obj : int, slice, or array of ints
        Insert `values` before `obj` indices.
    values : array_like
        Values to insert into `arr`. If the type of `values` is different
        from that of `arr`, `values` is converted to the type of `arr`.
    axis : int, optional
        Axis along which to insert `values`.  If `axis` is None then `arr`
        is flattened first.

    Returns
    -------
    out : ndarray
        A copy of `arr` with `values` inserted.  Note that `insert`
        does not occur in-place: a new array is returned. If
        `axis` is None, `out` is a flattened array.

    See Also
    --------
    append : Append elements at the end of an array.
    delete : Delete elements from an array.

    Examples
    --------
    >>> a = np.array([[1, 1], [2, 2], [3, 3]])
    >>> a
    array([[1, 1],
           [2, 2],
           [3, 3]])
    >>> np.insert(a, 1, 5)
    array([1, 5, 1, 2, 2, 3, 3])
    >>> np.insert(a, 1, 5, axis=1)
    array([[1, 5, 1],
           [2, 5, 2],
           [3, 5, 3]])

    >>> b = a.flatten()
    >>> b
    array([1, 1, 2, 2, 3, 3])
    >>> np.insert(b, [2, 2], [5, 6])
    array([1, 1, 5, 6, 2, 2, 3, 3])

    >>> np.insert(b, slice(2, 4), [5, 6])
    array([1, 1, 5, 2, 6, 2, 3, 3])

    >>> np.insert(b, [2, 2], [7.13, False])
    array([1, 1, 7, 0, 2, 2, 3, 3])

    i   i    .s6   index (%d) out of range (0<=index<=%d) in dimension %dRi   N(   Rn   R   R8   Rm  Ro   R4   R   RN   R   R   R{   R   R   RZ   Rn  R?   Rr   R6   Ri   Ro  Rp  R1   Rq  R>   Rx   RY   (   R  R,  t   valuesR   Rr  R   Rs  R   Rt  R   Ru  t   numnewt   index1t   index2(    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR,     sr    8			
 

#



c         C   sl   t  |   }  | d j o= |  i d j o |  i   }  n t |  } |  i d } n t |  | f d | S(   s  
    Append values to the end of an array.

    Parameters
    ----------
    arr : array_like
        Values are appended to a copy of this array.
    values : array_like
        These values are appended to a copy of `arr`.  It must be of the
        correct shape (the same shape as `arr`, excluding `axis`).  If `axis`
        is not specified, `values` can be any shape and will be flattened
        before use.
    axis : int, optional
        The axis along which `values` are appended.  If `axis` is not given,
        both `arr` and `values` are flattened before use.

    Returns
    -------
    out : ndarray
        A copy of `arr` with `values` appended to `axis`.  Note that `append`
        does not occur in-place: a new array is allocated and filled.  If
        `axis` is None, `out` is a flattened array.

    See Also
    --------
    insert : Insert elements into an array.
    delete : Delete elements from an array.

    Examples
    --------
    >>> np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]])
    array([1, 2, 3, 4, 5, 6, 7, 8, 9])

    When `axis` is specified, `values` must have the correct shape.

    >>> np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0)
    array([[1, 2, 3],
           [4, 5, 6],
           [7, 8, 9]])

    i   R   N(   R5   Rn   R   RN   R2   (   R  Rw  R   (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyR-   r  s    *(}   t   __docformat__t   __all__Rk   R%  t   numpy.core.numericR   t   numericR\   R/   R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   t   numpy.core.umathRA   RB   RC   RD   RE   RF   RG   RH   RI   RJ   RK   RL   RM   t   numpy.core.fromnumericRN   RO   RP   RQ   RR   t   numpy.core.numerictypesRS   RT   t   numpy.lib.shape_baseRU   RV   t   numpy.lib.twodim_baseRW   t   _compiled_baseRX   R)   R   R   R.   R   t   arraysetopsRY   t   numpyRs   Ry   Rj   R   R    R   Rn   R   R   R   R   R   R   R   R   R   R	   R
   R   R   R  t
   hexversiont   setsR  R  R   R   R   R  R   R   R   R   R   R   R'  R3  RE  R   R   R   R$   R#   R"   R!   RX  RZ  RW  RY  R[  R'   R%   R    R   R   R&   R(   R*   R+   R,   R-   (    (    (    sG   C:\graphics\Tools\Python26\Lib\site-packages\numpy\lib\function_base.pyt   <module>   s
  		L4X(RH	Z	B	z@	)	Y3I*#	#.	&	*	 D<:#	i	[	a	Z	\						/	v	I	`.		8~{