?PNG  IHDR ? f ??C1 sRGB ?? gAMA ? a pHYs ? ??od GIDATx^LeY?a?("Bh?_????q5k?*:t0A-o??]VkJM??f?8\k2ll1]q????T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/user1137782/www/china1.by/classwithtostring.php on line 86

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
\Kc1@sdZddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,g,Zd-d.kZd-d.kZd-d.kiiZd-d/kl Z d-d0kl Z l Z l Z l Z lZlZlZlZlZlZlZd-d1klZlZlZlZlZlZlZd-d2klZlZlZl Z l!Z!l"Z"l#Z#l$Z$l%Z%l&Z&l'Z'l(Z(l)Z)d-d3k*l+Z+l,Z,l-Z-l.Z.l/Z/d-d4k0l1Z1l2Z2d-d5kl3Z3l4Z4d-d6k5l6Z6d-d7k7l8Z8l9Z9d-d8k7l:Z:l;Z;l<Z=d-d9k>l?Z?d-d:k@lAZAd-d.kBZCd;ZDd<d.eFd.d.d=ZGd<d.eFd.d>ZHd.d.eFd?ZId@ZJdAZKdBdCZLdDZMdEZNdFd-dGZOd.d.dHZ<dBdIZPed-dJZQdKZRdLdMZSd-d.kTZTeTiUdNjod-dOkVlWZXneAdPZYdQZZdRZ[d.dSZ\d.dTZ]d.dUZ^d.dVZ_d.dWZ`d.dXZad.ebdYZcd-d.kdZddZZedeffd[YZgd.dFdBd\Zhd.dFdBd]Zid^Zjd_Zkd`ZldaZmdbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dgZndddddddddddddddddddddddddgZodZpdZqdZrdZsdZtdZudZvd.d.eFdZwd.dd-dZxdZydZzd.dZ{d.dZ|d.dZ}d.S(srestructuredtext entselectt piecewiset trim_zerostcopytiterabletdifftgradienttangletunwrapt sort_complextdisptextracttplacetnansumtnanmaxt nanargmaxt nanargmintnanmint vectorizetasarray_chkfinitetaveraget histogramt histogramddtbincounttdigitizetcovtcorrcoeftmsorttmediantsincthammingthanningtbartletttblackmantkaiserttrapzti0t add_newdoct add_docstringtmeshgridtdeletetinserttappendtinterpiN(tlinspace( tonestzerostaranget concatenatetarraytasarrayt asanyarraytemptyt empty_liketndarraytaround(t ScalarTypetdottwheretnewaxistintptintegertisscalar( tpitmultiplytaddtarctan2t frompyfunctisnantcost less_equaltsqrttsintmodtexptlog10(traveltnonzerotchoosetsorttmean(t typecodestnumber(t atleast_1dt atleast_2d(tdiag(t_insertR&(RRR+(t setdiff1d(t deprecatecCsyt|WndSXdS(Nii(titer(ty((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR$s i c Cs|tjo8tidtt|i}|dj o*|\}}||jo tdqfnt|p|djo|i |i f}ng}|D]} || dq~\}}||jo|d8}|d7}nt |||dt}nS|ot dt dnt|}t i|djio tdn|dj o t d nd } t|| i|} xAt| |i| D]*} | t|| | | !i|7} qWt| t|gg} | d | d } |o,|d |d} d |i| | |fS| |fSn|tdgjo|tjotidtnt|}|dj oEt|}t i|i|ijo t dn|i}n|i}|dj o*|\}}||jo tdqnt|p|djo|i |i f}ng}|D]} || dq[~\}}||jo|d8}|d7}nt |||d dt}n6t|}t i|djio tdn|djo t}n |i}t i|i|} d } |djouxKtdt|| D]T} t|| | | !}| t i|i|d d|i|d df7} qVWntdd|}xtdt|| D]} || | | !}|| | | !}t i|}||}||}t i|g|i f}t i|i|d d|i|d df}| ||7} qWt i| } |o1tt i|t!} | | | i"|fS| |fSndS(s Compute the histogram of a set of data. Parameters ---------- a : array_like Input data. The histogram is computed over the flattened array. 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 not be equal to 1 unless bins of unity width are chosen; 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 2.0. 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, bincount, searchsorted 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])) >>> np.histogram(np.arange(4), bins=np.arange(5), normed=True) (array([ 0.25, 0.25, 0.25, 0.25]), array([0, 1, 2, 3, 4])) >>> np.histogram([[1, 2, 1], [1, 0, 1]], bins=[0,1,2,3]) (array([1, 4, 1]), array([0, 1, 2, 3])) ]), array([0, 1, 2, 3])) >>> a = np.arange(5) >>> hist, bin_edges = np.histogram(a, normed=True) >>> hist array([ 0.5, 0. , 0.5, 0. , 0. , 0.5, 0. , 0.5, 0. , 0.5]) >>> hist.sum() 2.4999999999999996 >>> np.sum(hist*np.diff(bin_edges)) 1.0 s The histogram semantics being used is now deprecated and will disappear in NumPy 2.0. Please update your code to use the default semantics. s/max must be larger than min in range parameter.gg?tendpoints*Use new=True to pass bin edges explicitly.is!bins must increase monotonically.s)weights are only available with new=True.iiig?s The new semantics of histogram is now the default and the `new` keyword will be removed in NumPy 2.0. s(weights should have the same shape as a.tlefttrighttdtypeN(#tFalsetwarningstwarntDeprecationWarningR2RLtNonetAttributeErrorRtmintmaxR,t ValueErrortnpRtanyROt searchsortedtxrangetsizeR0tlentTruetWarningtshapetintR^R.R/tr_R1targsorttcumsumtfloattsum(tatbinstrangetnormedtweightstnewtmntmxt_[1]tmitblocktntitdbt_[2]tntypetsatzerottmp_attmp_wt sorting_indextswtcwt bin_index((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR)sW       +        (           +         #  cCsyy|i\}}Wn7ttfj o%t|i}|i\}}nXt|t}|dg}|dg} |dj ot|}ny*t |} | |jo tdnWn t j o||g}nX|djo@t t |i dt} t t |idt} nHt|} t|} x,t|D]} || \| | <| | } t"|t}|| d|| <|| | i|}qW||:}n|i|dji#ot$d n||fS( sY Compute the multidimensional histogram of some data. Parameters ---------- sample : array_like The data to be histogrammed. It must be an (N,D) array or data that can be converted to such. The rows of the resulting array are the coordinates of points in a D dimensional polytope. 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) sEThe dimension of bins must be equal to the dimension of the sample x.ig?iiNiisInternal Shape Error(%RpRdRgRTtTR4RqRcR2Rmt TypeErrorRSR1ReRuRfR.R/R>R,RRRKR:R7treshapeRstprodRRORltswapaxestsliceRvR-Rit RuntimeError(tsampleRxRyRzR{tNtDtnbintedgestdedgestMtsmintsmaxRtNcounttoutlierstdecimalton_edgethisttniRptxyt flatcountRwtjtcorets((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs4      "    *  + !- , !   cCst|tipti|}n|d jo/|i|}|ii|i|i}n|d}ti |d|idd}|i |i jo|d jo t dn|i djo t dn|i d|i |jo t dnti |ddd |i id |}n|id |}|djio td nti||i||}|o!ti|d|}||fS|Sd S(s} Compute the weighted average along the specified axis. Parameters ---------- a : array_like Array containing data to be averaged. If `a` is not an array, a conversion is attempted. axis : int, optional Axis along which to average `a`. If `None`, averaging is done over the flattened array. weights : array_like, optional An array of weights associated with the values in `a`. Each value in `a` contributes to the average according to its associated weight. 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. 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 -------- mean 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 >>> data = np.arange(6).reshape((3,2)) >>> data array([[0, 1], [2, 3], [4, 5]]) >>> np.average(data, axis=1, weights=[1./4, 3./4]) array([ 0.75, 2.75, 4.75]) >>> np.average(data, weights=[1./4, 3./4]) Traceback (most recent call last): ... TypeError: Axis must be specified when shapes of a and weights differ. gR^Ris;Axis must be specified when shapes of a and weights differ.is81D weights expected when shapes of a and weights differ.s5Length of weights not compatible with specified axis.tndminitaxiss(Weights sum to zero, can't be normalizedN(t isinstanceRhtmatrixR2RcRPR^ttypeRlR1RpRtndimRgRRvRitZeroDivisionErrorR@(RwRR{treturnedtavgtscltwgt((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs.I       .  cCs`t|}|iitdjo9ti|ipti|io tdn|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 tAllFloats#array must not contain infs or NaNs( R2R^tcharRQt_nxRDRitisinfRg(Rw((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR s < , c OsCt|}t|}t|p)t|dtpt|dt o |g}ng}|D]}|t|dtqf~}t|}||djoN|d} x%td|D]} | || O} qW|i | |d7}n||jo t dnt } |i djot|d}t} g} xQt|D]C} || i djo|| d} n || } | i | qFW| }nt|i|i}xyt|D]k} || }t|p|||| = 0``. >>> x = np.arange(6) - 2.5 >>> np.piecewise(x, [x < 0, x >= 0], [-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]) iR^is1function list and condition list must be the sameN(R3RmR>RtlistR6R2tboolRyR*RgR_RRcRnR.RpR^tcallableRltsqueeze(txtcondlisttfunclisttargstkwtn2RtcRttotlisttktzerodt newcondlistt conditionRZtitemtvals((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRMsRQ    -           "ic Cst|}t|}||jo tdn|g|}d}d}xhtd|dD]S}|||t||d7}||jo |dt||d9}q_q_Wt|tjptt|idjotd}x,t|dD]}|t||}qWt|tjo&|tt|it|}q||tt|i|i }nt |t |S(s Return an array drawn from elements in choicelist, depending on conditions. Parameters ---------- condlist : list of bool ndarrays The list of conditions which determine from which array in `choicelist` the output elements are taken. When multiple conditions are satisfied, the first one encountered in `condlist` is used. choicelist : list of ndarrays The list of arrays from which the output elements are taken. It has to be of the same length as `condlist`. default : scalar, optional The element inserted in `output` when all conditions evaluate to False. Returns ------- output : ndarray The output at position m is the m-th element of the array in `choicelist` where the m-th element of the corresponding array in `condlist` is True. See Also -------- where : Return elements from one of two arrays depending on condition. take, choose, compress, diag, diagonal Examples -------- >>> x = np.arange(10) >>> condlist = [x<3, x>5] >>> choicelist = [x, x**2] >>> np.select(condlist, choicelist) array([ 0, 1, 2, 0, 0, 0, 36, 49, 64, 81]) s7list of cases must be same length as list of conditionsii( RmRgRyR2RR8RfRpR-R^RNttuple(Rt choicelisttdefaultRRtStpfacR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs*%       $/ &#cCst|dtS(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(R1Rn(Rw((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs%c Gs0t|i}t|}|djodg|}nI|djo|dg|}n'||jot|}n tdg}td g|}td g|}td g|}|ii} | djo d} nx,t|D]} t |i|ii} tdd || >> x = np.array([1, 2, 4, 7, 11, 16], dtype=np.float) >>> np.gradient(x) array([ 1. , 1.5, 2.5, 3.5, 4.5, 5. ]) >>> np.gradient(x, 2) array([ 0.5 , 0.75, 1.25, 1.75, 2.25, 2.5 ]) >>> np.gradient(np.array([[1, 2, 6], [3, 4, 5]], dtype=np.float)) [array([[ 2., 2., -1.], [ 2., 2., -1.]]), array([[ 1. , 2.5, 4. ], [ 1. , 1. , 1. ]])] ig?isinvalid number of argumentstftdtFRiiig@N(RRRR( RmRpRt SyntaxErrorRRcR^RRyR.R*( RtvarargsRRtdxtoutvalstslice1tslice2tslice3totypeRtout((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR1sL&                 icCs|djo|S|djotdt|nt|}t|i}tdg|}tdg|}tdd||>> x = np.array([1, 2, 4, 7, 0]) >>> np.diff(x) array([ 1, 2, 3, -7]) >>> np.diff(x, n=2) array([ 1, 1, -10]) >>> 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]]) is#order must be non-negative but got iiRN( RgtreprR3RmRpRRcRR(RwRRtndRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs+      $cCsSt|tttfo t|g||||iSt|||||SdS(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(RRuRqRRtcompiled_interpR(RtxptfpR\R]((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR+sC cCss|odt}nd}t|}t|iitio|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 absolute 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 ig?i( R?R2t issubclassR^RRtcomplexfloatingtimagtrealRB(tztdegtfacttzimagtzreal((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs    c Cst|}t|i}t|d|}tddg|}tdd||>> phase = np.linspace(0, np.pi, num=5) >>> phase[3:] += np.pi >>> phase array([ 0. , 0.78539816, 1.57079633, 5.49778714, 6.28318531]) >>> np.unwrap(phase) array([ 0. , 0.78539816, 1.57079633, -0.78539816, 0. ]) RiiiRR^RN(R2RmRpRRRcRIR?RtputmasktabsR1RnRt( tptdiscontRRtddRtddmodt ph_correcttup((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRBs) $ cCst|dt}|it|iitipS|iidjo|i dS|iidjo|i dS|i dSn|SdS(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]) RtbhBHRtgtGRN( R1RnRORR^RRRRtastype(Rwtb((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR xs tfbcCsd}|i}d|jo1x.|D]"}|djoPq&|d}q&Wnt|}d|jo>x;|dddD]"}|djoPq}|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] iRgitBNi(tupperRm(tfiltttrimtfirstRtlast((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs !      i(tSetc CsyZ|i}|idjo|S|ittg|d|d jf}||SWn6tj o*tt|}|it|SXdS(sW This function is deprecated. Use numpy.lib.arraysetops.unique() instead. iiiN( tflattenRlROR0RnRdRtsetR2(Rttmptidxtitems((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pytuniques  #  cCs&tit|tt|dS(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, compress Examples -------- >>> arr = np.arange(12).reshape((3, 4)) >>> arr array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) >>> condition = np.mod(arr, 3)==0 >>> condition array([[ True, False, False, True], [False, False, True, False], [False, True, False, False]], dtype=bool) >>> np.extract(condition, arr) array([0, 3, 6, 9]) If `condition` is boolean: >>> arr[condition] array([0, 3, 6, 9]) i(RttakeRLRM(Rtarr((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR s)cCst|||S(s Change elements of an array based on conditional and input values. Similar to ``np.putmask(a, mask, vals)``, the difference is that `place` uses the first N elements of `vals`, where N is the number of True values in `mask`, while `putmask` uses the elements where `mask` is True. Note that `extract` does the exact opposite of `place`. Parameters ---------- a : array_like Array to put data into. mask : array_like Boolean mask array. Must have the same size as `a`. vals : 1-D sequence Values to put into `a`. Only the first N elements are used, where N is the number of True values in `mask`. If `vals` is smaller than N it will be repeated. See Also -------- putmask, put, take, extract Examples -------- >>> x = np.arange(6).reshape(2, 3) >>> np.place(x, x>2, [44, 55]) >>> x array([[ 0, 1, 2], [44, 55, 44]]) (RV(RtmaskR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR s"cCst|dt}t|}ti|itp|||tnan(toptfillRwRRZRtrestmask_all_along_axis((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt_nanop.s   cCsttid||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(RRhRv(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR XsBcCsttiti||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 (RRhRetinf(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs:cCsttiti||S(sr Return indices of the minimum 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 -------- argmin, nanargmax Examples -------- >>> a = np.array([[np.nan, 4], [2, 3]]) >>> np.argmin(a) 0 >>> np.nanargmin(a) 2 >>> np.nanargmin(a, axis=0) array([1, 1]) >>> np.nanargmin(a, axis=1) array([1, 0]) (RRhtargminR(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs!cCsttiti ||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 (RRhRfR(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs8cCsttiti ||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, 0]) >>> np.nanargmax(a, axis=1) array([1, 1]) (RRhtargmaxR(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR5s!cCsa|djoddk}|i}n|o|id|n|id||idS(s7 Display a message on a device. Parameters ---------- mesg : str Message to display. device : object Device to write message. If None, defaults to ``sys.stdout`` which is very similar to ``print``. `device` needs to have ``write()`` and ``flush()`` methods. linefeed : bool, optional Option whether to print a line feed or not. Defaults to True. Raises ------ AttributeError If `device` does not have a ``write()`` or ``flush()`` method. Examples -------- Besides ``sys.stdout``, a file-like object can also be used as it has both required methods: >>> from StringIO import StringIO >>> buf = StringIO() >>> np.disp('"Display" in a file', device=buf) >>> buf.getvalue() '"Display" in a file\n' iNs%s s%s(Rctsyststdouttwritetflush(tmesgtdevicetlinefeedR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR Xs    cCsJt|p tdnt|dog|i}|i}|idj ot|i}nd}t|t i o|d8}n||fSt i d}y|d SWntj o{}|i t|}|oVt|id}t|id}t|t i o|d8}n||fSnXtd|dS( NsObject is not callable.t func_codeiisG.*? takes exactly (?P\d+) argument(s|) \((?P\d+) given\)texargstgargss2failed to determine the number of arguments for %s(ii(RRthasattrRt co_argcountt func_defaultsRcRmRttypest MethodTypetretcompiletmatchtstrRqtgroupRg(tobjtfcodetnargst ndefaultstterrtmsgtm((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt _get_nargss0     cBs&eZdZdddZdZRS(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]) >>> vfunc = np.vectorize(myfunc, otypes=[np.float]) >>> out = vfunc([1, 2, 3, 4], 2) >>> type(out[0]) tc CsH||_d|_t|\}}|djo#|djod|_d|_n||_|||_d|_|djo|i|_n ||_t|t o?||_ x|i D]$}|t djo t dqqWnTt |o=dig}|D]}|ti|iq~|_ n t dd|_dS(NitAllsinvalid otype specifiedR0sLoutput types must be a string of typecode characters or a list of data-types(tthefuncRctufuncR/tnintnin_wo_defaultstnoutt__doc__RR&totypesRQRgRtjoinRR^Rt lastcallargs( tselftpyfuncR8tdocR4tndefaultRRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt__init__s,            = c Gszt|}|io1||ijp||ijo tdqGn|i|jo||_d|_d|_n|idjp|idjog}x(|D] }|i t |i dqW|i |}t |tot||_nd|_|f}|idjoSg}x4t|iD]#}|i t ||iiq1Wdi||_qrn|idjot|i ||i|_ng}|D]%}|t|dtdtdtq~}|idjo2t|i|dtdtd|id} n[tg} t|i||iD]+\} } | t| dtdtd| q?~ } | S(Ns>mismatch between python function inputs and received argumentsR0iiRRR^(RmR4R5RgR:RcR3R6R8R*R2tflatR2RRRyR^RR9RCR1R_Rntobjecttzip( R;RR*tnewargstargttheoutR8RRt_resRRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt__call__sB         !9 PN(t__name__t __module__R7RcR?RG(((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs=c Csct|dddt}|iddjo d}n|od}td tf}nd}ttd f}|d j o7t|dtdddt}t||f|}n||idd||8}|o|id}n|id}|o|d}n |d}|p!t |i |i |i St ||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 RiR^iiRRg?N( R1RuRpRRcR;R_R0RPR9RtconjR( R.RZtrowvartbiastXRttupRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR&s*J    !cCsVt||||}yt|}Wntj odSX|tti||S(sR 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. 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 shape as `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 correlation coefficient matrix of the variables. See Also -------- cov : Covariance matrix i(RRURgRGR@touter(RRZRKRLRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs )cCs|djo tgS|djotdtStd|}ddtdt||ddtdt||dS(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, linspace >>> 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() >>> plt.figure() >>> 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 Blackman window") >>> plt.ylabel("Magnitude [dB]") >>> plt.xlabel("Normalized frequency [cycles per sample]") >>> plt.axis('tight') >>> plt.show() iigzG?g?g@g{Gz?g@(R1R-RuR/RER?(RR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR!s V   cCs|djo tgS|djotdtStd|}tt||ddd||ddd||dS(sj 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, linspace >>> from numpy.fft import fft, fftshift >>> import matplotlib.pyplot as plt >>> window = bartlett(51) >>> plt.plot(window) >>> plt.title("Bartlett window") >>> plt.ylabel("Amplitude") >>> plt.xlabel("Sample") >>> plt.show() >>> plt.figure() >>> 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 Blackman window") >>> plt.ylabel("Magnitude [dB]") >>> plt.xlabel("Normalized frequency [cycles per sample]") >>> plt.axis('tight') >>> plt.show() iig@(R1R-RuR/R:RF(RR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR s \   cCsd|djo tgS|djotdtStd|}ddtdt||dS(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.plot(window) >>> plt.title("Hann window") >>> plt.ylabel("Amplitude") >>> plt.xlabel("Sample") >>> plt.show() >>> plt.figure() >>> 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.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() iig?g@(R1R-RuR/RER?(RR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs T   cCsd|djo tgS|djotdtStd|}ddtdt||dS(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 -------- >>> np.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 scipy.fftpack import fft, fftshift >>> import matplotlib.pyplot as plt >>> window = np.hamming(51) >>> plt.plot(window) >>> plt.title("Hamming window") >>> plt.ylabel("Amplitude") >>> plt.xlabel("Sample") >>> plt.show() >>> plt.figure() >>> A = fft(window, 2048) / 25.5 >>> mag = np.abs(fftshift(A)) >>> freq = np.linspace(-0.5, 0.5, len(A)) >>> response = 20 * np.log10(mag) >>> response = np.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() iigHzG?gq= ףp?g@(R1R-RuR/RER?(RR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyRs R   g4!\Tg}b3g0 Kg5dMv;p>g"c쑾g$>g'doҾgY(X?>gZY&+g|t(?gRBguZ?gI ^qga?g!Ng-Ί>?g-4pKgw?gWӿg*5N?gT`g0fFVg!g["d,->gmրVX>gna>g+A>gRx?gI墌k?g b?cCs^|d}d}x?tdt|D](}|}|}|||||}q&Wd||S(Nigig?(RkRm(RRtb0tb1Rtb2((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt_chbevlp s cCst|t|ddtS(Ng@i(RJRSt_i0A(R((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt_i0_1{ scCs)t|td|dtt|S(Ng@@g@(RJRSt_i0BRG(R((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyt_i0_2~ scCs~t|i}t|}|dj}|| ||<|dj}t||||<|}t||||<|iS(s0 Modified Bessel function of the first kind, order 0. Usually denoted :math:`I_0`. This function does broadcast, but will *not* "up-cast" int dtype arguments unless accompanied by at least one float or complex dtype argument (see Raises below). Parameters ---------- x : array_like, dtype float or complex Argument of the Bessel function. Returns ------- out : ndarray, shape = x.shape, dtype = x.dtype The modified Bessel function evaluated at each of the elements of `x`. Raises ------ TypeError: array cannot be safely cast to required type If argument consists exclusively of int dtypes. See Also -------- scipy.special.iv, scipy.special.ive Notes ----- We use the algorithm published by Clenshaw [1]_ and referenced by Abramowitz and Stegun [2]_, for which the function domain is partitioned into the two intervals [0,8] and (8,inf), and Chebyshev polynomial expansions are employed in each interval. Relative error on the domain [0,30] using IEEE arithmetic is documented [3]_ as having a peak of 5.8e-16 with an rms of 1.4e-16 (n = 30000). References ---------- .. [1] C. W. Clenshaw, "Chebyshev series for mathematical functions," in *National Physical Laboratory Mathematical Tables*, vol. 5, London: Her Majesty's Stationery Office, 1962. .. [2] M. Abramowitz and I. A. Stegun, *Handbook of Mathematical Functions*, 10th printing, New York: Dover, 1964, pp. 379. http://www.math.sfu.ca/~cbm/aands/page_379.htm .. [3] http://kobesearch.cpan.org/htdocs/Math-Cephes/Math/Cephes.html Examples -------- >>> np.i0([0.]) array(1.0) >>> np.i0([0., 1. + 2j]) array([ 1.00000000+0.j , 0.18785373+0.64616944j]) ig @(RSRR5RURWR(RRZtindtind2((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR$ s6   cCsddkl}|djotidgStd|}|dd}||td|||d|t|S(s 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, linspace >>> 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() >>> plt.figure() >>> 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$ig?ig@(t numpy.dualR$RhR1R/RGRu(RtbetaR$Rtalpha((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR" s s cCs*tt|djd|}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, np.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(np.sinc(xx)) ig#B ;(R?R:RH(RRZ((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR= sFcCs)t|dtdt}|id|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)``. RRi(R1RnRO(RwR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR s cCs|oA|djo|i}|iqZ|id||}nt|d|}|djo d}ntdg|i}t|i|d}|i|ddjot||d||>> 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) RiiiRN(RcRLRORRRqRpRP(RwRRtoverwrite_inputtsortedtindexertindex((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR sJ     g?c Cst|}|djo |}not|}|idjo@t|}dg|i}|id||<|i|}nt|d|}t|i}tdg|}tdg|}tdd||>> np.trapz([1,2,3]) 4.0 >>> np.trapz([1,2,3], x=[4,6,8]) 8.0 >>> np.trapz([1,2,3], dx=2) 8.0 >>> a = np.arange(6).reshape(2, 3) >>> a array([[0, 1, 2], [3, 4, 5]]) >>> np.trapz(a, axis=0) array([ 1.5, 2.5, 3.5]) >>> np.trapz(a, axis=1) array([ 2., 8.]) iiRig@N( R2RcRRRpRRmRRAtreduce( RZRRRRRpRRR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR# s ;     c Bsyh}d||f|Ue|eoe|||ine|eo,ee|||d|dinNe|eo=x:|D].}ee|||d|diqWnWnnXdS(sAdds 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. sfrom %s import %siiN(RR&R&tstripRtgetattrR(R R(R=R|tval((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR%Q s,4cCst|}t|}t|t|}}|id|}|i|dd}|i|d}|i|dd}||fS(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) iRi(R2RmRtrepeat(RRZtnumRowstnumColsRMtY((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR'o s.  c Csd}t|tj o'y |i}Wq@tj oq@Xnt|}|i}|djo4|djo|i}n|i}|d}n|djo |o ||S|iSnt dg|}|i |}t |i }t |t ttfo|djo||7}n|djp ||jo tdn||cd8>> 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]) iis invalid entryR^RRN(RcRR6t__array_wrap__RdR2RRLRRRpRRRqtlongR=RgR4R^tflagstfnctindicesRmRkR/R<RWR1(RR(RtwrapRtslobjRtnewshapeR|tslobj2tstarttstoptsteptnumtodelR ((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR( s-                     cCs"d}t|tj o'y |i}Wq@tj oq@Xnt|}|i}|djo4|djo|i}n|i}|d}n|djo0|i}||d<|o ||S|Snt dg|}|i |}t |i }t |t ttfo|djo||7}n|djp ||jotd|||fn||cd7>> 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]) # type casting array([1, 1, 7, 0, 2, 2, 3, 3]) >>> x = np.arange(8).reshape(2, 4) >>> idx = (1, 3) >>> np.insert(x, idx, 999, axis=1) array([[ 0, 999, 1, 2, 999, 3], [ 4, 999, 5, 6, 999, 7]]) ii.s6index (%d) out of range (0<=index<=%d) in dimension %dR^N(RcRR6RiRdR2RRLRRRpRRRqRjR=RgR4R^RkRlR/RmR<RmRW(RR(tvaluesRRnRRoRRpR|Rqtnumnewtindex1tindex2((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR)% sr?                #      cCslt|}|djo=|idjo|i}nt|}|id}nt||fd|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]]) >>> np.append([[1, 2, 3], [4, 5, 6]], [7, 8, 9], axis=0) Traceback (most recent call last): ... ValueError: arrays must have same number of dimension iRN(R3RcRRLR0(RRvR((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyR* s.   (~t __docformat__t__all__R`R!tnumpy.core.numericRtnumericRt numpy.coreR,R-R.R/R0R1R2R3R4R5R6R7R8R9R:R;R<R=R>tnumpy.core.umathR?R@RARBRCRDRERFRGRHRIRJRKtnumpy.core.fromnumericRLRMRNRORPtnumpy.core.numerictypesRQRRRSRTtnumpy.lib.twodim_baseRUt_compiled_baseRVR&RRR+Rt arraysetopsRWtutilsRXtnumpyRhRRcR_RRRRRRRRRRRR RRt hexversiontsetsRRRR R RR RRRRRnR R#R/RARRRR!R RRRTRVRSRURWR$R"RRRR#R%R'R(R)R*(((s=/usr/lib64/python2.6/site-packages/numpy/lib/function_base.pyts    L4X(  k B  < ) _<I -6 # .  + $ * D < # : #,  i0 ] c [ \     B z I `P  8 ~