?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
\Kc@sdZdZdZddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddgZddkZddkZddkZddklZl Z l Z l Z l Z ddkl ZddkiiZddkiiZddklZlZddklZddkZei ZedZeid ddZdZde fdYZ!de!fdYZ"h e#d6ddd6dd6dd6dd6dd6dd6dd6dd6Z$ei%Z&e&i'gZ(ei)ei*gD]Z+e(e+ei, fq[(ei-Z.e.i'gZ/ei)ei*gD]Z+e/e+ei, fq[/dei0jo>e&i'ei1ei, fge.i'ei1ei, fgndZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;e<dZ=dZ>e#dZ?e?Z@ee#e<dZAhZBhZCdfdYZDdfdYZEdfdYZFdfdYZGdfdYZHdfdYZIdfdYZJdfdYZKeIeiLZLeIeiMZMeIeiNZNeIeiOZOeIeiPZPeIeiQZQeIeiRZReIeiSZSeIeiTZTeIeiUZUeIeiVZWZVeIeiXZXeIeiYZYeIeiZZZeIei[Z[eIei\Z]eIei^Z^eIei_deHdZ_eIei`deGdZ`eIeiadeGdZaeIeiPdeEdZPeIeibdeDddZbeIeicdeDddZceIeiddeHdZdeIeiedeDddddZeeJeifZfeJeigZgeJeihddZheJeiiddZieJeijZje<ej_keJeilZle<el_keJeimZme<em_keJeinZne<en_keJeioZoe<eo_keJeipZpe<ep_keJeiqZqeJeiqddikZreJeisZsesikZteJeiuZueJeivZveJeiwZweJeixZxeJeiyZyeKeizeFddZzeKei{eFddZ{eKei|eFddZ|eKei}eFddZ}eKei~eFddZ~eKeieFddZe dZdZdZeZdZdZee#e<edZe<dZee#dZdZdZe#dZe#dZe#dZe#dZe#dZe#dZe#dZe#dZe#dZe#e#dZdde#e#dZe#dZd fd YZed Zd Zed dddddddZdZdefdYZdefdYZdZdefdYZdZdZeZeZeddeide#ZeZeZe<eeee<e#ee#e#dd  Z eie _d!Zd"efd#YZd$efd%YZd&efd'YZe<e<e<d(Zeiie_e<e<e<d)Zeiie_e<e<e<d*Zeiie_d+fd,YZed ZedZZedZed*Zed2Zed3Zed.Zed6ZedPZedSZeZed~ZeZedZedZedZedZedZed-ZedZedZedZedZedZedZedZe<d.Ze<d/e<e<d0Zeiie_e<e<d1Zeiie_e<e<d2Zeiie_dd/e<e#e<d3Zeiie_d4Zdd5Ze<d6Zeiie_dd7Zd8Zd9Zd:Zd;d<Zd=Ze<d>Zd?d@ZdAZdBZeiie_dCZeiie_e<dDZeiie_e<e<dEZe<d;dFZde<dGZ\e\ZdHZeeiidIe_eZdJZeeiidIe_eZe#dKZe#dde<dLZe<e<dMZe<dNZdOZdPZdQZdRZeddSdTZdUZdVfdWYZedZeiZeiZed;Zed<ZedHZedJZedRZeiZedZedZeiZdS(Xs numpy.ma : a package to handle missing or invalid values. This package was initially written for numarray by Paul F. Dubois at Lawrence Livermore National Laboratory. In 2006, the package was completely rewritten by Pierre Gerard-Marchant (University of Georgia) to make the MaskedArray class a subclass of ndarray, and to improve support of structured arrays. Copyright 1999, 2000, 2001 Regents of the University of California. Released for unlimited redistribution. * Adapted for numpy_core 2005 by Travis Oliphant and (mainly) Paul Dubois. * Subclassing of the base `ndarray` 2006 by Pierre Gerard-Marchant (pgmdevlist_AT_gmail_DOT_com) * Improvements suggested by Reggie Dugard (reggie_AT_merfinllc_DOT_com) .. moduleauthor:: Pierre Gerard-Marchant sPierre GF Gerard-Marchantsrestructuredtext entMAErrort MaskErrortMaskTypet MaskedArraytbool_tabstabsolutetaddtalltallclosetallequaltalltruetamaxtamintanomt anomaliestanytarangetarccostarccoshtarcsintarcsinhtarctantarctan2tarctanhtargmaxtargmintargsorttaroundtarraytasarrayt asanyarrayt bitwise_andt bitwise_ort bitwise_xortceiltchoosetcliptcommon_fill_valuetcompresst compressedt concatenatet conjugatetcopytcostcoshtcounttcumprodtcumsumtdefault_fill_valuetdiagtdiagonaltdifftdividetdumptdumpstemptyt empty_liketequaltexpt expand_dimstfabst flatten_masktfmodtfilledtfloort floor_dividet fix_invalidtflatten_structured_arrayt frombuffertfromflext fromfunctiontgetdatatgetmaskt getmaskarraytgreatert greater_equalt harden_maskthypottidentitytidstindicestinnert innerproducttisMAt isMaskedArraytis_maskt is_maskedtisarrayt left_shifttlesst less_equaltloadtloadstlogtlog10t logical_andt logical_nott logical_ort logical_xort make_masktmake_mask_descrtmake_mask_nonetmask_ortmaskedt masked_arrayt masked_equaltmasked_greatertmasked_greater_equalt masked_insidetmasked_invalidt masked_lesstmasked_less_equaltmasked_not_equalt masked_objecttmasked_outsidetmasked_print_optiontmasked_singletont masked_valuest masked_wheretmaxtmaximumtmaximum_fill_valuetmeantmintminimumtminimum_fill_valuetmodtmultiplytnegativetnomasktnonzerot not_equaltonestoutert outerproducttpowertprodtproducttptptputtputmasktranktravelt remaindertrepeattreshapetresizet right_shifttround_troundtset_fill_valuetshapetsintsinhtsizetsometruetsortt soften_masktsqrttsqueezetstdtsubtracttsumtswapaxesttakettanttanhttracet transposet true_dividetvartwheretzerosiN(tndarrayR R t iscomplexobjR(R(t getargspect formatargspec(R<itignorecCs8|djodS|djo|Sd}|||fS(s8 Adds a Notes section to an existing docstring. Ns( %s Notes ----- %s (tNone(t initialdoctnotetnewdoc((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytdoc_noteos   cCs>ytt|}Wn!tj o}d}d}nX|S(s$ Get the signature from obj sGUnable to retrieve the signature of %s '%s' (Initial error message: %s)t(RRt TypeError(tobjtsigterrmsgtmsg((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytget_object_signatures  cBseZdZRS(s&Class for masked array related errors.(t__name__t __module__t__doc__(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRscBseZdZRS(sClass for mask related errors.(RRR(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRstbg@xDytctfi?Btit?tOsN/AtStus???tVtUtfloat128cCs0t|dotd |i}nt|tioC|io ti|idi d}q,ti|i d}nt|t otd}nt|t pt|t otd}net|t otd}nGt|totd}n)t|totd}n td }|S( sh Return the default fill value for the argument object. The default filling value depends on the datatype of the input array or the type of the input scalar: ======== ======== datatype default ======== ======== bool True int 999999 float 1.e20 complex 1.e20+0j object '?' string 'N/A' ======== ======== Parameters ---------- obj : ndarray, dtype or scalar The array data-type or scalar for which the default fill value is returned. Returns ------- fill_value : scalar The default fill value. Examples -------- >>> np.ma.default_fill_value(1) 999999 >>> np.ma.default_fill_value(np.array([1.1, 2., np.pi])) 1e+20 >>> np.ma.default_fill_value(np.dtype(complex)) (1e+20+0j) tdtypeiRRRRRRRN(thasattrt_check_fill_valueRRt isinstancetnptsubdtypetdefault_fillertgettkindtfloattinttlongtstrtunicodetcomplex(Rtdefval((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR1s$(    cCsZ|i}|oBg}x.|D]&}t|||}|i|qWt|S||S(N(tnamest_recursive_extremum_fill_valuetappendttuple(tndtypetextremumRtdeflisttnametfval((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs  cCsd}t|dot|itSt|tottidSt|tottidSt|t ottidSt|t io t|St |dS(sX Return the maximum value that can be represented by the dtype of an object. This function is useful for calculating a fill value suitable for taking the minimum of an array with a given dtype. Parameters ---------- obj : ndarray or dtype An object that can be queried for it's numeric type. Returns ------- val : scalar The maximum representable value. Raises ------ TypeError If `obj` isn't a suitable numeric type. See Also -------- maximum_fill_value : The inverse function. set_fill_value : Set the filling value of a masked array. MaskedArray.fill_value : Return current fill value. Examples -------- >>> import numpy.ma as ma >>> a = np.int8() >>> ma.minimum_fill_value(a) 127 >>> a = np.int32() >>> ma.minimum_fill_value(a) 2147483647 An array of numeric data can also be passed. >>> a = np.array([1, 2, 3], dtype=np.int8) >>> ma.minimum_fill_value(a) 127 >>> a = np.array([1, 2, 3], dtype=np.float32) >>> ma.minimum_fill_value(a) inf s(Unsuitable type for calculating minimum.Rtfloat_tint_tuintN( RRRt min_fillerRRtntypesttypeDictRRRR(RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR~s0 cCsd}t|dot|itSt|tottidSt|tottidSt|t ottidSt|t io t|St |dS(s\ Return the minimum value that can be represented by the dtype of an object. This function is useful for calculating a fill value suitable for taking the maximum of an array with a given dtype. Parameters ---------- obj : {ndarray, dtype} An object that can be queried for it's numeric type. Returns ------- val : scalar The minimum representable value. Raises ------ TypeError If `obj` isn't a suitable numeric type. See Also -------- minimum_fill_value : The inverse function. set_fill_value : Set the filling value of a masked array. MaskedArray.fill_value : Return current fill value. Examples -------- >>> import numpy.ma as ma >>> a = np.int8() >>> ma.maximum_fill_value(a) -128 >>> a = np.int32() >>> ma.maximum_fill_value(a) -2147483648 An array of numeric data can also be passed. >>> a = np.array([1, 2, 3], dtype=np.int8) >>> ma.maximum_fill_value(a) -128 >>> a = np.array([1, 2, 3], dtype=np.float32) >>> ma.maximum_fill_value(a) -inf s(Unsuitable type for calculating maximum.RRRRN( RRRt max_fillerRRRRRRRR(RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRz9s0 cCstg}xa|D]Y}|d}t|to|itt|q |itti|q Wt|S(Ni(RtlistRRt!_recursive_set_default_fill_valueR1RR(t dtypedescrRt currentdescrt currenttype((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRxs  cCsti|t|}g}xyt||D]h\}}|d}t|to |itt||q.|iti |d|i q.Wt|S(NiR( RRtlentzipRRRRt_recursive_set_fill_valueRtitem(t fillvalueRt output_valueRtdescrtcdtype((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs   &c Csti|}|i}|djo?|o(|i}tit|d|}qt|}nA|og}|iD]}||d|dfqy~}t|t oUyti|dt d|}Wq)t j o#d}t |||fq)Xq|i}tit ||d|}nxt|t o |idjot|}nHy%ti|dt d|i}Wntj ot|}nX|S(s Private function validating the given `fill_value` for the given dtype. If fill_value is None, it is set to the default corresponding to the dtype if this latter is standard (no fields). If the datatype is flexible (named fields), fill_value is set to a tuple whose elements are the default fill values corresponding to each field. If fill_value is not None, its value is forced to the given dtype. RiiR+s"Unable to transform %s to dtype %stSVN(RRtfieldsRRRRR1RRtFalset ValueErrorRt basestringtcharRt OverflowError(t fill_valueRRRt_[1]t_tfdtypeterr_msg((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs4     2   %cCs-t|tot||i|_ndS(s Set the filling value of a, if a is a masked array. This function changes the fill value of the masked array `a` in place. If `a` is not a masked array, the function returns silently, without doing anything. Parameters ---------- a : array_like Input array. fill_value : dtype Filling value. A consistency test is performed to make sure the value is compatible with the dtype of `a`. Returns ------- None Nothing returned by this function. See Also -------- maximum_fill_value : Return the default fill value for a dtype. MaskedArray.fill_value : Return current fill value. MaskedArray.set_fill_value : Equivalent method. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(5) >>> a array([0, 1, 2, 3, 4]) >>> a = ma.masked_where(a < 3, a) >>> a masked_array(data = [-- -- -- 3 4], mask = [ True True True False False], fill_value=999999) >>> ma.set_fill_value(a, -999) >>> a masked_array(data = [-- -- -- 3 4], mask = [ True True True False False], fill_value=-999) Nothing happens if `a` is not a masked array. >>> a = range(5) >>> a [0, 1, 2, 3, 4] >>> ma.set_fill_value(a, 100) >>> a [0, 1, 2, 3, 4] >>> a = np.arange(5) >>> a array([0, 1, 2, 3, 4]) >>> ma.set_fill_value(a, 100) >>> a array([0, 1, 2, 3, 4]) N(RRRRt _fill_value(taR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs<cCs-t|to |i}n t|}|S(sr Return the filling value of a, if any. Otherwise, returns the default filling value for that type. (RRRR1(Rtresult((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytget_fill_values  cCs.t|}t|}||jo|SdS(s Return the common filling value of two masked arrays, if any. If ``a.fill_value == b.fill_value``, return the fill value, otherwise return None. Parameters ---------- a, b : MaskedArray The masked arrays for which to compare fill values. Returns ------- fill_value : scalar or None The common fill value, or None. Examples -------- >>> x = np.ma.array([0, 1.], fill_value=3) >>> y = np.ma.array([0, 1.], fill_value=3) >>> np.ma.common_fill_value(x, y) 3.0 N(R R(RRtt1tt2((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR&s    cCset|do|i|St|to|St|toti|dSti|SdS(sD Return input as an array with masked data replaced by a fill value. If `a` is not a `MaskedArray`, `a` itself is returned. If `a` is a `MaskedArray` and `fill_value` is None, `fill_value` is set to ``a.fill_value``. Parameters ---------- a : MaskedArray or array_like An input object. fill_value : scalar, optional Filling value. Default is None. Returns ------- a : ndarray The filled array. Examples -------- >>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0], ... [1, 0, 0], ... [0, 0, 0]]) >>> x.filled() array([[999999, 1, 2], [999999, 4, 5], [ 6, 7, 8]]) R@RN(RR@RRtdictRR(RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR@(scGst|djo4|d}t|tot|}qt}n{g}|D]}|t|qR~}|d}t|tp t}nx,|dD] }t||o |}qqW|S(s Return the youngest subclass of MaskedArray from a list of (masked) arrays. In case of siblings, the first listed takes over. ii(RRRttypet issubclass(tarraystarrtrclsRRtarrclstcls((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytget_masked_subclassRs  '   cCsWy |i}Wn.tj o"ti|dtd|}nX|p|itS|S(sF Return the data of a masked array as an ndarray. Return the data of `a` (if any) as an ndarray if `a` is a ``MaskedArray``, else return `a` as a ndarray or subclass (depending on `subok`) if not. Parameters ---------- a : array_like Input ``MaskedArray``, alternatively a ndarray or a subclass thereof. subok : bool Whether to force the output to be a `pure` ndarray (False) or to return a subclass of ndarray if appropriate (True, default). See Also -------- getmask : Return the mask of a masked array, or nomask. getmaskarray : Return the mask of a masked array, or full array of False. Examples -------- >>> import numpy.ma as ma >>> a = ma.masked_equal([[1,2],[3,4]], 2) >>> a masked_array(data = [[1 --] [3 4]], mask = [[False True] [False False]], fill_value=999999) >>> ma.getdata(a) array([[1, 2], [3, 4]]) Equivalently use the ``MaskedArray`` `data` attribute. >>> a.data array([[1, 2], [3, 4]]) R+tsubok(t_datatAttributeErrorRRRtviewR(RRtdata((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRHis,  cCst|d|d|dt}titi|i}|ip|S|i|O_|djo |i }n||i|<|S(s Return input with invalid data masked and replaced by a fill value. Invalid data means values of `nan`, `inf`, etc. Parameters ---------- a : array_like Input array, a (subclass of) ndarray. copy : bool, optional Whether to use a copy of `a` (True) or to fix `a` in place (False). Default is True. fill_value : scalar, optional Value used for fixing invalid data. Default is None, in which case the ``a.fill_value`` is used. Returns ------- b : MaskedArray The input array with invalid entries fixed. Notes ----- A copy is performed by default. Examples -------- >>> x = np.ma.array([1., -1, np.nan, np.inf], mask=[1] + [0]*3) >>> x masked_array(data = [-- -1.0 nan inf], mask = [ True False False False], fill_value = 1e+20) >>> np.ma.fix_invalid(x) masked_array(data = [-- -1.0 -- --], mask = [ True False True True], fill_value = 1e+20) >>> fixed = np.ma.fix_invalid(x) >>> fixed.data array([ 1.00000000e+00, -1.00000000e+00, 1.00000000e+20, 1.00000000e+20]) >>> x.data array([ 1., -1., NaN, Inf]) R+tmaskRN( RitTrueRRatisfiniteRRt_maskRR(RRR+Rtinvalid((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRCs.    t_DomainCheckIntervalcBs eZdZdZdZRS(s~ Define a valid interval, so that : ``domain_check_interval(a,b)(x) == True`` where ``x < a`` or ``x > b``. cCs4||jo||}}n||_||_dS(s9domain_check_interval(a,b)(x) = true where x < a or y > bN(RR(tselfRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__init__s  cCs.titi||iti||iS(sExecute the call behavior.(tumathRbRKRRZR(R tx((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__call__s(RRRR!R$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs t _DomainTancBs eZdZdZdZRS(szDefine a valid interval for the `tan` function, so that: ``domain_tan(eps) = True`` where ``abs(cos(x)) < eps`` cCs ||_dS(s/domain_tan(eps) = true where abs(cos(x)) < eps)N(teps(R R&((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!scCs%tititi||iS(sExecutes the call behavior.(R"RZRR,R&(R R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$s(RRRR!R$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR%s t_DomainSafeDividecBs#eZdZddZdZRS(s"Define a domain for safe division.cCs ||_dS(N(t tolerance(R R(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!scCsL|idjotiti|_nti||iti|jS(N(R(RRtfinfoRttinyR"R(R RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$ sN(RRRRR!R$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR's t_DomainGreatercBs eZdZdZdZRS(s)DomainGreater(v)(x) is True where x <= v.cCs ||_dS(s'DomainGreater(v)(x) = true where x <= vN(tcritical_value(R R,((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!scCsti||iS(sExecutes the call behavior.(R"R[R,(R R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$s(RRRR!R$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR+s t_DomainGreaterEqualcBs eZdZdZdZRS(s-DomainGreaterEqual(v)(x) is True where x < v.cCs ||_dS(s+DomainGreaterEqual(v)(x) = true where x < vN(R,(R R,((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!#scCsti||iS(sExecutes the call behavior.(R"RZR,(R R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$'s(RRRR!R$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR-!s t_MaskedUnaryOperationcBs/eZdZdddZdZdZRS(s Defines masked version of unary operations, where invalid values are pre-masked. Parameters ---------- mufunc : callable The function for which to define a masked version. Made available as ``_MaskedUnaryOperation.f``. fill : scalar, optional Filling value, default is 0. domain : class instance Domain for the function. Should be one of the ``_Domain*`` classes. Default is None. icCsi||_||_||_t|dt||_t|dt||_|t|<|t|>> import numpy.ma as ma >>> dtype = np.dtype({'names':['foo', 'bar'], 'formats':[np.float32, np.int]}) >>> dtype dtype([('foo', '>> ma.make_mask_descr(dtype) dtype([('foo', '|b1'), ('bar', '|b1')]) >>> ma.make_mask_descr(np.float32) (RRRRRtbool(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRescCst|dtS(s1 Return the mask of a masked array, or nomask. Return the mask of `a` as an ndarray if `a` is a `MaskedArray` and the mask is not `nomask`, else return `nomask`. To guarantee a full array of booleans of the same shape as a, use `getmaskarray`. Parameters ---------- a : array_like Input `MaskedArray` for which the mask is required. See Also -------- getdata : Return the data of a masked array as an ndarray. getmaskarray : Return the mask of a masked array, or full array of False. Examples -------- >>> import numpy.ma as ma >>> a = ma.masked_equal([[1,2],[3,4]], 2) >>> a masked_array(data = [[1 --] [3 4]], mask = [[False True] [False False]], fill_value=999999) >>> ma.getmask(a) array([[False, True], [False, False]], dtype=bool) Equivalently use the `MaskedArray` `mask` attribute. >>> a.mask array([[False, True], [False, False]], dtype=bool) Result when mask == `nomask` >>> b = ma.masked_array([[1,2],[3,4]]) >>> b masked_array(data = [[1 2] [3 4]], mask = False, fill_value=999999) >>> ma.nomask False >>> ma.getmask(b) == ma.nomask True >>> b.mask == ma.nomask True R(R1R(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRIs;cCsBt|}|tjo%tti|t|i}n|S(s Return the mask of a masked array, or full boolean array of False. Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and the mask is not `nomask`, else return a full boolean array of False of the same shape as `arr`. Parameters ---------- arr : array_like Input `MaskedArray` for which the mask is required. See Also -------- getmask : Return the mask of a masked array, or nomask. getdata : Return the data of a masked array as an ndarray. Examples -------- >>> import numpy.ma as ma >>> a = ma.masked_equal([[1,2],[3,4]], 2) >>> a masked_array(data = [[1 --] [3 4]], mask = [[False True] [False False]], fill_value=999999) >>> ma.getmaskarray(a) array([[False, True], [False, False]], dtype=bool) Result when mask == ``nomask`` >>> b = ma.masked_array([[1,2],[3,4]]) >>> b masked_array(data = [[1 2] [3 4]], mask = False, fill_value=999999) >>> >ma.getmaskarray(b) array([[False, False], [False, False]], dtype=bool) (RIRRfRRRHR(RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRJs2  %cCs/y|iitjSWntj otSXdS(s2 Return True if m is a valid, standard mask. This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype. Parameters ---------- m : array_like Array to test. Returns ------- result : bool True if `m.dtype.type` is MaskType, False otherwise. See Also -------- isMaskedArray : Test whether input is an instance of MaskedArray. Examples -------- >>> import numpy.ma as ma >>> m = ma.masked_equal([0, 1, 0, 2, 3], 0) >>> m masked_array(data = [-- 1 -- 2 3], mask = [ True False True False False], fill_value=999999) >>> ma.is_mask(m) False >>> ma.is_mask(m.mask) True Input must be an ndarray (or have similar attributes) for it to be considered a valid mask. >>> m = [False, True, False] >>> ma.is_mask(m) False >>> m = np.array([False, True, False]) >>> m array([False, True, False], dtype=bool) >>> ma.is_mask(m) True Arrays with complex dtypes don't return True. >>> dtype = np.dtype({'names':['monty', 'pithon'], 'formats':[np.bool, np.bool]}) >>> dtype dtype([('monty', '|b1'), ('pithon', '|b1')]) >>> m = np.array([(True, False), (False, True), (True, False)], dtype=dtype) >>> m array([(True, False), (False, True), (True, False)], dtype=[('monty', '|b1'), ('pithon', '|b1')]) >>> ma.is_mask(m) False N(RR RRR(R=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRVKs>cCs|dj otidt|}n|tjotSt|tokt|t}t |}|i |jo!|o|i }q|}qt i |d|d|}nt i t|tdt}|o!|i i o|i otS|SdS(s Create a boolean mask from an array. Return `m` as a boolean mask, creating a copy if necessary or requested. The function can accept any sequence that is convertible to integers, or ``nomask``. Does not require that contents must be 0s and 1s, values of 0 are interepreted as False, everything else as True. Parameters ---------- m : array_like Potential mask. copy : bool, optional Whether to return a copy of `m` (True) or `m` itself (False). shrink : bool, optional Whether to shrink `m` to ``nomask`` if all its values are False. flag : bool, optional Deprecated equivalent of `shrink`. dtype : dtype, optional Data-type of the output mask. By default, the output mask has a dtype of MaskType (bool). If the dtype is flexible, each field has a boolean dtype. Returns ------- result : ndarray A boolean mask derived from `m`. Examples -------- >>> import numpy.ma as ma >>> m = [True, False, True, True] >>> ma.make_mask(m) array([ True, False, True, True], dtype=bool) >>> m = [1, 0, 1, 1] >>> ma.make_mask(m) array([ True, False, True, True], dtype=bool) >>> m = [1, 0, 2, -3] >>> ma.make_mask(m) array([ True, False, True, True], dtype=bool) Effect of the `shrink` parameter. >>> m = np.zeros(4) >>> m array([ 0., 0., 0., 0.]) >>> ma.make_mask(m) False >>> ma.make_mask(m, shrink=False) array([False, False, False, False], dtype=bool) Using a flexible `dtype`. >>> m = [1, 0, 1, 1] >>> n = [0, 1, 0, 0] >>> arr = [] >>> for man, mouse in zip(m, n): ... arr.append((man, mouse)) >>> arr [(1, 0), (0, 1), (1, 0), (1, 0)] >>> dtype = np.dtype({'names':['man', 'mouse'], 'formats':[np.int, np.int]}) >>> arr = np.array(arr, dtype=dtype) >>> arr array([(1, 0), (0, 1), (1, 0), (1, 0)], dtype=[('man', '>> ma.make_mask(arr, dtype=dtype) array([(True, False), (False, True), (True, False), (True, False)], dtype=[('man', '|b1'), ('mouse', '|b1')]) s'The flag 'flag' is now called 'shrink'!RR+N(RtwarningstwarntDeprecationWarningRRRR@RReRR+RRRRR(R=R+tshrinktflagRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRds$H      #cCsE|djoti|dt}nti|dt|}|S(s/ Return a boolean mask of the given shape, filled with False. This function returns a boolean ndarray with all entries False, that can be used in common mask manipulations. If a complex dtype is specified, the type of each field is converted to a boolean type. Parameters ---------- newshape : tuple A tuple indicating the shape of the mask. dtype: {None, dtype}, optional If None, use a MaskType instance. Otherwise, use a new datatype with the same fields as `dtype`, converted to boolean types. Returns ------- result : ndarray An ndarray of appropriate shape and dtype, filled with False. See Also -------- make_mask : Create a boolean mask from an array. make_mask_descr : Construct a dtype description list from a given dtype. Examples -------- >>> import numpy.ma as ma >>> ma.make_mask_none((3,)) array([False, False, False], dtype=bool) Defining a more complex dtype. >>> dtype = np.dtype({'names':['foo', 'bar'], 'formats':[np.float32, np.int]}) >>> dtype dtype([('foo', '>> ma.make_mask_none((3,), dtype=dtype) array([(False, False), (False, False), (False, False)], dtype=[('foo', '|b1'), ('bar', '|b1')]) RN(RRRRRe(tnewshapeRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRfs+ c s\fd|tjp |tjo/t|dt}t|d|d|d|S|tjp |tjo/t|dt}t|d|d|d|S||jot|o|St|ddt|dd}}||jotd||fn|io$t i |}||||Stt i ||d|d|S(s Combine two masks with the ``logical_or`` operator. The result may be a view on `m1` or `m2` if the other is `nomask` (i.e. False). Parameters ---------- m1, m2 : array_like Input masks. copy : bool, optional If copy is False and one of the inputs is `nomask`, return a view of the other input mask. Defaults to False. shrink : bool, optional Whether to shrink the output to `nomask` if all its values are False. Defaults to True. Returns ------- mask : output mask The result masks values that are masked in either `m1` or `m2`. Raises ------ ValueError If `m1` and `m2` have different flexible dtypes. Examples -------- >>> m1 = np.ma.make_mask([0, 1, 1, 0]) >>> m2 = np.ma.make_mask([1, 0, 0, 0]) >>> np.ma.mask_or(m1, m2) array([ True, True, True, False], dtype=bool) cso|ii}x\|D]T}||}|iio|||||qti|||||qWdS(N(RRR"Rb(tm1tm2tnewmaskRRtcurrent1(t_recursive_mask_or(s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRbGs   RR+R[sIncompatible dtypes '%s'<>'%s'N( RRR1RRdRVRRRRR9R"Rb(R^R_R+R[Rtdtype1tdtype2R`((Rbs3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRg#s"$ %  csgd}fdti|}||}tig}|D] }||qJ~dtS(sG Returns a completely flattened version of the mask, where nested fields are collapsed. Parameters ---------- mask : array_like Input array, which will be interpreted as booleans. Returns ------- flattened_mask : ndarray of bools The flattened input. Examples -------- >>> mask = np.array([0, 0, 1], dtype=np.bool) >>> flatten_mask(mask) array([False, False, True], dtype=bool) >>> mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)]) >>> flatten_mask(mask) array([False, False, False, True], dtype=bool) >>> mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])] >>> mask = np.array([(0, (0, 0)), (0, (0, 1))], dtype=mdtype) >>> flatten_mask(mask) array([False, False, False, False, False, True], dtype=bool) cSsE|ii}|o*g}|D]}|t||q~S|SdS(sCFlatten the mask and returns a (maybe nested) sequence of booleans.N(RRR>(RtmnamesRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt _flatmasks *c3siyJxC|D];}t|do x"|D] }|Vq-Wq |Vq WWntj o |VnXdS(s.Generates a flattened version of the sequence.t__iter__N(RR(tsequencetelementR(t _flatsequence(s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRjs   R(RRRRW(RRft flattenedRR((Rjs3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR>cs  cCs"|tj o|id|StS(s:Check whether there are masked values along the given axisRJ(RR(RRJ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt_check_mask_axiss cCst|}ti|d|dt}|i|i}}|o'||jotd||fnt|do"t||i}t |}nt }|i |}||_|S(st Mask an array where a condition is met. Return `a` as an array masked where `condition` is True. Any masked values of `a` or `condition` are also masked in the output. Parameters ---------- condition : array_like Masking condition. When `condition` tests floating point values for equality, consider using ``masked_values`` instead. a : array_like Array to mask. copy : bool If True (default) make a copy of `a` in the result. If False modify `a` in place and return a view. Returns ------- result : MaskedArray The result of masking `a` where `condition` is True. See Also -------- masked_values : Mask using floating point equality. masked_equal : Mask where equal to a given value. masked_not_equal : Mask where `not` equal to a given value. masked_less_equal : Mask where less than or equal to a given value. masked_greater_equal : Mask where greater than or equal to a given value. masked_less : Mask where less than a given value. masked_greater : Mask where greater than a given value. masked_inside : Mask inside a given interval. masked_outside : Mask outside a given interval. masked_invalid : Mask invalid values (NaNs or infs). Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_where(a <= 2, a) masked_array(data = [-- -- -- 3], mask = [ True True True False], fill_value=999999) Mask array `b` conditional on `a`. >>> b = ['a', 'b', 'c', 'd'] >>> ma.masked_where(a == 2, b) masked_array(data = [a b -- d], mask = [False False True False], fill_value=N/A) Effect of the `copy` argument. >>> c = ma.masked_where(a <= 2, a) >>> c masked_array(data = [-- -- -- 3], mask = [ True True True False], fill_value=999999) >>> c[0] = 99 >>> c masked_array(data = [99 -- -- 3], mask = [False True True False], fill_value=999999) >>> a array([0, 1, 2, 3]) >>> c = ma.masked_where(a <= 2, a, copy=False) >>> c[0] = 99 >>> c masked_array(data = [99 -- -- 3], mask = [False True True False], fill_value=999999) >>> a array([99, 1, 2, 3]) When `condition` or `a` contain masked values. >>> a = np.arange(4) >>> a = ma.masked_where(a == 2, a) >>> a masked_array(data = [0 1 -- 3], mask = [False False True False], fill_value=999999) >>> b = np.arange(4) >>> b = ma.masked_where(b == 0, b) >>> b masked_array(data = [-- 1 2 3], mask = [ True False False False], fill_value=999999) >>> ma.masked_where(a == 3, b) masked_array(data = [-- 1 -- --], mask = [ True False True True], fill_value=999999) R+RsFInconsistant shape between the condition and the input (got %s and %s)R( RdRRRRt IndexErrorRRgRR RR(t conditionRR+tcondtcshapetashapeRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRwsc  cCstt|||d|S(s Mask an array where greater than a given value. This function is a shortcut to ``masked_where``, with `condition` = (x > value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_greater(a, 2) masked_array(data = [0 1 2 --], mask = [False False False True], fill_value=999999) R+(RwRK(R#tvalueR+((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRkscCstt|||d|S(s Mask an array where greater than or equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x >= value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_greater_equal(a, 2) masked_array(data = [0 1 -- --], mask = [False False True True], fill_value=999999) R+(RwRL(R#RrR+((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRl5scCstt|||d|S(s Mask an array where less than a given value. This function is a shortcut to ``masked_where``, with `condition` = (x < value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_less(a, 2) masked_array(data = [-- -- 2 3], mask = [ True True False False], fill_value=999999) R+(RwRZ(R#RrR+((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRoOscCstt|||d|S(s Mask an array where less than or equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x <= value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_less_equal(a, 2) masked_array(data = [-- -- -- 3], mask = [ True True True False], fill_value=999999) R+(RwR[(R#RrR+((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRpiscCstt|||d|S(s Mask an array where `not` equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x != value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_not_equal(a, 2) masked_array(data = [-- -- 2 --], mask = [ True True False True], fill_value=999999) R+(RwR(R#RrR+((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRqscCs+tt|||d|}||_|S(sa Mask an array where equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x == value). For floating point arrays, consider using ``masked_values(x, value)``. See Also -------- masked_where : Mask where a condition is met. masked_values : Mask using floating point equality. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(4) >>> a array([0, 1, 2, 3]) >>> ma.masked_equal(a, 2) masked_array(data = [0 1 -- 3], mask = [False False True False], fill_value=999999) R+(RwR:R(R#RrR+toutput((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRjs cCsS||jo||}}nt|}||j||j@}t||d|S(sw Mask an array inside a given interval. Shortcut to ``masked_where``, where `condition` is True for `x` inside the interval [v1,v2] (v1 <= x <= v2). The boundaries `v1` and `v2` can be given in either order. See Also -------- masked_where : Mask where a condition is met. Notes ----- The array `x` is prefilled with its filling value. Examples -------- >>> import numpy.ma as ma >>> x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1] >>> ma.masked_inside(x, -0.3, 0.3) masked_array(data = [0.31 1.2 -- -- -0.4 -1.1], mask = [False False True True False False], fill_value=1e+20) The order of `v1` and `v2` doesn't matter. >>> ma.masked_inside(x, 0.3, -0.3) masked_array(data = [0.31 1.2 -- -- -0.4 -1.1], mask = [False False True True False False], fill_value=1e+20) R+(R@Rw(R#tv1tv2R+txfRn((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRms !  cCsS||jo||}}nt|}||j||jB}t||d|S(st Mask an array outside a given interval. Shortcut to ``masked_where``, where `condition` is True for `x` outside the interval [v1,v2] (x < v1)|(x > v2). The boundaries `v1` and `v2` can be given in either order. See Also -------- masked_where : Mask where a condition is met. Notes ----- The array `x` is prefilled with its filling value. Examples -------- >>> import numpy.ma as ma >>> x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1] >>> ma.masked_outside(x, -0.3, 0.3) masked_array(data = [-- -- 0.01 0.2 -- --], mask = [ True True False False True True], fill_value=1e+20) The order of `v1` and `v2` doesn't matter. >>> ma.masked_outside(x, 0.3, -0.3) masked_array(data = [-- -- 0.01 0.2 -- --], mask = [ True True False False True True], fill_value=1e+20) R+(R@Rw(R#RtRuR+RvRn((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRss !  cCst|o"ti|i|}|i}n"titi||}t}t|t |d|}t |d|d|d|S(s Mask the array `x` where the data are exactly equal to value. This function is similar to `masked_values`, but only suitable for object arrays: for floating point, use `masked_values` instead. Parameters ---------- x : array_like Array to mask value : object Comparison value copy : {True, False}, optional Whether to return a copy of `x`. shrink : {True, False}, optional Whether to collapse a mask full of False to nomask Returns ------- result : MaskedArray The result of masking `x` where equal to `value`. See Also -------- masked_where : Mask where a condition is met. masked_equal : Mask where equal to a given value (integers). masked_values : Mask using floating point equality. Examples -------- >>> import numpy.ma as ma >>> food = np.array(['green_eggs', 'ham'], dtype=object) >>> # don't eat spoiled food >>> eat = ma.masked_object(food, 'green_eggs') >>> print eat [-- ham] >>> # plain ol` ham is boring >>> fresh_food = np.array(['cheese', 'ham', 'pineapple'], dtype=object) >>> eat = ma.masked_object(fresh_food, 'green_eggs') >>> print eat [cheese ham pineapple] Note that `mask` is set to ``nomask`` if possible. >>> eat masked_array(data = [cheese ham pineapple], mask = False, fill_value=?) R[RR+R( RUR"R:RRRRRRgRdRi(R#RrR+R[RnR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRrs3  gh㈵>g:0yE>c Csti}t||}t|iitio@ti|||||||}t |dt } nti ||}t } t | t |d|} t|d| d|d|S(s Mask using floating point equality. Return a MaskedArray, masked where the data in array `x` are approximately equal to `value`, i.e. where the following condition is True (abs(x - value) <= atol+rtol*abs(value)) The fill_value is set to `value` and the mask is set to ``nomask`` if possible. For integers, consider using ``masked_equal``. Parameters ---------- x : array_like Array to mask. value : float Masking value. rtol : float, optional Tolerance parameter. atol : float, optional Tolerance parameter (1e-8). copy : bool, optional Whether to return a copy of `x`. shrink : bool, optional Whether to collapse a mask full of False to ``nomask``. Returns ------- result : MaskedArray The result of masking `x` where approximately equal to `value`. See Also -------- masked_where : Mask where a condition is met. masked_equal : Mask where equal to a given value (integers). Examples -------- >>> import numpy.ma as ma >>> x = np.array([1, 1.1, 2, 1.1, 3]) >>> ma.masked_values(x, 1.1) masked_array(data = [1.0 -- 2.0 -- 3.0], mask = [False True False True False], fill_value=1.1) Note that `mask` is set to ``nomask`` if possible. >>> ma.masked_values(x, 1.5) masked_array(data = [ 1. 1.1 2. 1.1 3. ], mask = False, fill_value=1.5) For integers, the fill value will be different in general to the result of ``masked_equal``. >>> x = np.arange(5) >>> x array([0, 1, 2, 3, 4]) >>> ma.masked_values(x, 2) masked_array(data = [0 1 -- 3 4], mask = [False False True False False], fill_value=2) >>> ma.masked_equal(x, 2) masked_array(data = [0 1 -- 3 4], mask = [False False True False False], fill_value=999999) RR[RR+R(R"RR@RRR RtfloatingR[R1RR:RgRdRi( R#RrtrtoltatolR+R[tmabstxnewRnR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRvMsE *cCsti|d|dt}t|dd}|dj oAtit|}|tj o||O}nt|}nti|}t }|i |}||_ |S(s Mask an array where invalid values occur (NaNs or infs). This function is a shortcut to ``masked_where``, with `condition` = ~(np.isfinite(a)). Any pre-existing mask is conserved. Only applies to arrays with a dtype where NaNs or infs make sense (i.e. floating point types), but accepts any array_like object. See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arange(5, dtype=np.float) >>> a[2] = np.NaN >>> a[3] = np.PINF >>> a array([ 0., 1., NaN, Inf, 4.]) >>> ma.masked_invalid(a) masked_array(data = [0.0 1.0 -- -- 4.0], mask = [False False True True False], fill_value=1e+20) R+RRN( RRRR1RRRHRR RRR(RR+RRnRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRns   t_MaskedPrintOptioncBsMeZdZdZdZdZdZddZdZeZ RS(sN Handle the string used to represent missing data in a masked array. cCs||_t|_dS(s&Create the masked_print_option object.N(t_displayRt_enabled(R tdisplay((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!s cCs|iS(s.Display the string to print for masked values.(R}(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRscCs ||_dS(s*Set the string to print for masked values.N(R}(R ts((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt set_displayscCs|iS(s(Is the use of the display value enabled?(R~(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytenabledsicCs ||_dS(s$Set the enabling shrink to `shrink`.N(R~(R R[((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytenablescCs t|iS(N(RR}(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR?s( RRRR!RRRRR?t__repr__(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR|s      s--cCsj|ii}xW|D]O}||||}}|iiot|||qti|||qWdS(se Puts printoptions in result where mask is True. Private function allowing for recursion N(RRt_recursive_printoptionRR(RRtprintoptRRtcurdatatcurmask((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs  Rsemasked_%(name)s(data = %(data)s, %(nlen)s mask = %(mask)s, %(nlen)s fill_value = %(fill)s) tshortscmasked_%(name)s(data = %(data)s, %(nlen)s mask = %(mask)s, %(nlen)s fill_value = %(fill)s) tlong_flxsmasked_%(name)s(data = %(data)s, %(nlen)s mask = %(mask)s, %(nlen)s fill_value = %(fill)s, %(nlen)s dtype = %(dtype)s) t short_flxsmasked_%(name)s(data = %(data)s, %(nlen)s mask = %(mask)s, %(nlen)s fill_value = %(fill)s, %(nlen)s dtype = %(dtype)s) cCso|ii}x\|D]T}||}|iiot|||||qti|||||qWdS(sF Recursively fill `a` with `fill_value`. Private function N(RRt_recursive_filledRR(RRRRRtcurrent((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s   t _arraymethodcBs8eZdZedZdZddZdZRS(s Define a wrapper for basic array methods. Upon call, returns a masked array, where the new ``_data`` array is the output of the corresponding method called on the original ``_data``. If `onmask` is True, the new mask is the output of the method called on the initial mask. Otherwise, the new mask is just a reference to the initial mask. Attributes ---------- _onmask : bool Holds the `onmask` parameter. obj : object The object calling `_arraymethod`. Parameters ---------- funcname : str Name of the function to apply on data. onmask : bool Whether the mask must be processed also (True) or left alone (False). Default is True. Make available as `_onmask` attribute. cCs.||_||_d|_|i|_dS(N(Rt_onmaskRRtgetdocR(R tfuncnametonmask((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!G s   cCsDtt|idptt|id}|dj o|iSdS(s<Return the doc of the function (from the doc of the method).N(R1RRRRR(R tmethdoc((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRM s cCs ||_|S(N(R(R Rtobjtype((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__get__T s c Os|i}|i}|djot|}|id}n|i}|i}t|}t||||i |}|i ||i oO|i p|i |q |tj o#|i t||||q n+|i o |ii o|iotS|S(Ni(RRRRtpopRRR R1RR8R7Rt __setmask__RRRRRh( R R9tparamst methodnametinstanceRRRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$X s$       !    '%N( RRRRR!RRRR$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR* s    tMaskedIteratorcBs;eZdZdZdZdZdZdZRS(s Flat iterator object to iterate over masked arrays. A `MaskedIterator` iterator is returned by ``x.flat`` for any masked array `x`. It allows iterating over the array as if it were a 1-D array, either in a for-loop or by calling its `next` method. Iteration is done in C-contiguous style, with the last index varying the fastest. The iterator can also be indexed using basic slicing or advanced indexing. See Also -------- MaskedArray.flat : Return a flat iterator over an array. MaskedArray.flatten : Returns a flattened copy of an array. Notes ----- `MaskedIterator` is not exported by the `ma` module. Instead of instantiating a `MaskedIterator` directly, use `MaskedArray.flat`. Examples -------- >>> x = np.ma.array(arange(6).reshape(2, 3)) >>> fl = x.flat >>> type(fl) >>> for item in fl: ... print item ... 0 1 2 3 4 5 Extracting more than a single element b indexing the `MaskedIterator` returns a masked array: >>> fl[2:4] masked_array(data = [2 3], mask = False, fill_value = 999999) cCsH||_|ii|_|itjo d|_n|ii|_dS(N(RFRtflattdataiterRRRtmaskiter(R RF((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR! s   cCs|S(N((R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRg scCsc|ii|it|i}|idj o+|ii|}|i|_||_n|S(N( Rt __getitem__RR RFRRRR(R tindxRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s $  cCs>t||i|<|idj ot||i|>> x = np.ma.array([3, 2], mask=[0, 1]) >>> fl = x.flat >>> fl.next() 3 >>> fl.next() masked_array(data = --, mask = True, fill_value = 1e+20) >>> fl.next() Traceback (most recent call last): File "", line 1, in File "/home/ralf/python/numpy/numpy/ma/core.py", line 2243, in next d = self.dataiter.next() StopIteration N(RtnextRRRh(R R;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s  (RRRR!RgRRR(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRo s .  c s_fdti|}|i}|i}t|totig}|iD]}|t|i qW~}|i t}tig}t |D]}|t|i q~|_ n=tig}|D]}|t|i q~}t |djo2t|i}||d>> ndtype = [('a', int), ('b', float)] >>> a = np.array([(1, 1), (2, 2)], dtype=ndtype) >>> flatten_structured_array(a) array([[1., 1.], [2., 2.]]) c3sPxIt|D];}t|do x"|D] }|Vq0Wq |Vq WdS(s(Flattens a compound of nested iterables.RgN(titerR(titerabletelmR(tflatten_sequence(s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s   ii(RRRRRRRRRRRRJRRR(RtinishapeRR;toutt_[2]t_[3]R]((Rs3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRD s   ? << c BseZdZdZeZeZeZ dyedyee ddye dydye d Z dZ dZdydZdydydZeiie_dZd Zd Zd Zd Zed ZeZdZedededdZdZdZedeZdZdZeddddZ dZ!eddddZ"dZ#eddddZ$dZ%ede%Z&ede%Z'd Z(d!Z)d"Z*ede)de*dd#Z+d$Z,dyd%Z-ede,de-dd&Z.dyd'Z/d(Z0dydyd)Z1d*Z2d+Z3d,Z4d-Z5d.Z6d/Z7d0Z8d1Z9d2Z:d3Z;d4Z<d5Z=d6Z>d7Z?d8Z@d9ZAd:ZBd;ZCd<ZDd=ZEd>ZFd?ZGedeGdd@ZHdAZIedeIddBZJdydCZKeLdDZMdEZNeLdFZOdGZPe edHZQdIdJZRdKZSdLZTdydydMZUdydydNZVdOZWdddPdydydQZXeiXieX_dydydydRZYdydydydSZZdydydydTZ[e[Z\dydydydUZ]dydydydVZ^dydydWZ_dydydyddXZ`eai`ie`_dydydyddYZbeaibieb_ddydZZceiciec_dydyd[dyd\Zddydydyd]Zedydydyd^Zfd_d[dye dyd`ZgdydydydaZhdydbZidydydydcZjdydydyddZkeLdeZleLdfZmeLdgZneLdhZoeddiZpeLdjZqeLdkdleZreLdeZleLdmZsdydnZtdydodpZudqdrdsZvdtZwewZxduZydvZzdwZ{dydxZ|RS(zs An array class with possibly masked values. Masked values of True exclude the corresponding element from any computation. Construction:: x = MaskedArray(data, mask=nomask, dtype=None, copy=True, fill_value=None, keep_mask=True, hard_mask=False, shrink=True) Parameters ---------- data : array_like Input data. mask : sequence, optional Mask. Must be convertible to an array of booleans with the same shape as `data`. True indicates a masked (i.e. invalid) data. dtype : dtype, optional Data type of the output. If `dtype` is None, the type of the data argument (``data.dtype``) is used. If `dtype` is not None and different from ``data.dtype``, a copy is performed. copy : bool, optional Whether to copy the input data (True), or to use a reference instead. Default is False. subok : bool, optional Whether to return a subclass of `MaskedArray` if possible (True) or a plain `MaskedArray`. Default is True. ndmin : int, optional Minimum number of dimensions. Default is 0. fill_value : scalar, optional Value used to fill in the masked values when necessary. If None, a default based on the data-type is used. keep_mask : bool, optional Whether to combine `mask` with the mask of the input data, if any (True), or to use only `mask` for the output (False). Default is True. hard_mask : bool, optional Whether to use a hard mask or not. With a hard mask, masked values cannot be unmasked. Default is False. shrink : bool, optional Whether to force compression of an empty mask. Default is True. iic  s| dj otidt| } nti|d|d|dtd|} t|dt| }t |t o|i | i jo t}nt || p| ot i | |} nt i | t|} t|do't |t  o|i| _t}n| iipd}|ot| i}nt}|tjo3|p3| o t| _qti| i d|| _q%t |ttfoy:tig}|D]}|t|q~d|}Wntj o t}nX|tjo#|io|| _t| _qq%|oE| ii| _t| _t|tj o|i |i_ qq%t| _nyti|d|d|}WnVtj oJtig}|D] }|t|gt |q~d|}nX|i | i jo| i!|i!}}|djoti"|| i }nD||joti#|| i }nd d }t$|||ft}n| itjo|| _| | _nj|p|| _| | _nL|o#fd | i|nti%|| i| _t| _|djot|d d}n|dj ot&|| i| _'n| djot|d t| _(n | | _(|| _)| S(s Create a new masked array from scratch. Notes ----- A masked array can also be created by taking a .view(MaskedArray). s'The flag 'flag' is now called 'shrink'!RR+Rtndmint _baseclassRis/Mask and data not compatible: data size is %i, smask size is %i.csXxQ|iiD]C}||||}}|iio||q ||O}q WdS(s'do a|=b on each field of a, recursivelyN(RR(RRRtaftbf(t _recursive_or(s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s  Rt _hardmaskN((*RRXRYRZRRRR1R RRRRRRRRRReRRRRRRJRRRt _sharedmaskR+RIRRRRRRRbRRRR(RRRRR+RRRt keep_maskt hard_maskR\R[toptionsRRRtnames_tmdtypeRR=RtndtnmR((Rs3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__new__@ s   '# !    -     :            cCs+|d j o t|tot|}nt}h}|it|dh|it|dht|tp|it|dhntdt|dd dt|dtdt|dtdt|dtdt|d|d|d|}|i i||i i|d S( s/Copies some attributes of obj to self. t_optinfot _basedictt__dict__RRRt_isfieldRN( RRRR tupdateR1RR RR(R RRRt_dict((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR8 s$ cCs|i|t|toK|i}|io"t|dt|i|}qnt|dt}nt}||_ |i tj o6y|i|i _Wqt j ot|_ qXndS(s$Finalizes the masked array. RN( R8RRRRR1RfRRRR(R RtodtypeR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__array_finalize__ s   " c Cs|it|}|i||dj o|ii|_|\}}}ttg}|D]}|t|qa~} t i |d} | dj ot |djot t| |t } nt | |t } yt|d} Wn8tj ot|} ntj o|i} nX|i}ti|| | | tjo| tj o | } qq| | B} n|idjo | otS| |_t|_n|S(sp Special hook for ufuncs. Wraps the numpy array and sets the mask according to context. iiN((RR R8RRR+RHRgRJR2RRR@RR3RtKeyErrorRRRRRRhRR( R RtcontextRtfuncR9RRtargR=R0R;R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__array_wrap__ s8  0      cCsa|djo6|djoti|}qti||}n|djonyBt|toti||}d}nti||}Wqtj oti||}qXnti|||}t|dttj oQ|djo |i}nt|}|i i|t|_ |i |i _ nt|ddo d|_ n|S(NRR( RRRRRR1RRReRRR(R RR RsR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s,        cCsti|}|ii|it|}|i||ii}|djo|i it |_ nT|i t jo t |_ n7|i ig}|D]}||t fq~|_ |i dj ot |i ||_ n|S(s Returns a copy of the MaskedArray cast to given newtype. Returns ------- output : MaskedArray A copy of self cast to input newtype. The returned record shape matches self.shape. Examples -------- >>> x = np.ma.array([[1,2,3.1],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1.0 -- 3.1] [-- 5.0 --] [7.0 -- 9.0]] >>> print x.astype(int32) [[1 -- 3] [-- 5 --] [7 -- 9]] N(RRRtastypeRR R8RRRRWRRR(R RTRsRRtn((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR> s!    6cCs7titi|t|}|i}t|dtpot|tio;||}t |i ot |d|}q|Sq3|t j o||ot Sn|it|}|i|t|to1|idj o|i||_nt|_n|t j o|||_t|_n|S(s`x.__getitem__(y) <==> x[y] Return the item described by i, as a masked array. R7RN(RRRRR1RRRtvoidR>RRiRRhR R8RRRRRR(R RtdoutRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRe s(         c Cs5|tjo tdnt|tocti|i|||itjot |i |i |_nti|i|t |dS|i}ti |d}ti |d}t|ipd}|tjor|tjot |i |}|_n|ottg||| x[i]=y Set item described by index. If value is masked, masks those locations. s Cannot alter the masked element.NRRs.Flexible 'hard' masks are not yet supported...R+i((RhRRRRRRRRRfRRRIt__getattribute__RRRRRRRR1Rt unshare_maskRRR"RatNotImplementedErrorRgR( R RRrRt_dtypeRtnbfieldstdvaltmvalRtmindxtdindx((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR sf                  cCs|it||S(sx.__getslice__(i, j) <==> x[i:j] Return the slice described by (i, j). The use of negative indices is not supported. (Rtslice(R Rtj((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt __getslice__ scCs|it|||dS(sx.__setslice__(i, j, value) <==> x[i:j]=value Set the slice (i,j) of a to value. If value is masked, mask those locations. N(RR(R RRRr((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt __setslice__ sc Csti|d}ti|d}|tjo t}n|tjo/|tjodSt|i|}|_n|idjo%|i o||O}q||_ n8|i }t i|dt}|ipX|i idjo2t it|igt|d|}q|i|}nyyt i|d|d|}WnVtj oJt ig}|D] }|t|gt|qm~d|}nX|i o,x2|iD]}||c||Oh ssHardness of the maskcCs-|io|ii|_t|_n|S(sS Copy the mask and set the sharedmask flag to False. Whether the mask is shared between masked arrays can be seen from the `sharedmask` property. `unshare_mask` ensures the mask is not shared. A copy of the mask is only made if it was shared. See Also -------- sharedmask (RRR+R(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRl s  cCs|iS((R(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR~ ss%Share status of the mask (read-only).cCs2|i}|io|i o t|_n|S(s Reduce a mask to nomask when possible. Parameters ---------- None Returns ------- None Examples -------- >>> x = np.ma.array([[1,2 ], [3, 4]], mask=[0]*4) >>> x.mask array([[False, False], [False, False]], dtype=bool) >>> x.shrink_mask() >>> x.mask False (RR7RR(R R=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt shrink_mask s  cCs|iS((R(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR ss)Class of the underlying data (read-only).cCsti||iS(sUReturn the current data, as a view of the original underlying data. (RRR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt _get_data scCstidt|iS(s Return the data part of the masked array. DEPRECATED: You should really use ``.data`` instead. Examples -------- >>> x = np.ma.array([1, 2, 3], mask=[False, True, False]) >>> x masked_array(data = [1 -- 3], mask = [False True False], fill_value = 999999) >>> x.data array([1, 2, 3]) sUse .data instead.(RXRYRZR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytraw_data scCs t|S(s!Return a flat iterator. (R(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt _get_flat scCs|i}||(dS(s3Set a flattened version of self to value. N(R(R Rrty((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt _set_flat s sFlat version of the array.cCs0|idjotd|i|_n|iS(s Return the filling value of the masked array. Returns ------- fill_value : scalar The filling value. Examples -------- >>> for dt in [np.int32, np.int64, np.float64, np.complex128]: ... np.ma.array([0, 1], dtype=dt).get_fill_value() ... 999999 999999 1e+20 (1e+20+0j) >>> x = np.ma.array([0, 1.], fill_value=-np.inf) >>> x.get_fill_value() -inf N(RRRR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR  scCst||i|_dS(s Set the filling value of the masked array. Parameters ---------- value : scalar, optional The new filling value. Default is None, in which case a default based on the data type is used. See Also -------- ma.set_fill_value : Equivalent function. Examples -------- >>> x = np.ma.array([0, 1.], fill_value=-np.inf) >>> x.fill_value -inf >>> x.set_fill_value(np.pi) >>> x.fill_value 3.1415926535897931 Reset to default: >>> x.set_fill_value() >>> x.fill_value 1e+20 N(RRR(R Rr((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR ssFilling value.cCs~|i}|tjo|iS|djo |i}nt||i}|tjoti |S|ii o&|ii }t ||i|n|i p|iS|ii }yti|||Wnttfj o@t|dt}|it}ti|||f}nTtj oG|iioqz|oti|d|i}qz|i}nX|S(s Return a copy of self, where masked values are filled with a fill value. If `fill_value` is None, `MaskedArray.fill_value` is used instead. Parameters ---------- fill_value : scalar, optional The value to use for invalid entries. Default is None. Notes ----- The result is **not** a MaskedArray! Examples -------- >>> x = np.ma.array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999) >>> x.filled() array([1, 2, -999, 4, -999]) >>> type(x.filled()) Subclassing is preserved. This means that if the data part of the masked array is a matrix, `filled` returns a matrix: >>> x = np.ma.array(np.matrix([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]]) >>> x.filled() matrix([[ 1, 999999], [999999, 4]]) RN(RRRRRRRRuRRRR+RRRRRtnarraytobjectRR$RmRR(R RR=RR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR@ s6        cCsNti|i}|itj o(|ititi|i}n|S(s Return all the non-masked data as a 1-D array. Returns ------- data : ndarray A new `ndarray` holding the non-masked data is returned. Notes ----- The result is **not** a MaskedArray! Examples -------- >>> x = np.ma.array(np.arange(5), mask=[0]*2 + [1]*3) >>> x.compressed() array([0, 1]) >>> type(x.compressed()) (RRRRRR'RRa(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR(R s(cCs|i|i}}ti|dtdt}|i|d|d|it|}|i||t j o|i|d||_n|S(sI Return `a` where condition is ``True``. If condition is a `MaskedArray`, missing values are considered as ``False``. Parameters ---------- condition : var Boolean 1-d array selecting which entries to return. If len(condition) is less than the size of a along the axis, then output is truncated to length of condition array. axis : {None, int}, optional Axis along which the operation must be performed. out : {None, ndarray}, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary. Returns ------- result : MaskedArray A :class:`MaskedArray` object. Notes ----- Please note the difference with :meth:`compressed` ! The output of :meth:`compress` has a mask, the output of :meth:`compressed` does not. Examples -------- >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1 -- 3] [-- 5 --] [7 -- 9]] >>> x.compress([1, 0, 1]) masked_array(data = [1 3], mask = [False False], fill_value=999999) >>> x.compress([1, 0, 1], axis=1) masked_array(data = [[1 3] [-- --] [7 9]], mask = [[False False] [ True True] [False False]], fill_value=999999) R+RRJR( RRRRRR'RR R8R(R RnRJRRRt_new((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR'n s8*  cCstiopt}|tjo t|S|i}|tjo |i}q|idjo|ii o~|i t t |if}|i oBti|iidt}ti|||tt|St|iSq |o t|St|iSn|ii }|djo |iid}|||Raise self to the power other, masking the potential NaNs/Infs(R(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__pow__DscCst|}|itjoI|tj o8|io+t|i|i|_|i|7_qn!|tj o|i|7_nti|i t i |idt ||S(sAdd other to self in-place.i( RIRRRRfRRRt__iadd__RRRRH(R RR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRHs  +cCst|}|itjoI|tj o8|io+t|i|i|_|i|7_qn!|tj o|i|7_nti|i t i |idt ||S(s"Subtract other from self in-place.i( RIRRRRfRRRt__isub__RRRRH(R RR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRUs  +cCst|}|itjoI|tj o8|io+t|i|i|_|i|7_qn!|tj o|i|7_nti|i t i |idt ||S(s Multiply self by other in-place.i( RIRRRRfRRRt__imul__RRRRH(R RR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR as  +cCst|}ti|i|}t|}t||}|io,tti \}}ti |||}n|i |O_ t i |iti |i d||S(sDivide self by other in-place.i(RHR'R$RRIRgRR3RR5RRRt__idiv__(R Rt other_datatdom_maskt other_masktnew_maskRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR ms   %cCst|}t|}ti|iti|id|titi |i}|i oI|it j o|i|O_n ||_ti |i||i nt||}t|i||_|S(s(Raise self to the power other, in place.i(RHRIRt__ipow__RRRRRaRRRRRRg(R RR R RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR|s  %  cCsO|idjotdn |iotidtiSt|iS(sConvert to float.is7Only length-1 arrays can be converted to Python scalarss,Warning: converting a masked element to nan.( RRRRXRYRtnanRR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt __float__s   cCsG|idjotdn|io tdnt|iS(sConvert to int.is7Only length-1 arrays can be converted to Python scalarss.Cannot convert masked element to a Python int.(RRRRRR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt__int__s   cCs/|iiit|}|i|i|S(s Return the imaginary part of the masked array. The returned array is a view on the imaginary part of the `MaskedArray` whose `get_imag` method is called. Parameters ---------- None Returns ------- result : MaskedArray The imaginary part of the masked array. See Also -------- get_real, real, imag Examples -------- >>> x = np.ma.array([1+1.j, -2j, 3.45+1.6j], mask=[False, True, False]) >>> x.get_imag() masked_array(data = [1.0 -- 1.6], mask = [False True False], fill_value = 1e+20) (RtimagRR RR(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytget_imagssImaginary part.cCs/|iiit|}|i|i|S(s Return the real part of the masked array. The returned array is a view on the real part of the `MaskedArray` whose `get_real` method is called. Parameters ---------- None Returns ------- result : MaskedArray The real part of the masked array. See Also -------- get_imag, real, imag Examples -------- >>> x = np.ma.array([1+1.j, -2j, 3.45+1.6j], mask=[False, True, False]) >>> x.get_real() masked_array(data = [1.0 -- 3.45], mask = [False True False], fill_value = 1e+20) (RtrealRR RR(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytget_realss Real partc Cs|i}|i}t|}|tjoo|djodS|djo |dS|djo|iS||}t|}||=ti||Snti||}|i t i |}|djo ||St ||SdS(s Count the non-masked elements of the array along the given axis. Parameters ---------- axis : int, optional Axis along which to count the non-masked elements. If `axis` is `None`, all non-masked elements are counted. Returns ------- result : int or ndarray If `axis` is `None`, an integer count is returned. When `axis` is not `None`, an array with shape determined by the lengths of the remaining axes, is returned. See Also -------- count_masked : Count masked elements in array or along a given axis. Examples -------- >>> import numpy.ma as ma >>> a = ma.arange(6).reshape((2, 3)) >>> a[1, :] = ma.masked >>> a masked_array(data = [[0 1 2] [-- -- --]], mask = [[False False False] [ True True True]], fill_value = 999999) >>> a.count() 3 When the `axis` keyword is specified an array of appropriate size is returned. >>> a.count(axis=0) array([1, 1, 1]) >>> a.count(axis=1) array([3, 0]) iiN( RRRRRRRRRRRRR( R RJR=RtlsRRLtn1tn2((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR.s&.            tflattencCspti|iit|}|i||itj o%ti|ii|i |_n t|_|S(s Returns a 1D version of self, as a view. Returns ------- MaskedArray Output view is of shape ``(self.size,)`` (or ``(np.ma.product(self.shape),)``). Examples -------- >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1 -- 3] [-- 5 --] [7 -- 9]] >>> print x.ravel() [1 -- 3 -- 5 -- 7 -- 9] ( RRRRR R8RRRR(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR+s ! % RcOs|id|idd|ii||it|}|i||i}|tj o|i|||_n|S(s Give a new shape to the array without changing its data. Returns a masked array containing the same data, but with a new shape. The result is a view on the original array; if this is not possible, a ValueError is raised. Parameters ---------- shape : int or tuple of ints The new shape should be compatible with the original shape. If an integer is supplied, then the result will be a 1-D array of that length. order : {'C', 'F'}, optional Determines whether the array data should be viewed as in C (row-major) or FORTRAN (column-major) order. Returns ------- reshaped_array : array A new view on the array. See Also -------- reshape : Equivalent function in the masked array module. numpy.ndarray.reshape : Equivalent method on ndarray object. numpy.reshape : Equivalent function in the NumPy module. Notes ----- The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use ``a.shape = s`` Examples -------- >>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1]) >>> print x [[-- 2] [3 --]] >>> x = x.reshape((4,1)) >>> print x [[--] [2] [3] [--]] tordertC( RRRRRR R8RR(R RR:RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRJs0$   cCsd}t|dS(sv .. warning:: This method does nothing, except raise a ValueError exception. A masked array does not own its data and therefore cannot safely be resized in place. Use the `numpy.ma.resize` function instead. This method is difficult to implement safely and may be deprecated in future releases of NumPy. soA masked array does not own its data and therefore cannot be resized. Use the numpy.ma.resize function instead.N(R(R R]trefcheckRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRstraisecCs1|i}|ioq|itj oa|i|}t|dt}t|dtdt}|i|i||}||}n|ii ||d||tjot |}nk|i }t |tjo|i |td|n|i ||id|t |dtdt}||_dS(s Set storage-indexed locations to corresponding values. Sets self._data.flat[n] = values[n] for each n in indices. If `values` is shorter than `indices` then it will repeat. If `values` has some masked values, the initial mask is updated in consequence, else the corresponding values are unmasked. Parameters ---------- indices : 1-D array_like Target indices, interpreted as integers. values : array_like Values to place in self._data copy at target indices. mode : {'raise', 'wrap', 'clip'}, optional Specifies how out-of-bounds indices will behave. 'raise' : raise an error. 'wrap' : wrap around. 'clip' : clip to the range. Notes ----- `values` can be a scalar or length 1 array. Examples -------- >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1 -- 3] [-- 5 --] [7 -- 9]] >>> x.put([0,4,8],[10,20,30]) >>> print x [[10 -- 3] [-- 20 --] [7 -- 30]] >>> x.put(4,999) >>> print x [[10 -- 3] [-- 999 --] [7 -- 30]] R+RtmodeR[N( RRRRRRRRRRRIR+Rd(R RQtvaluesRR=R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs"-     cCs@|itjo|iittfS|ii|iiifS(s Return the addresses of the data and mask areas. Parameters ---------- None Examples -------- >>> x = np.ma.array([1, 2, 3], mask=[0, 1, 1]) >>> x.ids() (166670640, 166659832) If the array has no mask, the address of `nomask` is returned. This address is typically not close to the data in memory: >>> x = np.ma.array([1, 2, 3]) >>> x.ids() (166691080, 3083169284L) (RRtctypesRtid(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRPscCs |idS(s Return a boolean indicating whether the data is contiguous. Parameters ---------- None Examples -------- >>> x = np.ma.array([1, 2, 3]) >>> x.iscontiguous() True `iscontiguous` returns one of the flags of the masked array: >>> x.flags C_CONTIGUOUS : True F_CONTIGUOUS : True OWNDATA : False WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False t CONTIGUOUS(tflags(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt iscontiguousscCst|i|}|djoV|itid|it|}|io|i |n |ot S|S|itid|d|t |t o&|ip|o|i |qn|S(s Check if all of the elements of `a` are true. Performs a :func:`logical_and` over the given axis and returns the result. Masked values are considered as True during computation. For convenience, the output array is masked where ALL the values along the current axis are masked: if the output would have been a scalar and that all the values are masked, then the output is `masked`. Parameters ---------- axis : {None, integer} Axis to perform the operation over. If None, perform over flattened array. out : {None, array}, optional Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output. See Also -------- all : equivalent function Examples -------- >>> np.ma.array([1,2,3]).all() True >>> a = np.ma.array([1,2,3], mask=True) >>> (a.all() is np.ma.masked) True RJRN( RlRRR@RRRR R7RRhRR(R RJRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs  * cCst|i|}|djo[|itid|it|}|io|i |n|o t }n|S|itid|d|t |t o&|ip|o|i |qn|S(s Check if any of the elements of `a` are true. Performs a logical_or over the given axis and returns the result. Masked values are considered as False during computation. Parameters ---------- axis : {None, integer} Axis to perform the operation over. If None, perform over flattened array and return a scalar. out : {None, array}, optional Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output. See Also -------- any : equivalent function RJRN( RlRRR@RRRR R7RRhRR(R RJRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRFs *  cCst|iddtiS(s Return the indices of unmasked elements that are not zero. Returns a tuple of arrays, one for each dimension, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values can be obtained with:: a[a.nonzero()] To group the indices by element, rather than dimension, use instead:: np.transpose(a.nonzero()) The result of this is always a 2d array, with a row for each non-zero element. Parameters ---------- None Returns ------- tuple_of_arrays : tuple Indices of elements that are non-zero. See Also -------- numpy.nonzero : Function operating on ndarrays. flatnonzero : Return indices that are non-zero in the flattened version of the input array. ndarray.nonzero : Equivalent ndarray method. Examples -------- >>> import numpy.ma as ma >>> x = ma.array(np.eye(3)) >>> x masked_array(data = [[ 1. 0. 0.] [ 0. 1. 0.] [ 0. 0. 1.]], mask = False, fill_value=1e+20) >>> x.nonzero() (array([0, 1, 2]), array([0, 1, 2])) Masked elements are ignored. >>> x[1, 1] = ma.masked >>> x masked_array(data = [[1.0 0.0 0.0] [0.0 -- 0.0] [0.0 0.0 1.0]], mask = [[False False False] [False True False] [False False False]], fill_value=1e+20) >>> x.nonzero() (array([0, 2]), array([0, 2])) Indices can also be grouped by element. >>> np.transpose(x.nonzero()) array([[0, 0], [2, 2]]) A common use for ``nonzero`` is to find the indices of an array, where a condition is True. Given an array `a`, the condition `a` > 3 is a boolean array and since False is interpreted as 0, ma.nonzero(a > 3) yields the indices of the `a` where the condition is true. >>> a = ma.array([[1,2,3],[4,5,6],[7,8,9]]) >>> a > 3 masked_array(data = [[False False False] [ True True True] [ True True True]], mask = False, fill_value=999999) >>> ma.nonzero(a > 3) (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) The ``nonzero`` method of the condition array can also be called. >>> (a > 3).nonzero() (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) iR+(RR@RR(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRjsaic Cs|i}|tjo;tt|id|d|d|d|}|i|S|id|d|d|}|i|ididdd|SdS(s8 (this docstring should be overwritten) toffsettaxis1taxis2RiRJN( RRtsuperRRRR3R@RR( R R&R'R(RRR=RtD((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs  c Csti|d}t||}|djos|idi|d|}t|dd}|o&|it|}|i |n|o t }n|S|idi|d|d|}t |t oFt|dt }|t jot|i}|_n||_n|S(s Return the sum of the array elements over the given axis. Masked elements are set to 0 internally. Parameters ---------- axis : {None, -1, int}, optional Axis along which the sum is computed. The default (`axis` = None) is to compute over the flattened array. dtype : {None, dtype}, optional Determines the type of the returned array and of the accumulator where the elements are summed. If dtype has the value None and the type of a is an integer type of precision less than the default platform integer, then the default platform integer precision is used. Otherwise, the dtype is the same as that of a. out : {None, 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 will be cast if necessary. Returns ------- sum_along_axis : MaskedArray or scalar An array with the same shape as self, with the specified axis removed. If self is a 0-d array, or if `axis` is None, a scalar is returned. If an output array is specified, a reference to `out` is returned. Examples -------- >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1 -- 3] [-- 5 --] [7 -- 9]] >>> print x.sum() 25 >>> print x.sum(axis=1) [4 5 16] >>> print x.sum(axis=0) [8 5 12] >>> print type(x.sum(axis=0, dtype=np.int64)[0]) RiRR7RN(RRRlRR@RR1RR RRhRRRRfRRR( R RJRRRR`Rtrndimtoutmask((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs$.  $  cCs|idid|d|d|}|dj o)t|to|i|in|S|it|}|i|i |S(sg Return the cumulative sum of the elements along the given axis. The cumulative sum is calculated over the flattened array by default, otherwise over the specified axis. Masked values are set to 0 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Parameters ---------- axis : {None, -1, int}, optional Axis along which the sum is computed. The default (`axis` = None) is to compute over the flattened array. `axis` may be negative, in which case it counts from the last to the first axis. dtype : {None, dtype}, optional Type of the returned array and of the accumulator in which the elements are summed. If `dtype` is not specified, it defaults to the dtype of `a`, unless `a` has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used. 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 will be cast if necessary. Returns ------- cumsum : ndarray. A new array holding the result is returned unless ``out`` is specified, in which case a reference to ``out`` is returned. Notes ----- The mask is lost if `out` is not a valid :class:`MaskedArray` ! Arithmetic is modular when using integer types, and no error is raised on overflow. Examples -------- >>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0]) >>> print marr.cumsum() [0 1 3 -- -- -- 9 16 24 33] iRJRRN( R@R0RRRRRRR R(R RJRRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR0!s/' c Csti|d}t||}|djos|idi|d|}t|dd}|o&|it|}|i |n|o t }n|S|idi|d|d|}t |t oFt|dt }|t jot|i}|_n||_n|S(s Return the product of the array elements over the given axis. Masked elements are set to 1 internally for computation. Parameters ---------- axis : {None, int}, optional Axis over which the product is taken. If None is used, then the product is over all the array elements. dtype : {None, dtype}, optional Determines the type of the returned array and of the accumulator where the elements are multiplied. If ``dtype`` has the value ``None`` and the type of a is an integer type of precision less than the default platform integer, then the default platform integer precision is used. Otherwise, the dtype is the same as that of a. out : {None, array}, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary. Returns ------- product_along_axis : {array, scalar}, see dtype parameter above. Returns an array whose shape is the same as a with the specified axis removed. Returns a 0d array when a is 1d or axis=None. Returns a reference to the specified output array if specified. See Also -------- prod : equivalent function Notes ----- Arithmetic is modular when using integer types, and no error is raised on overflow. Examples -------- >>> np.prod([1.,2.]) 2.0 >>> np.prod([1.,2.], dtype=np.int32) 2 >>> np.prod([[1.,2.],[3.,4.]]) 24.0 >>> np.prod([[1.,2.],[3.,4.]], axis=1) array([ 2., 12.]) RiRR7iRN(RRRlRR@RR1RR RRhRRRRfRRR( R RJRRRR`RR+R,((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRZs$1  $  cCs|idid|d|d|}|dj o)t|to|i|in|S|it|}|i|i|S(ss Return the cumulative product of the elements along the given axis. The cumulative product is taken over the flattened array by default, otherwise over the specified axis. Masked values are set to 1 internally during the computation. However, their position is saved, and the result will be masked at the same locations. Parameters ---------- axis : {None, -1, int}, optional Axis along which the product is computed. The default (`axis` = None) is to compute over the flattened array. dtype : {None, dtype}, optional Determines the type of the returned array and of the accumulator where the elements are multiplied. If ``dtype`` has the value ``None`` and the type of ``a`` is an integer type of precision less than the default platform integer, then the default platform integer precision is used. Otherwise, the dtype is the same as that of ``a``. 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 will be cast if necessary. Returns ------- cumprod : ndarray A new array holding the result is returned unless out is specified, in which case a reference to out is returned. Notes ----- The mask is lost if `out` is not a valid MaskedArray ! Arithmetic is modular when using integer types, and no error is raised on overflow. iRJRRN( R@R/RRRRRRR (R RJRRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR/s(' cCs|itjo%tt|id|d|}n9|id|d|}|id|}|d|}|dj op||_t |toRt |dt}|tjot |i }|_nt |dt|_n|S|S(s Returns the average of the array elements. Masked entries are ignored. The average is taken over the flattened array by default, otherwise over the specified axis. Refer to `numpy.mean` for the full documentation. Parameters ---------- a : array_like Array containing numbers whose mean is desired. If `a` is not an array, a conversion is attempted. axis : int, optional Axis along which the means are computed. The default is to compute the mean of the flattened array. dtype : dtype, optional Type to use in computing the mean. For integer inputs, the default is float64; for floating point, inputs it is the same as the input dtype. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary. Returns ------- mean : ndarray, see dtype parameter above If `out=None`, returns a new array containing the mean values, otherwise a reference to the output array is returned. See Also -------- numpy.ma.mean : Equivalent function. numpy.mean : Equivalent function on non-masked arrays. numpy.ma.average: Weighted average. Examples -------- >>> a = np.ma.array([1,2,3], mask=[False, False, True]) >>> a masked_array(data = [1 2 --], mask = [False False True], fill_value = 999999) >>> a.mean() 1.5 RJRg?RN( RRR)RR{RR.RRRR1RfR(R RJRRRtdsumtcntR,((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR{s0%   cCs7|i||}|p ||S|t||SdS(s Compute the anomalies (deviations from the arithmetic mean) along the given axis. Returns an array of anomalies, with the same shape as the input and where the arithmetic mean is computed along the given axis. Parameters ---------- axis : int, optional Axis over which the anomalies are taken. The default is to use the mean of the flattened array as reference. dtype : dtype, optional Type to use in computing the variance. For arrays of integer type the default is float32; for arrays of float types it is the same as the array type. See Also -------- mean : Compute the mean of the array. Examples -------- >>> a = np.ma.array([1,2,3]) >>> a.anom() masked_array(data = [-1. 0. 1.], mask = False, fill_value = 1e+20) N(R{R<(R RJRR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs c Cs|itjo&|iid|d|d|d|S|id||}|id|d|}t|oti|d}n ||9}t |i ||i t |}|i o5t|ii|||j|_|i|nt|dtort}|d j o[t|to|itn6|iidjod}t|n ti|_|Sn|d j o2||_t|to|i|in|S|S( RRJRRtddofiRtbius>Masked data information would be lost in one or more location.N( RRRRR.RRR"RR5RRR R7RgRR8R1RRhRRRRRRRRRRRR( R RJRRR/R.tdanomtdvarR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR9s6&  ' $     c Csa|id|d|d|d|}|tj o,t|}|dj o|dC}|Sn|S(RRJRRR/g?N(RRhRR(R RJRRR/R2((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRcs$     cCs}|iid|d|it|}|i|_|i||djo|St|to|i |in|S(s Return an array rounded a to the given number of decimals. Refer to `numpy.around` for full documentation. See Also -------- numpy.around : equivalent function tdecimalsRN( RRRR RR8RRRR(R R3RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRos *   t quicksortcCsQ|djot|}n|i|it}|id|d|d|S(s6 Return an ndarray of indices that sort the array along the specified axis. Masked values are filled beforehand to `fill_value`. Parameters ---------- axis : int, optional Axis along which to sort. The default is -1 (last axis). If None, the flattened array is used. fill_value : var, optional Value used to fill the array before sorting. The default is the `fill_value` attribute of the input array. kind : {'quicksort', 'mergesort', 'heapsort'}, optional Sorting algorithm. order : list, optional When `a` is an array with fields defined, this argument specifies which fields to compare first, second, etc. Not all fields need be specified. Returns ------- index_array : ndarray, int Array of indices that sort `a` along the specified axis. In other words, ``a[index_array]`` yields a sorted `a`. See Also -------- sort : Describes sorting algorithms used. lexsort : Indirect stable sort with multiple keys. ndarray.sort : Inplace sort. Notes ----- See `sort` for notes on the different sorting algorithms. Examples -------- >>> a = np.ma.array([3,2,1], mask=[False, False, True]) >>> a masked_array(data = [3 2 --], mask = [False False True], fill_value = 999999) >>> a.argsort() array([1, 0, 2]) RJRRN(RR1R@RRR(R RJRRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs1 cCsH|djot|}n|i|it}|i|d|S(s Return array of indices to the minimum values along the given axis. Parameters ---------- axis : {None, integer} If None, the index is into the flattened array, otherwise along the specified axis fill_value : {var}, optional Value used to fill in the masked values. If None, the output of minimum_fill_value(self._data) is used instead. out : {None, array}, optional Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output. Returns ------- {ndarray, scalar} If multi-dimension input, returns a new ndarray of indices to the minimum values along the given axis. Otherwise, returns a scalar of index to the minimum values along the given axis. Examples -------- >>> x = np.ma.array(arange(4), mask=[1,1,0,0]) >>> x.shape = (2,2) >>> print x [[-- --] [2 3]] >>> print x.argmin(axis=0, fill_value=-1) [0 0] >>> print x.argmin(axis=0, fill_value=9) [1 1] RN(RR~R@RRR(R RJRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs$ cCsK|djot|i}n|i|it}|i|d|S(s Returns array of indices of the maximum values along the given axis. Masked values are treated as if they had the value fill_value. Parameters ---------- axis : {None, integer} If None, the index is into the flattened array, otherwise along the specified axis fill_value : {var}, optional Value used to fill in the masked values. If None, the output of maximum_fill_value(self._data) is used instead. out : {None, array}, optional Array into which the result can be placed. Its type is preserved and it must be of the right shape to hold the output. Returns ------- index_array : {integer_array} Examples -------- >>> a = np.arange(6).reshape(2,3) >>> a.argmax() 5 >>> a.argmax(0) array([1, 1, 1]) >>> a.argmax(1) array([2, 2]) RN(RRzRR@RRR(R RJRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs ic Cs|itjo#ti|d|d|d|n|djo'|ot|}qmt|}n|}ti|i }|i |i d|d|d|||<|i }|i|i } |i|i } | |i_ | |i_ dS(s Return a sorted copy of an array. Parameters ---------- a : array_like Array to be sorted. axis : int or None, optional Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis. kind : {'quicksort', 'mergesort', 'heapsort'}, optional Sorting algorithm. Default is 'quicksort'. order : list, optional When `a` is a structured array, this argument specifies which fields to compare first, second, and so on. This list does not need to include all of the fields. endwith : {True, False}, optional Whether missing values (if any) should be forced in the upper indices (at the end of the array) (True) or lower indices (at the beginning). fill_value : {var} Value used to fill in the masked values. If None, use the the output of minimum_fill_value(). Returns ------- sorted_array : ndarray Array of the same type and shape as `a`. See Also -------- ndarray.sort : Method to sort an array in-place. argsort : Indirect sort. lexsort : Indirect stable sort on multiple keys. searchsorted : Find elements in a sorted array. Notes ----- The various sorting algorithms are characterized by their average speed, worst case performance, work space size, and whether they are stable. A stable sort keeps items with the same key in the same relative order. The three available algorithms have the following properties: =========== ======= ============= ============ ======= kind speed worst case work space stable =========== ======= ============= ============ ======= 'quicksort' 1 O(n^2) 0 no 'mergesort' 2 O(n*log(n)) ~n/2 yes 'heapsort' 3 O(n*log(n)) 0 no =========== ======= ============= ============ ======= All the sort algorithms make temporary copies of the data when sorting along any but the last axis. Consequently, sorting along the last axis is faster and uses less space than sorting along any other axis. Examples -------- >>> a = np.array([[1,4],[3,1]]) >>> np.sort(a) # sort along the last axis array([[1, 4], [1, 3]]) >>> np.sort(a, axis=None) # sort the flattened array array([1, 1, 3, 4]) >>> np.sort(a, axis=0) # sort along the first axis array([[1, 1], [3, 4]]) Use the `order` keyword to specify a field to use when sorting a structured array: >>> dtype = [('name', 'S10'), ('height', float), ('age', int)] >>> values = [('Arthur', 1.8, 41), ('Lancelot', 1.9, 38), ... ('Galahad', 1.7, 38)] >>> a = np.array(values, dtype=dtype) # create a structured array >>> np.sort(a, order='height') # doctest: +SKIP array([('Galahad', 1.7, 38), ('Arthur', 1.8, 41), ('Lancelot', 1.8999999999999999, 38)], dtype=[('name', '|S10'), ('height', '>> np.sort(a, order=['age', 'height']) # doctest: +SKIP array([('Galahad', 1.7, 38), ('Lancelot', 1.8999999999999999, 38), ('Arthur', 1.8, 41)], dtype=[('name', '|S10'), ('height', 'Masked data information would be lost in one or more location.N(RRRlRR~R@R|RR R7RRRRRhRRR1RRfRRRRRRR( R RJRRRR`RR,R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR||s0  0    !  cCs,|djo t|Sti||SdS(s Return the array minimum along the specified axis. Parameters ---------- axis : int, optional The axis along which to find the minima. Default is None, in which case the minimum value in the whole array is returned. Returns ------- min : scalar or MaskedArray If `axis` is None, the result is a scalar. Otherwise, if `axis` is given and the array is at least 2-D, the result is a masked array with dimension one smaller than the array on which `mini` is called. Examples -------- >>> x = np.ma.array(np.arange(6), mask=[0 ,1, 0, 0, 0 ,1]).reshape(3, 2) >>> print x [[0 --] [2 3] [4 --]] >>> x.mini() 0 >>> x.mini(axis=0) masked_array(data = [0 3], mask = [False False], fill_value = 999999) >>> print x.mini(axis=1) [0 2 4] N(RR}RH(R RJ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytminis"  c Csti|d}t||}|djot|}n|djo|i|id|d|it|}|i o5|i ||i ot i |||i qn|o t}n|S|i|id|d|}t|toFt|dt}|tjot|i}|_n||_n@|iidjod}t|nt i ||t i|S(si Return the maximum along a given axis. Parameters ---------- axis : {None, int}, optional Axis along which to operate. By default, ``axis`` is None and the flattened input is used. out : array_like, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. fill_value : {var}, optional Value used to fill in the masked values. If None, use the output of maximum_fill_value(). Returns ------- amax : array_like New array holding the result. If ``out`` was specified, ``out`` is returned. See Also -------- maximum_fill_value Returns the maximum filling value for a given datatype. RRJRR0s>Masked data information would be lost in one or more location.N(RRRlRRzR@RxRR R7RRRRRhRRR1RRfRRRRRRR( R RJRRRR`RR,R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRxs0  0    !  cCs|djo9|id|d|}||id|d|8}|S|id|d|d||_||id|d|8}|S(s3 Return (maximum - minimum) along the the given dimension (i.e. peak-to-peak value). Parameters ---------- axis : {None, int}, optional Axis along which to find the peaks. If None (default) the flattened array is used. out : {None, array_like}, 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 will be cast if necessary. fill_value : {var}, optional Value used to fill in the masked values. Returns ------- ptp : ndarray. A new array holding the result, unless ``out`` was specified, in which case a reference to ``out`` is returned. RJRRN(RRxR|R(R RJRRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs !R+R3RRcCs |iS((R(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRAsRR%RRc Css|dj o|i|iS|ii}|i}|tjo|S|i}t|i}|djotdg|S|djol|i di}|otdg|}nd}g}|D]} |t i || |q~nrxnt g} |i D]} | | iq~ D]9} |} x| d D]} | | } qIWd| | d>> x = np.ma.array([[1,2,3], [4,5,6], [7,8,9]], mask=[0] + [1,0]*4) >>> x.tolist() [[1, None, 3], [None, 5, None], [7, None, 9]] >>> x.tolist(-999) [[1, -999, 3], [-999, 5, -999], [7, -999, 9]] iiiN( RR@RRRR7RRRRtoperatortsetitemR( R RRRtnbdimst dtypesizet maskedidxtnodataRRRR7ttmp((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRGs0      24 RcCs|i|id|S(sS Return the array data as a string containing the raw bytes in the array. The array is filled with a fill value before the string conversion. Parameters ---------- fill_value : scalar, optional Value used to fill in the masked values. Deafult is None, in which case `MaskedArray.fill_value` is used. order : {'C','F','A'}, optional Order of the data item in the copy. Default is 'C'. - 'C' -- C order (row major). - 'F' -- Fortran order (column major). - 'A' -- Any, current order of array. - None -- Same as 'A'. See Also -------- ndarray.tostring tolist, tofile Notes ----- As for `ndarray.tostring`, information about the shape, dtype, etc., but also about `fill_value`, will be lost. Examples -------- >>> x = np.ma.array(np.array([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]]) >>> x.tostring() '\x01\x00\x00\x00?B\x0f\x00?B\x0f\x00\x04\x00\x00\x00' R(R@ttostring(R RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRC|s$Rs%scCstddS(s Save a masked array to a file in binary format. .. warning:: This function is not implemented yet. Raises ------ NotImplementedError When `tofile` is called. sNot implemented yet, sorry...N(R(R tfidtseptformat((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyttofiles cCs|i}|i}|djot|i|}n|ii}tid|idd|fd|fg}|i|d<|i|d<|S(sy Transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields: * the ``_data`` field stores the ``_data`` part of the array. * the ``_mask`` field stores the ``_mask`` part of the array. Parameters ---------- None Returns ------- record : ndarray A new flexible-type `ndarray` with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape. Notes ----- A side-effect of transforming a masked array into a flexible `ndarray` is that meta information (``fill_value``, ...) will be lost. Examples -------- >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4) >>> print x [[1 -- 3] [-- 5 --] [7 -- 9]] >>> print x.toflex() [[(1, False) (2, True) (3, False)] [(4, True) (5, False) (6, True)] [(7, False) (8, True) (9, False)]] RRRRN(RRRRfRRRR(R tddtypeRRtrecord((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyttoflexs'      cCsYd|ii}d|i|i|ii|ii|t|i||if}|S(sWReturn the internal state of the masked array, for pickling purposes. tCFi(R$tfncRRRRCRJR(R tcftstate((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt __getstate__s  c Csf|\}}}}}}}ti|||||f|ii|t|||f||_dS(skRestore the internal state of the masked array, for pickling purposes. ``state`` is typically the output of the ``__getstate__`` output, and is a 5-tuple: - class name - a tuple giving the shape of the data - a typecode for the data - a binary string for the data - a binary string for the mask. N(Rt __setstate__RReR( R RNtvertshpttyptisftrawtmsktflv((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRPs "cCs%t|i|iddf|ifS(s6Return a 3-tuple for pickling a MaskedArray. iR(i(t_mareconstructt __class__RRO(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyt __reduce__ scCsddkl}tit||dt}|djo h}n||t|Rjt baseshapetbasetypeRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRXscCs t|tS(s Test whether input is an instance of MaskedArray. This function returns True if `x` is an instance of MaskedArray and returns False otherwise. Any object is accepted as input. Parameters ---------- x : object Object to test. Returns ------- result : bool True if `x` is a MaskedArray. See Also -------- isMA : Alias to isMaskedArray. isarray : Alias to isMaskedArray. Examples -------- >>> import numpy.ma as ma >>> a = np.eye(3, 3) >>> a array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) >>> m = ma.masked_values(a, 0) >>> m masked_array(data = [[1.0 -- --] [-- 1.0 --] [-- -- 1.0]], mask = [[False True True] [ True False True] [ True True False]], fill_value=0.0) >>> ma.isMaskedArray(a) False >>> ma.isMaskedArray(m) True >>> ma.isMaskedArray([0, 1, 2]) False (RR(R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRU)s1RRc Cs@t|d|d|d|d| d|d|d|d| d | S( s.array(data, dtype=None, copy=False, order=False, mask=nomask, fill_value=None, keep_mask=True, hard_mask=False, shrink=True, subok=True, ndmin=0) Acts as shortcut to MaskedArray, with options in a different order for convenience. And backwards compatibility... RRR+RRRRRR[(R( RRR+RRRRRR[RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRds ! cCs4t|}|tjotS|iotStS(s Determine whether input has masked values. Accepts any object as input, but always returns False unless the input is a MaskedArray containing masked values. Parameters ---------- x : array_like Array to check for masked values. Returns ------- result : bool True if `x` is a MaskedArray with masked values, False otherwise. Examples -------- >>> import numpy.ma as ma >>> x = ma.masked_equal([0, 1, 0, 2, 3], 0) >>> x masked_array(data = [-- 1 -- 2 3], mask = [ True False True False False], fill_value=999999) >>> ma.is_masked(x) True >>> x = ma.masked_equal([0, 1, 0, 2, 3], 42) >>> x masked_array(data = [0 1 0 2 3], mask = False, fill_value=999999) >>> ma.is_masked(x) False Always returns False if `x` isn't a MaskedArray. >>> x = [False, True, False] >>> ma.is_masked(x) False >>> x = 'a string' >>> ma.is_masked(x) False (RIRRRR(R#R=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRWvs -   t_extrema_operationcBs/eZdZddZddZdZRS(s Generic class for maximum/minimum functions. .. note:: This is the base class for `_maximum_operation` and `_minimum_operation`. cCs7|djo|i|St|i||||S(sExecutes the call behavior.N(RRHRtcompare(R RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$s cCst|dtdt}t|}|dj oh|d6}n0h}|i}|tj o|i}n|tjo|ii||}n|i |i |i t |}|ii||}t ii||}t|do ||_n|o t}n|S(s#Reduce target along the given axis.R+RRJRN(RRRRIRRRtufuncRHR@tfill_value_funcRR R"R`RRRh(R RIRJR=tkargsRL((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRHs$     '  cCst|}t|}|tjo|tjo t}n+t|}t|}ti||}|iit|t|}t|tp|i t}n||_ |S(s<Return the function applied to the outer product of a and b.( RIRRJRbRRqR@RRRR(R RRRFRGR=R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs     ! N(RRRRR$RHR(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRos  t_minimum_operationcBseZdZdZRS(sObject to calculate minimacCs+ti|_t|_t|_t|_dS(sVminimum(a, b) or minimum(a) In one argument case, returns the scalar minimum. N( R"R}RqR tafuncRZRpR~Rr(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!s   (RRRR!(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRtst_maximum_operationcBseZdZdZRS(sObject to calculate maximacCs+ti|_t|_t|_t|_dS(s`maximum(a, b) or maximum(a) In one argument case returns the scalar maximum. N( R"RyRqR RuRKRpRzRr(R ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!s   (RRRR!(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRvsc Cs_y |id|d|d|SWn8ttfj o&t|id|d|d|SXdS(NRJRR(R|RRR(RRJRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR|s c Cs_y |id|d|d|SWn8ttfj o&t|id|d|d|SXdS(NRJRR(RxRRR(RRJRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRxs c Cs\y|i|d|d|SWn8ttfj o&t|id|d|d|SXdS(s+a.ptp(axis=None) = a.max(axis)-a.min(axis)RRRJN(RRRR(RRJRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRst _frommethodcBs)eZdZdZdZdZRS(s Define functions from existing MaskedArray methods. Parameters ---------- methodname : str Name of the method to transform. cCs||_|i|_dS(N(RRR(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!'s cCsptt|idptt|id}|it|}|dj o!d|t|ddf}|SdS(s<Return the doc of the function (from the doc of the method).s %s %sRN(R1RRRRR(R tmetht signatureR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR+s  cOs|i}t||d}|dj o|||Stt|d}|dj o|t|||Stt|}||||S(N(RR1RRR(R RR9Rt method_nametmethod((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$4s   (RRRR!RR$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRws   Rc Cs[|dj o tdnt|}t|}t||}t|}t|}t|tot|}nt}ti ||t i ||i |} | i |titi| i t} |tj o&| iptS|| O}|| _n| io@| iptS| itjo | | _n| i| i|  Returns element-wise base array raised to power from second array. This is the masked array version of `numpy.power`. For details see `numpy.power`. See Also -------- numpy.power Notes ----- The *out* argument to `numpy.power` is not supported, `third` has to be None. s3-argument power not supported.N(RRRIRgRHRRR RRR"RRR8RaRRRR7RhRRRR( RRtthirdRFRGR=tfatfbRnRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR^s2      * !       R4cCsi|djot|}nt||}|djo|id|d|S|i|d|d|S(s)Function version of the eponymous method.RRN(RR1R@R(RRJRRRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs   cCs<|djot|}nt||}|id|S(s)Function version of the eponymous method.RJN(RR1R@R(RRJRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs cCsQ|djo%t|}y | }Wq2q2Xnt||}|id|S(s)Function version of the eponymous method.RJN(RR1R@R(RRJRR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs   cCst|dtdt}|djo|i}d}n|djo'|ot|}qut|}n|}ti|ii }t ||i d|d|d|||<||S(s)Function version of the eponymous method.R+RiRJRRN( RRRRR~RzRRQRRR@R(RRJRRR5RR6R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs    +cCs/t|tjoti|S|iSdS(s Return all the non-masked data as a 1-D array. This function is equivalent to calling the "compressed" method of a `MaskedArray`, see `MaskedArray.compressed` for details. See Also -------- MaskedArray.compressed Equivalent method. N(RIRRRR((R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR(s c Cstig}|D]}|t|q~|}t|}|i|}x*|D]}t|tj oPqUqUW|Stig}|D]}|t|q~|} | ii o| i o t|_ n| i |i |_ |S(sK Concatenate a sequence of arrays along the given axis. Parameters ---------- arrays : sequence of array_like The arrays must have the same shape, except in the dimension corresponding to `axis` (the first, by default). axis : int, optional The axis along which the arrays will be joined. Default is 0. Returns ------- result : MaskedArray The concatenated array with any masked entries preserved. See Also -------- numpy.concatenate : Equivalent function in the top-level NumPy module. Examples -------- >>> import numpy.ma as ma >>> a = ma.arange(3) >>> a[1] = ma.masked >>> b = ma.arange(2, 5) >>> a masked_array(data = [0 -- 2], mask = [False True False], fill_value = 999999) >>> b masked_array(data = [2 3 4], mask = False, fill_value = 999999) >>> ma.concatenate([a, b]) masked_array(data = [0 -- 2 2 3 4], mask = [False True False False False False], fill_value = 999999) (RR)RHRRRIRRJRRRRRR( RRJRRR;RRR#Rtdm((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR)s)3  3 cCs7t|to|i|St|dti|S(NR+(RRR.RiR(RRJ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR.!scCsNti||it}t|tj oti|i||_n|S(s Extract a diagonal or construct a diagonal array. This function is the equivalent of `numpy.diag` that takes masked values into account, see `numpy.diag` for details. See Also -------- numpy.diag : Equivalent function for ndarrays. (RR2RRRIRR(R`R_Rs((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR2(s cCset||}t|toB|i}|i}||_|itj o||i_qan|S(s Expand the shape of an array. Expands the shape of the array by including a new axis before the one specified by the `axis` parameter. This function behaves the same as `numpy.expand_dims` but preserves masked elements. See Also -------- numpy.expand_dims : Equivalent function in top-level NumPy module. Examples -------- >>> import numpy.ma as ma >>> x = ma.array([1, 2, 4]) >>> x[1] = ma.masked >>> x masked_array(data = [1 -- 4], mask = [False True False], fill_value = 999999) >>> np.expand_dims(x, axis=0) array([[1, 2, 4]]) >>> ma.expand_dims(x, axis=0) masked_array(data = [[1 -- 4]], mask = [[False True False]], fill_value = 999999) The same result can be achieved using slicing syntax with `np.newaxis`. >>> x[np.newaxis, :] masked_array(data = [[1 -- 4]], mask = [[False True False]], fill_value = 999999) (t n_expand_dimsRRRRRR(R#RJRt new_shape((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR<:s(   cCskt|}|tjo#tit||}t|Stit|d|}t|d|SdS(s Shift the bits of an integer to the left. This is the masked array version of `numpy.left_shift`, for details see that function. See Also -------- numpy.left_shift iRN(RIRR"RYR@Ri(RRR=R;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRYls   cCskt|}|tjo#tit||}t|Stit|d|}t|d|SdS(s Shift the bits of an integer to the right. This is the masked array version of `numpy.right_shift`, for details see that function. See Also -------- numpy.right_shift iRN(RIRR"RR@Ri(RRR=R;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs   RcCsSy|i||d|SWn2tj o&t|dti||d|SXdS(s Set storage-indexed locations to corresponding values. This function is equivalent to `MaskedArray.put`, see that method for details. See Also -------- MaskedArray.put RR+N(RRRR(RRQR R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs cCs8t|tp|it}nt|t|}}t|tjoL|tj o;t|_t|i |i |_ t i |i ||qn|ioF|tj o5|i i}t i ||||i|O_qn4|tjot|}nt i |i ||t i |i||dS(sQ Changes elements of an array based on conditional and input values. This is the masked array version of `numpy.putmask`, for details see `numpy.putmask`. See Also -------- numpy.putmask Notes ----- Using a masked array as `values` will **not** transform a `ndarray` into a `MaskedArray`. N(RRRRHRIRRRRfRRRRRRR+RRJR(RRR tvaldatatvalmaskR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs$     cCsJy|i|SWn2tj o&t|dti|itSXdS(s Permute the dimensions of an array. This function is exactly equivalent to `numpy.transpose`. See Also -------- numpy.transpose : Equivalent function in top-level NumPy module. Examples -------- >>> import numpy.ma as ma >>> x = ma.arange(4).reshape((2,2)) >>> x[1, 1] = ma.masked >>>> x masked_array(data = [[0 1] [2 --]], mask = [[False False] [False True]], fill_value = 999999) >>> ma.transpose(x) masked_array(data = [[0 2] [1 --]], mask = [[False False] [False True]], fill_value = 999999) R+N(RRRRRR(Rtaxes((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs"RcCs\y|i|d|SWn>tj o2t|dti|d|}|itSXdS(s Returns an array containing the same data with a new shape. Refer to `MaskedArray.reshape` for full documentation. See Also -------- MaskedArray.reshape : equivalent function RR+N(RRRRRR(RRRt_tmp((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs !cCskt|}|tj oti||}nti||it|}|io ||_n|S(s4 Return a new masked array with the specified size and shape. This is the masked equivalent of the `numpy.resize` function. The new array is filled with repeated copies of `x` (in the order that the data are stored in memory). If `x` is masked, the new array will be masked, and the new mask will be a repetition of the old one. See Also -------- numpy.resize : Equivalent function in the top level NumPy module. Examples -------- >>> import numpy.ma as ma >>> a = ma.array([[1, 2] ,[3, 4]]) >>> a[0, 1] = ma.masked >>> a masked_array(data = [[1 --] [3 4]], mask = [[False True] [False False]], fill_value = 999999) >>> np.resize(a, (3, 3)) array([[1, 2, 3], [4, 1, 2], [3, 4, 1]]) >>> ma.resize(a, (3, 3)) masked_array(data = [[1 -- 3] [4 1 --] [3 4 1]], mask = [[False True False] [False False True] [False False False]], fill_value = 999999) A MaskedArray is always returned, regardless of the input type. >>> a = np.array([[1, 2] ,[3, 4]]) >>> ma.resize(a, (3, 3)) masked_array(data = [[1 2 3] [4 1 2] [3 4 1]], mask = False, fill_value = 999999) (RIRRRRRR7R(R#RR=R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs7  !  cCstit|S(s*maskedarray version of the numpy function.(RRRH(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRGscCstit|S(s*maskedarray version of the numpy function.(RRRH(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRLscCstit||S(s*maskedarray version of the numpy function.(RRRH(RRJ((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRQsc Cs|djo!|djot|diS|djp |djo tdnt|dit}ti|}t|}t|}|t jo |i }n9|t jo |i }nti |i |i gg}ti |i d|it}|i} ti| ||i|ti| ||i|ti|i dt} |_ti| |t|ti| |t|| t|O} | ip t|_n|S(s Return a masked array with elements from x or y, depending on condition. Returns a masked array, shaped like condition, where the elements are from `x` when `condition` is True, and from `y` otherwise. If neither `x` nor `y` are given, the function returns a tuple of indices where `condition` is True (the result of ``condition.nonzero()``). Parameters ---------- condition : array_like, bool The condition to meet. For each True element, yield the corresponding element from `x`, otherwise from `y`. x, y : array_like, optional Values from which to choose. `x` and `y` need to have the same shape as condition, or be broadcast-able to that shape. Returns ------- out : MaskedArray or tuple of ndarrays The resulting masked array if `x` and `y` were given, otherwise the result of ``condition.nonzero()``. See Also -------- numpy.where : Equivalent function in the top-level NumPy module. Examples -------- >>> x = np.ma.array(np.arange(9.).reshape(3, 3), mask=[[0, 1, 0], ... [1, 0, 1], ... [0, 1, 0]]) >>> print x [[0.0 -- 2.0] [-- 4.0 --] [6.0 -- 8.0]] >>> np.ma.where(x > 5) # return the indices where x > 5 (array([2, 2]), array([0, 2])) >>> print np.ma.where(x > 5, x, -3.1416) [[-3.1416 -- -3.1416] [-- -3.1416 --] [6.0 -- 8.0]] is/Either both or neither x and y should be given.RN(RR@RRRRRRaRHRhRtfind_common_typeR8RRRRRRRRIRJRR( RnR#RtfctnotfctxvtyvRR;RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRZs0/       !   c Csd}d}t|d}g}|D]}|||q,~} g} |D]}| ||qS~ } ti|| d|} tt| t|dddt} ti|| d|d|it} |dj o&t |to|i | n|S| i | | S( s6 Use an index array to construct a new array from a set of choices. Given an array of integers and a set of n choice arrays, this method will create a new array that merges each of the choice arrays. Where a value in `a` is i, the new array will have the value that choices[i] contains in the same place. Parameters ---------- a : ndarray of ints This array must contain integers in ``[0, n-1]``, where n is the number of choices. choices : sequence of arrays Choice arrays. The index array and all of the choices should be broadcastable to the same shape. out : array, optional If provided, the result will be inserted into this array. It should be of the appropriate shape and `dtype`. mode : {'raise', 'wrap', 'clip'}, optional Specifies how out-of-bounds indices will behave. * 'raise' : raise an error * 'wrap' : wrap around * 'clip' : clip to the range Returns ------- merged_array : array See Also -------- choose : equivalent function Examples -------- >>> choice = np.array([[1,1,1], [2,2,2], [3,3,3]]) >>> a = np.array([2, 1, 0]) >>> np.ma.choose(a, choice) masked_array(data = [3 2 1], mask = False, fill_value=999999) cSs|tjotSt|S(s,Returns the filled array, or True if masked.(RhRR@(R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytfmasks cSs|tjotSt|S(s:Returns the mask, True if ``masked``, False if ``nomask``.(RhRRI(R#((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytnmasks iRR+R[RN( R@RR$RdRgRIRRRRRR(RQtchoicesRRRRRRR#tmasksRRt outputmaskR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$s-  '''  cCse|djoti|||Stit|||t|dot||_n|SdS(s Return a copy of a, rounded to 'decimals' places. When 'decimals' is negative, it specifies the number of positions to the left of the decimal point. The real and imaginary parts of complex numbers are rounded separately. Nothing is done if the array is not of float type and 'decimals' is greater than or equal to 0. Parameters ---------- decimals : int Number of decimals to round to. May be negative. out : array_like Existing array to use for output. If not given, returns a default copy of a. Notes ----- If out is given and does not have a mask attribute, the mask of a is lost! RN(RRRRHRRIR(RR3R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs  cCs}t|d}t|d}t|idjo d|_nt|idjo d|_nti||itS(s Returns the inner product of a and b for arrays of floating point types. Like the generic NumPy equivalent the product sum is over the last dimension of a and b. Notes ----- The first argument is not conjugated. ii(i(i(R@RRRRRRR(RRR}R~((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRRs   s Masked values are replaced by 0.cCst|di}t|di}ti||}t|}t|}|tjo|tjo t|St|}t|}tdtid|d|dd}t|d|S(s*maskedarray version of the numpy function.iiR+R( R@RRRRIRRiRJRd(RRR}R~R;RFRGR=((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR)s     *cCstt|t|}|tjo5t|}t|}ti||}|iS|oYt|}t|}ti||}t|d|dt}|i t idStSdS(s Return True if all entries of a and b are equal, using fill_value as a truth value where either or both are masked. Parameters ---------- a, b : array_like Input arrays to compare. fill_value : bool, optional Whether masked values in a or b are considered equal (True) or not (False). Returns ------- y : bool Returns True if the two arrays are equal within the given tolerance, False otherwise. If either array contains NaN, then False is returned. See Also -------- all, any numpy.ma.allclose Examples -------- >>> a = ma.array([1e10, 1e-7, 42.0], mask=[0, 0, 1]) >>> a masked_array(data = [10000000000.0 1e-07 --], mask = [False False True], fill_value=1e+20) >>> b = array([1e10, 1e-7, -42.0]) >>> b array([ 1.00000000e+10, 1.00000000e-07, -4.20000000e+01]) >>> ma.allequal(a, b, fill_value=False) False >>> ma.allequal(a, b) True RR+N( RgRIRRHR"R:RRRR@RR(RRRR=R#RR;R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR :s*      c Cs|dj otid|}nt|dt}t|dt}tt|t|}tit|dtd|i t} ti | t ti|tjptSti | pGt t i t i||||t i||} ti | Sti t || || j|ptS|| }|| }t t i t i||||t i||} ti | S(s Returns True if two arrays are element-wise equal within a tolerance. This function is equivalent to `allclose` except that masked values are treated as equal (default) or unequal, depending on the `masked_equal` argument. Parameters ---------- a, b : array_like Input arrays to compare. masked_equal : bool, optional Whether masked values in `a` and `b` are considered equal (True) or not (False). They are considered equal by default. rtol : float, optional Relative tolerance. The relative difference is equal to ``rtol * b``. Default is 1e-5. atol : float, optional Absolute tolerance. The absolute difference is equal to `atol`. Default is 1e-8. fill_value : bool, optional *Deprecated* - Whether masked values in `a` or `b` are considered equal (True) or not (False). Returns ------- y : bool Returns True if the two arrays are equal within the given tolerance, False otherwise. If either array contains NaN, then False is returned. See Also -------- all, any numpy.allclose : the non-masked `allclose`. Notes ----- If the following equation is element-wise True, then `allclose` returns True:: absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`)) Return True if all elements of `a` and `b` are equal subject to given tolerances. Examples -------- >>> a = ma.array([1e10, 1e-7, 42.0], mask=[0, 0, 1]) >>> a masked_array(data = [10000000000.0 1e-07 --], mask = [False False True], fill_value = 1e+20) >>> b = ma.array([1e10, 1e-8, -42.0], mask=[0, 0, 1]) >>> ma.allclose(a, b) False >>> a = ma.array([1e10, 1e-8, 42.0], mask=[0, 0, 1]) >>> b = ma.array([1.00001e10, 1e-9, -42.0], mask=[0, 0, 1]) >>> ma.allclose(a, b) True >>> ma.allclose(a, b, masked_equal=False) False Masked values are not compared directly. >>> a = ma.array([1e10, 1e-8, 42.0], mask=[0, 0, 1]) >>> b = ma.array([1.00001e10, 1e-9, 42.0], mask=[0, 0, 1]) >>> ma.allclose(a, b) True >>> ma.allclose(a, b, masked_equal=False) False sEThe use of fill_value is deprecated. Please use masked_equal instead.R+RN(RRXRYRiRRgRIRtisinfR@RRR"R[R( RRRjRxRyRR#RR=txinfR;((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR ss,K   *( '   c Cs"t|d|dtdtdtS(s  Convert the input to a masked array of the given data-type. No copy is performed if the input is already an `ndarray`. If `a` is a subclass of `MaskedArray`, a base class `MaskedArray` is returned. Parameters ---------- a : array_like Input data, in any form that can be converted to a masked array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists, ndarrays and masked arrays. dtype : dtype, 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. Default is 'C'. Returns ------- out : MaskedArray Masked array interpretation of `a`. See Also -------- asanyarray : Similar to `asarray`, but conserves subclasses. Examples -------- >>> x = np.arange(10.).reshape(2, 5) >>> x array([[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.]]) >>> np.ma.asarray(x) masked_array(data = [[ 0. 1. 2. 3. 4.] [ 5. 6. 7. 8. 9.]], mask = False, fill_value = 1e+20) >>> type(np.ma.asarray(x)) RR+RR(RiRR(RRR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs-c Cs"t|d|dtdtdtS(s Convert the input to a masked array, conserving subclasses. If `a` is a subclass of `MaskedArray`, its class is conserved. No copy is performed if the input is already an `ndarray`. Parameters ---------- a : array_like Input data, in any form that can be converted to an array. dtype : dtype, 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. Default is 'C'. Returns ------- out : MaskedArray MaskedArray interpretation of `a`. See Also -------- asarray : Similar to `asanyarray`, but does not conserve subclass. Examples -------- >>> x = np.arange(10.).reshape(2, 5) >>> x array([[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.]]) >>> np.ma.asanyarray(x) masked_array(data = [[ 0. 1. 2. 3. 4.] [ 5. 6. 7. 8. 9.]], mask = False, fill_value = 1e+20) >>> type(np.ma.asanyarray(x)) RR+RR(RiRR(RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR s+cCs3t|dpt|d}nti||S(s Pickle a masked array to a file. This is a wrapper around ``cPickle.dump``. Parameters ---------- a : MaskedArray The array to be pickled. F : str or file-like object The file to pickle `a` to. If a string, the full path to the file. treadlinetw(RtopentcPickleR6(RtF((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR6:scCs ti|S(s Return a string corresponding to the pickling of a masked array. This is a wrapper around ``cPickle.dumps``. Parameters ---------- a : MaskedArray The array for which the string representation of the pickle is returned. (RR7(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR7Ls cCs0t|dpt|d}nti|S(sz Wrapper around ``cPickle.load`` which accepts either a file-like object or a filename. Parameters ---------- F : str or file The file or file name to load. See Also -------- dump : Pickle an array Notes ----- This is different from `numpy.load`, which does not use cPickle but loads the NumPy binary .npy format. RR(RRRR\(R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR\[scCs ti|S(s Load a pickle from the current string. The result of ``cPickle.loads(strg)`` is returned. Parameters ---------- strg : str The string to load. See Also -------- dumps : Return a string corresponding to the pickling of a masked array. (RR](tstrg((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR]ssRcCstddS(NsNot yet implemented. Sorry(R(tfileRR.RE((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pytfromfilescCst|dd|dS(s Build a masked array from a suitable flexible-type array. The input array has to have a data-type with ``_data`` and ``_mask`` fields. This type of array is output by `MaskedArray.toflex`. Parameters ---------- fxarray : ndarray The structured input array, containing ``_data`` and ``_mask`` fields. If present, other fields are discarded. Returns ------- result : MaskedArray The constructed masked array. See Also -------- MaskedArray.toflex : Build a flexible-type array from a masked array. Examples -------- >>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[0] + [1, 0] * 4) >>> rec = x.toflex() >>> rec array([[(0, False), (1, True), (2, False)], [(3, True), (4, False), (5, True)], [(6, False), (7, True), (8, False)]], dtype=[('_data', '>> x2 = np.ma.fromflex(rec) >>> x2 masked_array(data = [[0 -- 2] [-- 4 --] [6 -- 8]], mask = [[False True False] [ True False True] [False True False]], fill_value = 999999) Extra fields can be present in the structured array but are discarded: >>> dt = [('_data', '>> rec2 = np.zeros((2, 2), dtype=dt) >>> rec2 array([[(0, False, 0.0), (0, False, 0.0)], [(0, False, 0.0), (0, False, 0.0)]], dtype=[('_data', '>> y = np.ma.fromflex(rec2) >>> y masked_array(data = [[0 0] [0 0]], mask = [[False False] [False False]], fill_value = 999999) RRR(Ri(tfxarray((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRFs>t _convert2macBs/eZdZdZdZdZdZRS(sConvert functions from numpy to numpy.ma. Parameters ---------- _methodname : string Name of the method to transform. cCs%tt||_|i|_dS(N(R1Rt_funcRR(R R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR!scCs^t|idd}t|i}|o/|od|ii|f}n||}n|S(s<Return the doc of the function (from the doc of the method).Rs%s%s N(R1RRRR(R RR((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRscOs|ii|||itS(N(RR$RR(R RR9R((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyR$sN(RRRRR!RR$(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyRs   (Rt __author__t __docformat__t__all__RR<tnumpyRRR R RRRRtnumpy.core.umathtcoreR"tnumpy.core.numerictypest numerictypesRt numpy.compatRRR<RRXRRR6RRt ExceptionRRRRt_minvalsRRRtfloat32tfloat64R_tinft_maxvalsRRRRR1RR~RzRRRRR R&RR@RRHtget_dataRCR2R3RR%R'R+R-R.R@RPR;R*RR,RRRRR-RRRR=RRAR#RRRaRR^R_RRRRRRRRR:RHRR[RLRZRKR`R RbRRcR R!R"RNR5RRBRR?RRRReRItget_maskRJRVRRdRfRgR>RlRwRkRlRoRpRqRjRmRsRrRvRnR|RtRR RRRRRRDRRXRURXRTRRuRhRiRWRoRtRvR|RxRRwRRRRR'R/R0R+R3RMRPRyR{R}RRRRRRRRRRRRRRRRRRR(R)R.R2RYRRRRRRRRRRR$RRRRSRRR R RRR6R7R\R]RRRFRRR%R4R8R9RERGRORQRRR(((s3/usr/lib64/python2.6/site-packages/numpy/ma/core.pyts                  (         > >! > ? ? - @ ! *  3>  RJ                    # < 7 Cd 1@ 9 t      # ( (=Q .    Ef 7 2   87  %                          A   >   2    & '  A   MJ      9g/ 1     B