KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21571/root/usr/lib64/python2.4/site-packages/Numeric/MA/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21571/root/usr/lib64/python2.4/site-packages/Numeric/MA/MA.pyc
mò
C1?c@sãdZdkZdkZdkZdkZdkTdklZlZlZe	Z
dZdefd„ƒYZ
dfd„ƒYZed	ƒZeid
gƒieƒZeid
dgƒieƒZdZeid
gƒieƒZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d
d
d„Z!d„Z"e"Z#d„Z$e%d„Z&d„Z'd„Z(dfd„ƒYZ)dfd„ƒYZ*dfd „ƒYZ+d!fd"„ƒYZ,d#fd$„ƒYZ-d%fd&„ƒYZ.d'fd(„ƒYZ/d)fd*„ƒYZ0e-ei1d+e,d+ƒƒZ1e-ei2d,e+d+ƒƒZ2e-ei3d,e+d+ƒƒZ3e-ei4ƒZ4e-ei5ƒZ5e-ei6ƒZ6e-ei7ƒZ7e-ei8d+e*dƒƒZ8e-ei9d+e)d-d,ƒƒZ9e-ei:d+e)d-d,ƒƒZ:e-ei;ƒZ;e-ei<ƒZ<e-ei=ƒZ=e-ei>ƒZ>e-ei?ƒZ?e-ei@ƒZ@e-eiAƒZAe-eiBƒZBe-eiCƒZCe-eiDƒZDe-eiEƒZEe-eiFƒZFe-eiGd.ƒZGe-eiHƒZHe0eiIƒZIe0eiJƒZJe%eJ_Ke0eiLd.d.ƒZLe/eiMe.ƒd
d.ƒZMe/eiNe.ƒd
d.ƒZNe/eiOe.ƒd
d.ƒZOe/eiPe.ƒd
d.ƒZPe/eiQe.ƒd
d.ƒZQe0eiRƒZRe0eiSd+d,ƒZSe%eS_Ke0eiTƒZTe%eT_Ke0eiUƒZUe%eU_Ke0eiVƒZVe%eV_Ke0eiWƒZWe%eW_Ke0eiXƒZXe%eX_Ke0eiYƒZYe%eY_Ke0eiZƒZZe0ei[ƒZ[e0ei\ƒZ\e0ei]ƒZ]e0ei^ƒZ^e0ei_ƒZ_ei`Z`eiaZaeibZbd/ecfd0„ƒYZdedZd1edfd2„ƒYZeeeƒZfd3„ZgegZhegZid.d4d5d6„Zjd.d7„Zkd4d5d.d
d8„Zld.d
d9„Zme%d.e%d:„ZnenZod;„Zpd<„Zqd=„Zrd>„Zsd
d?„Ztd@„Zue%dA„Zvewd
dB„Zxewd
dC„Zye%dD„Zze%dE„Z{e%e%dF„Z|eIiKZ}eLiKZ~d
e%d
dG„ZdH„Z€dI„Zd.dJ„Z‚d.dK„Zƒd.dL„Z„d.dM„Z…d.dN„Z†d.dO„Z‡d.dP„Zˆd.dQ„Z‰d.dR„ZŠdS„Z‹dT„ZŒd
dU„Zd
dV„ZŽe%dW„ZdX„ZdY„Z‘dZ„Z’d[„Z“d\„Z”d]d^„Z•d_fd`„ƒYZ–e–ƒZ—dafdb„ƒYZ˜e˜ƒZ™d]e%dc„Zšd
d
d.dd„Z›d]e%de„Zœd]e%df„Zd]e%dg„Zždh„ZŸe%di„Z dja¡e%e%e%dk„Z¢ei£Z¤ei¥Z¦d
dl„Z§dm„Z¨e§t¡ƒdS(nsþMA: a facility for dealing with missing observations
MA is generally used as a Numeric.array look-alike.
There are some differences in semantics, see manual.
In particular note that slices are copies, not references.
by Paul F. Dubois
   L-264
   Lawrence Livermore National Laboratory
   dubois@users.sourceforge.net
Copyright 1999, 2000, 2001 Regents of the University of California.
Released for unlimited redistribution; see file Legal.htm
Documentation is in the Numeric manual; see numpy.sourceforge.net
N(t*(tespisNewAxisf1e-35tMAErrorcBs#tZdd„Zd„ZeZRS(NcCs
||_dS(sCreate an exceptionN(targstself(RR((t3/usr/lib64/python2.4/site-packages/Numeric/MA/MA.pyt__init__scCs
t|iƒS(s#Calculate the string representationN(tstrRR(R((Rt__str__s(t__name__t
__module__tNoneRRt__repr__(((RRs	t_MaskedPrintOptioncBsGtZdZd„Zd„Zd„Zd„Zdd„Zd„ZRS(s<One instance of this class, masked_print_option, is created.cCs|i|ƒd|_dS(s&Create the masked print option object.iN(Rtset_displaytdisplayt_enabled(RR((RRs
cCs|iS(s#Show what prints for masked values.N(Rt_display(R((RR$scCs
||_dS(s2set_display(s) sets what prints for masked values.N(tsRR(RR((RR(scCs|iS(s(Is the use of the display value enabled?N(RR(R((Rtenabled,sicCs
||_dS(sSet the enabling flag to flag.N(tflagRR(RR((Rtenable0scCs
t|iƒS(N(RRR(R((RR4s(	R	R
t__doc__RRRRRR(((RR
s				s--f1e+20x0.00.0t?icCsDt|tiƒotSn&t|tiƒpt|tiƒotSnøt|tiƒot	SnÝt|ti
ƒotSnÂt|tƒpt|t
iƒoš|iƒ}|tdjotSn|tdjotSn|tdjotSn|tdjot	Sn|tdjot
itƒSntSntSdS(s7Function to calculate default fill value for an object.tFloattIntegertComplext	CharactertUnsignedIntegerN(t
isinstancetobjttypest	FloatTypetdefault_real_fill_valuetIntTypetLongTypetdefault_integer_fill_valuet
StringTypetdefault_character_fill_valuetComplexTypetdefault_complex_fill_valuetMaskedArraytNumerict	arraytypettypecodetxt	typecodestabsolutetdefault_object_fill_value(RR-((Rtdefault_fill_valueAs.&#cCsÝt|tiƒotSn¿t|tiƒpt|tiƒotiSnŽt|t	ƒpt|t
iƒoa|iƒ}|tdjotSn|tdjotiSn|tdjotiSqÙn
td‚dS(sDFunction to calculate default fill value suitable for taking minima.RRRs(Unsuitable type for calculating minimum.N(RRRR R!R"R#tsystmaxintR)R*R+R,R-R.t	TypeError(RR-((Rtminimum_fill_value[s&#cCsÛt|tiƒo	tSn¼t|tiƒpt|tiƒo	tSnt|tƒpt|t	i
ƒo`|iƒ}|t
djo	tSn|t
djotiSn|t
djodSq×n
td‚dS(sDFunction to calculate default fill value suitable for taking maxima.RRRis(Unsuitable type for calculating maximum.N(RRRR R!R"R#R$R)R*R+R,R-R.R2R3R4(RR-((Rtmaximum_fill_valuels	&	#	cCs"t|ƒo|i|ƒndS(s,Set fill value of a if it is a masked array.N(t
isMaskedArraytatset_fill_valuet
fill_value(R8R:((RR9}s
cCs&t|tƒo|iƒSndSdS(s…Mask of values in a; could be None.
       Returns None if a is not a masked array.
       To get an array for sure use getmaskarray.N(RR8R)traw_maskR(R8((Rtgetmask‚scCs5t|ƒ}|djott|ƒƒSn|SdS(sËMask of values in a; an array of zeros if mask is None
     or not a masked array. Caution: has savespace attribute,
     and is a byte-sized integer.
     Do not try to add up entries, for example.
    N(R<R8tmRtmake_mask_nonetshape(R8R=((Rtgetmaskarray‹s

cCsC|djp&t|tiƒo|iƒtjodSndSdS(s;Is m a legal mask? Does not check contents, only type.
    iiN(R=RRR*t	ArrayTypeR,tMaskType(R=((Rtis_mask—s3cCsì|djodSn§t|tiƒor|iƒtjo?|oti|ddƒ}q–ti|ddddƒ}q»|i
tƒ}|idƒn"tit|dƒtddƒ}|o"titi|ƒƒodSn|SdS(smake_mask(m, copy=0, flag=0)
       return m as a mask, creating a copy if necessary or requested.
       Can accept any sequence of integers or None. Does not check 
       that contents must be 0s and 1s.
       if flag, return None if m contains no true elements.
    t	savespaceitcopyiN(R=RRR*RAR,RBREtarraytresulttastypeRDtfilledRtsometruetravel(R=RERRG((Rt	make_mask s
!!cCs,ti|tƒ}|idƒ||_|S(s&Return a mask of all zeros of shape s.iN(R*tzerosRRBRGRDR?(RRG((RR>ºs

	cCsn|djot|ƒSn|djot|ƒSn||jot|ƒo|Sntti||ƒƒS(sLogical or of the mask candidates m1 and m2, treating None as false.
       Result may equal m1 or m2 if the other is None.
     N(tm1RRLtm2RCR*t
logical_or(RNRO((Rtmask_orÃs

cCst|tƒo|i|ƒSn]t|tiƒo|iƒo|Sn5t|ti	ƒoti
|dƒSnti
|ƒSdS(s“a as a contiguous Numeric array with any masked areas replaced by value
    if value is None or the special element "masked", fill_value(a)
    is used instead. 

    If a is already a contiguous Numeric array, a itself is returned.

    filled(a) can be used to be sure that the result is Numeric when 
    passing an object a to other software ignorant of MA, in particular to
    Numeric itself.
    tON(RR8R)RItvalueR*RAtiscontiguousRtDictTypeRF(R8RS((RRIÌs
 cCs-t|ƒo|iƒ}n
t|ƒ}|S(sb
    The fill value of a, if it has one; otherwise, the default fill value
    for that type.
    N(R7R8R:RGR1(R8RG((RR:às

cCs1t|ƒ}t|ƒ}||jo|SndS(s:The common fill_value of a and b, if there is one, or NoneN(R:R8tt1tbtt2R(R8RWRXRV((Rtcommon_fill_valueës
tdomain_check_intervalcBs tZdZd„Zd„ZRS(s9domain_check_interval(a,b)(x) = true where x < a or y > bcCs||_||_dS(s9domain_check_interval(a,b)(x) = true where x < a or y > bN(ty1Rty2(RR[R\((RRõs	cCs.titi||iƒti||iƒƒS(sExecute the call behavior.N(R*RPtgreaterR-RR\tlessR[(RR-((Rt__call__ús(R	R
RRR_(((RRZós	t
domain_tancBs tZdZd„Zd„ZRS(s/domain_tan(eps) = true where abs(cos(x)) < eps)cCs
||_dS(s/domain_tan(eps) = true where abs(cos(x)) < eps)N(tepsR(RRa((RRscCs%tititi|ƒƒ|iƒS(sExecute the call behavior.N(R*R^R/tcosR-RRa(RR-((RR_s(R	R
RRR_(((RR`s	tdomain_greatercBs tZdZd„Zd„ZRS(s(domain_greater(v)(x) = true where x <= vcCs
||_dS(s(domain_greater(v)(x) = true where x <= vN(tcritical_valueR(RRd((RRscCsti||iƒS(sExecute the call behavior.N(R*t
less_equalR-RRd(RR-((RR_s(R	R
RRR_(((RRc
s	tdomain_greater_equalcBs tZdZd„Zd„ZRS(s-domain_greater_equal(v)(x) = true where x < vcCs
||_dS(s-domain_greater_equal(v)(x) = true where x < vN(RdR(RRd((RRscCsti||iƒS(sExecute the call behavior.N(R*R^R-RRd(RR-((RR_s(R	R
RRR_(((RRfs	tmasked_unary_operationcBs)tZddd„Zd„Zd„ZRS(NicCs:||_||_||_t|dt|ƒƒ|_dS(sÜ masked_unary_operation(aufunc, fill=0, domain=None)
            aufunc(fill) must be defined
            self(x) returns aufunc(x) 
            with masked values where domain(x) is true or getmask(x) is true. 
        RN(taufuncRtftfilltdomaintgetattrRR(RRhRjRk((RRs
			cOs
t|ƒ}t||iƒ}|idj	ot	||i|ƒƒ}n|djoA|i
|||Ž}t|ƒtijot|ƒSq|Snot||ƒ}|i
t||iƒ||Ž}t|ƒtijot||ƒSn|dotSn|SdS(sExecute the call behavior..N(R<R8R=RIRRjtd1RkRRQRiRtkwargsRGttypeR*RAtmasked_arraytdxtmasked(RR8RRnR=RGRqRm((RR_*s"
!cCsdt|iƒS(NsMasked version of (RRRi(R((RRAs(R	R
RRR_R(((RRgs	tdomain_safe_dividecBstZed„Zd„ZRS(NcCs
||_dS(N(t	toleranceR(RRt((RRFscCs#ti|ƒ|iti|ƒjS(N(R*R/R8RRtRW(RR8RW((RR_Hs(R	R
tdivide_toleranceRR_(((RRsEstdomained_binary_operationcBs/tZdZddd„Zd„Zd„ZRS(sœBinary operations that have a domain, like divide. These are complicated so they
       are a separate class. They have no reduce, outer or accumulate.
    icCsC||_||_||_||_t|dt|ƒƒ|_dS(sjabfunc(fillx, filly) must be defined.
           abfunc(x, filly) = x for all x to enable reduce.
        RN(	tabfuncRRiRktfillxtfillyRlRR(RRwRkRxRy((RROs				c
Csft|ƒ}t|ƒ}t||iƒ}	t||i	ƒ}|i|	|ƒ}t
i|ƒo(t||i	|ƒ}t||ƒ}nt||ƒ}|djo>|i|	|ƒ}t|ƒt
ijot|ƒSqà|Sn|i|	|ƒ}t|ƒt
ijoC|i|ijott|ƒt|ƒƒ}nt||ƒSn|dotSn|SdS(sExecute the call behavior..N(R<R8tmaRWtmbRIRRxRmRytd2RkttR*RJtwhereRQR=RRiRGRoRARpR?R@Rr(
RR8RWRzRGR{R=R}R|Rm((RR_Ys.
cCsdt|iƒS(NsMasked version of (RRRi(R((RRts(R	R
RRR_R(((RRvKs
	tmasked_binary_operationcBsJtZddd„Zd„Zdd„Zd„Zdd„Zd„ZRS(NicCs:||_||_||_t|dt|ƒƒ|_dS(sjabfunc(fillx, filly) must be defined.
           abfunc(x, filly) = x for all x to enable reduce.
        RN(RwRRiRxRyRlRR(RRwRxRy((RRxs
			c	Os@tt|ƒt|ƒƒ}|djoht||iƒ}t||i
ƒ}|i||||Ž}t|ƒtijot|ƒSq|Snt||iƒ}t||i
ƒ}|i||||Ž}t|ƒtijoC|i|ijott|ƒt|ƒƒ}nt||ƒSn|dotSn|SdS(sExecute the call behavior..N(RQR<R8RWR=RRIRRxRmRyR|RiRRnRGRoR*RARpR?R@Rr(	RR8RWRRnR=RGR|Rm((RR_s&
cCst|ƒ}t||iƒ}|ifjo9d|_|dj	ot	|ddƒ}d|_qgn|djot
|ii||ƒƒSn†t
||ƒ}|iit||iƒ|ƒ}tii||ƒ}t|tiƒot
||t|ƒƒSn|otSn|SdS(s6Reduce target along the given axis with this function.iREN(i(i(R<ttargetR=RIRRyR}R?RRLRpRitreducetaxisR*tlogical_andRRAR:Rr(RR€R‚R=R}((RR˜s$	

!cCs t|ƒ}t|ƒ}|djo|djo
d}n+t|ƒ}t|ƒ}ti	||ƒ}|ii	t||i
ƒt||iƒƒ}t||ƒS(s<Return the function applied to the outer product of a and b.N(R<R8RzRWR{RR=R@RPtouterRRiRIRxRytdRp(RR8RWRzR…R{R=((RR„®s
-cCs+t||iƒ}t|ii||ƒƒS(s=Accumulate target along axis after filling with y fill value.N(	RIR€RRyR}RpRit
accumulateR‚(RR€R‚R}((RR†»scCsdt|iƒS(NsMasked version of (RRRi(R((RR¿s(R	R
RR_RR„R†R(((RRws			
f0.0f1.0f-1.0iR)cBshtZdZdZedeeed„Zed„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZeZeZeZd„Zd„Zd„Z d„Z!e!Z"d„Z#d„Z$d„Z%d „Z&d!„Z'd"„Z(d#„Z)e)Z*d$„Z+d%„Z,d&„Z-d'„Z.d(„Z/d)„Z0ed*„Z1d+„Z2d,„Z3d-„Z4d.„Z5d/„Z6d0„Z7d1„Z8d2„Z9d3„Z:d4„Z;d5„Z<d6„Z=d7„Z>d8„Z?ed9„Z@d:„ZAd;„ZBed<„ZCd=„ZDd>„ZEd?„ZFd@„ZGdA„ZHdB„ZIdC„ZJdD„ZKdE„ZLdF„ZMdG„ZNedH„ZOedI„ZPdJ„ZMdK„ZQedL„ZRedM„ZSdN„ZTdO„ZUeVeedPdQƒZWeVe	e
dPdRƒZXeVeedPdSƒZYeVe
edPdTƒZZeZZ[RS(Us€Arrays with possibly masked values. 
       Masked values of 1 exclude element from the computation.
       Construction:
           x = array(data, typecode=None, copy=1, savespace=0,
                     mask = None, fill_value=None)

       If copy=0, every effort is made not to copy the data:
           If data is a MaskedArray, and argument mask=None,
           then the candidate data is data.raw_data() and the
           mask used is data.mask(). If data is a Numeric array,
           it is used as the candidate raw data.
           If savespace != data.spacesaver() or typecode is not None and
           is != data.typecode() then a data copy is required.  
           Otherwise, the candidate is used.

       If a data copy is required, raw data stored is the result of:
       Numeric.array(data, typecode=typecode, copy=copy, savespace=savespace)

       If mask is None there are no masked values. Otherwise mask must
       be convertible to an array of integers of typecode MaskType, 
       with values 1 or 0, and of the same shape as x.
 
       fill_value is used to fill in masked values when necessary, 
       such as when printing and in method/function filled().
       The fill_value is not used for computation within this module.

       If savespace is 1, the data is given the spacesaver property, and
       the mask is replaced by None if all its elements are true.
    sMA.MaskedArrayicCs€|}
|}
|}t|tƒo¾|i	ƒ}|iƒ}|
djo
|}
n|
|jo
d}n|i
ƒ}|
djo
|}
n|
|jo
d}nd}
|djo|iƒ}q¦|dj	o
d}q¦nÇt|tiƒo~|}|iƒ}|
djo
|}
n|
|jo
d}n|i
ƒ}|
djo
|}
q¦|
|jo
d}q¦n6d}|
djo
d}
nti||
d|
ƒ}|oU|
|jo"ti|ddd|
ƒ|_q|i|
ƒ|_|ii|
ƒn
||_|djod|_d|_nBt|d|
ƒ|_|idjo
d|_n|i|j|_t|iƒ}t|iƒ}	||	jo†|djo+ti|i|iiƒ|_d|_qo|	djo4ti|i|iiƒ|_|ii|i_qotd‚nM|djo?t|iƒt|iƒjo |iƒ|ii|i_n|i |ƒdS(sõarray(data, typecode=None,copy=1, savespace=None,
                    mask=None, fill_value=None)
           If data already a Numeric array, its typecode and spacesaver()
           become the default values for typecode and savespace.
        iiRDRERsMask and data not compatible.N("R,ttcRDtssREtneed_data_copiedRtdataR)traw_datatctctcRt
spacesavertcsstmaskR*RARFRt_dataRHt_maskt_shared_maskRLtsizetnmtndtresizeR?Rtunshare_maskR9R:(RRŠR,RERDRR:R‰R•R–R‡RRŒRˆR((RR!s€



















"	
	






,
cCsu|idj	o?titi|iƒƒo
td‚qOd|_d|_n|o|i	i
|ƒSn|i	SdS(s:Special hook for Numeric. Converts to Numeric if possible.sŠCannot automatically convert masked array to Numeric because data 
                   is masked in one or more locations.
                iN(RR’RR*RJRKRR“R}R‘RH(RR}((Rt	__array__ts
	
cCs
|iiS(sReturn the current shape.N(RR‘R?(R((Rt
_get_shape…scCs°|iiƒp4ti|i|iiƒd|iiƒƒ|_n||i_|i	dj	oL|iƒ|i	iƒp"ti|i	tddƒ|_	n||i	_ndS(sSet the array's shape.iN(
RR‘RTR*RFR,RŽtnewshapeR?R’RR˜RB(RR›((Rt
_set_shape‰s
"cCsb|idjo&t|iiddd|iƒƒSn)t|iid|iid|iƒƒSdS(s#Calculate the flat value. 
        RR:N(RR’RRpR‘tflatR:(R((Rt	_get_flat•scCs|i}||(dS(sx.flat = valueN(RRtyRS(RRSRŸ((Rt	_set_flat s	cCse|idjo&t|iiddd|iƒƒSn,t|iid|iƒid|iƒƒSdS(s%Get the real part of a complex array.RR:N(	RR’RRpR‘trealR:RR(R((Rt	_get_real¥scCs|i}||d<dS(sx.real = value.N(RR¡RŸRS(RRSRŸ((Rt	_set_real®s	cCse|idjo&t|iiddd|iƒƒSn,t|iid|iƒid|iƒƒSdS(s*Get the imaginary part of a complex array.RR:N(	RR’RRpR‘t	imaginaryR:RR(R((Rt_get_imaginary³scCs|i}||d<dS(sx.imaginary = value.N(RR¤RŸRS(RRSRŸ((Rt_set_imaginary¼s	cCs6tiƒo
t}n
|iƒ}tt||ƒƒS(s~Calculate the str representation, using masked for fill if 
           it is enabled. Otherwise fill with fill value.
        N(tmasked_print_optionRRiRR:RRI(RRi((RRÁs


cCs§d}d}d}d}t|iƒ}|id	joO|djo!|hdt
|iƒƒ<Sn|hdt
|iƒƒ<Sn |djoK|hdt
|iƒƒ<dt
|iƒƒ<dt
|i
ƒƒ<Sn|hdt
|iƒƒ<dt
|iƒƒ<dt
|i
ƒƒ<Sd}|id	jo!|hdt
|iƒƒ<SnH|hdt
|iƒƒ<dt
|iƒƒ<dt
|i
ƒƒ<Sd	S(
sCalculate the repr representation, using masked for fill if 
           it is enabled. Otherwise fill with fill value.
        sMarray(data = 
 %(data)s,
      mask = 
 %(mask)s,
      fill_value=%(fill)s)
sIarray(data = %(data)s,
      mask = %(mask)s,
      fill_value=%(fill)s)
sarray(
 %(data)s)sarray(%(data)s)iRŠRRjN(t	with_maskt
with_mask1twithout_maskt
without_mask1tlenRR?tnR’RRRIRR:(RR­R©R«RªR¨((RRËs"
!!
KG!cCs;|iƒ|idj	o
td‚nt|iƒdƒS(sConvert self to float.s0Cannot convert masked element to a Python float..N(RtunmaskR’RRtfloatR‹(R((Rt	__float__ús


cCs;|iƒ|idj	o
td‚nt|iƒdƒS(sConvert self to int.s.Cannot convert masked element to a Python int..N(RR®R’RRtintR‹(R((Rt__int__s


cCsÞ|i}|i|}|iiƒ}|iiƒ}t
|ƒtijok|djo"t|d|ddd|ƒ}n5t|d|ddd|d||d|iƒƒ}|Sn&|djp||o|SntSdS(s Get copy of item described by i.R,REiRDRR:N(RR’R=R‘titdoutRŽRˆR,R‡RoR*RARRFRGR:Rr(RR³R´R=RˆRGR‡((Rt__getitem__	s	

"cCs|i}|i||!}|iiƒ}|ii	ƒ}|djo t|d|ddd|ƒSn6t|d|ddd|d|||!d|i
ƒƒSdS(s#Get copy of slice described by i, jR,REiRDRR:N(RR’R=R‘R³tjR´RŽRˆR,R‡RRFR:(RR³R¶R´R=RˆR‡((Rt__getslice__s	
 cCs8|tjo
td‚n|tjoQ|idjo"t|iiƒ|_d|_	n|i
ƒd|i|<dSnt|ƒ}t|ƒi|iiƒƒ}||i|<|djo/|idj	o|i
ƒd|i|<q4nJ|idjo"t|iiƒ|_d|_	n|i
ƒ||i|<dS(sFSet item described by index. If value is masked, mask those locations.s Cannot alter the masked element.iiN(RRrRRSR’RR>R‘R?R“R˜tindexR<R=RIRHR,(RR¸RSR=((Rt__setitem__+s,










cCs0|tjo
td‚n|tjoJ|idjo"t|iiƒ|_d|_	nd|i||+dSnt|ƒ}t|ƒi|iiƒƒ}||i||+|djo2|idj	o|iƒd|i||+q,nC|idjo"t|iiƒ|_d|_	n||i||+dS(s8Set slice i:j; if value is masked, mask those locations.s Cannot alter the masked element.iiN(RRrRRSR’RR>R‘R?R“R³R¶R<R=RIRHR,R˜(RR³R¶RSR=((Rt__setslice__Fs(






cCs
t|iƒS(seReturn length of first dimension. This is weird but Python's
         slicing behavior depends on it.N(R¬RR‘(R((Rt__len__]scCs
t||ƒS(sReturn bitwise_andN(tbitwise_andRtother(RR½((Rt__and__bscCs
t||ƒS(sReturn bitwise_orN(t
bitwise_orRR½(RR½((Rt__or__fscCs
t||ƒS(sReturn bitwise_xorN(tbitwise_xorRR½(RR½((Rt__xor__jscCs
t|ƒS(sReturn absolute(self)N(R/R(R((Rt__abs__rscCs
t|ƒS(sReturn negative(self)N(tnegativeR(R((Rt__neg__vscCs
t|ƒS(sReturn array(self)N(RFR(R((Rt__pos__zscCs
t||ƒS(sReturn add(self, other)N(taddRR½(RR½((Rt__add__~scCs
t||ƒS(sReturn remainder(self, other)N(t	remainderRR½(RR½((Rt__mod__„scCs
t||ƒS(sReturn remainder(other, self)N(RÉR½R(RR½((Rt__rmod__ˆscCs
t||ƒS(N(t
left_shiftRR­(RR­((Rt
__lshift__ŒscCs
t||ƒS(N(tright_shiftRR­(RR­((Rt
__rshift__scCs
t||ƒS(sReturn subtract(self, other)N(tsubtractRR½(RR½((Rt__sub__’scCs
t||ƒS(sReturn subtract(other, self)N(RÐR½R(RR½((Rt__rsub__–scCs
t||ƒS(sReturn multiply(self, other)N(tmultiplyRR½(RR½((Rt__mul__šscCs
t||ƒS(sReturn divide(self, other)N(tdivideRR½(RR½((Rt__div__ scCs
t||ƒS(sReturn divide(other, self)N(RÕR½R(RR½((Rt__rdiv__¤scCs
t||ƒS(sReturn divide(self, other)N(ttrue_divideRR½(RR½((Rt__truediv__¨scCs
t||ƒS(sReturn divide(other, self)N(RØR½R(RR½((Rt__rtruediv__¬scCs
t||ƒS(sReturn divide(self, other)N(tfloor_divideRR½(RR½((Rt__floordiv__°scCs
t||ƒS(sReturn divide(other, self)N(RÛR½R(RR½((Rt
__rfloordiv__´scCst|||ƒS(s Return power(self, other, third)N(tpowerRR½tthird(RR½Rß((Rt__pow__¸scCs
t|ƒS(sReturn sqrt(self)N(tsqrtR(R((Rt__sqrt__¼scCs	|iiƒ}t|dƒ}|iƒ}||jon<|tdjo1|tdjo|i	|ƒ}qvt
d‚nú|tdjoU|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n”|tdjoy|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n
t
d‚|idjo7|i|7_t
|ƒ}||_|dj	|_nIt|t|dt
|ƒƒƒ}|iƒ|_|iƒ|_d|_|S(	sAdd other to self in place.iRs&Incorrect type for in-place operation.RRRiN(RR‘R,R}RIR½RiRVR.RHR4R’RR<R=R“RÇRpRGR‹R;(RR½RiR=RVR}RG((Rt__iadd__ÀsF



		!	cCs	|iiƒ}t|dƒ}|iƒ}||jon<|tdjo1|tdjo|i	|ƒ}qvt
d‚nú|tdjoU|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n”|tdjoy|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n
t
d‚|idjo7|i|9_t
|ƒ}||_|dj	|_nIt|t|dt
|ƒƒƒ}|iƒ|_|iƒ|_d|_|S(	sAdd other to self in place.iRs&Incorrect type for in-place operation.RRRiN(RR‘R,R}RIR½RiRVR.RHR4R’RR<R=R“RÓRpRGR‹R;(RR½RiR=RVR}RG((Rt__imul__ësF



		!	cCs	|iiƒ}t|dƒ}|iƒ}||jon<|tdjo1|tdjo|i	|ƒ}qvt
d‚nú|tdjoU|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n”|tdjoy|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n
t
d‚|idjo7|i|8_t
|ƒ}||_|dj	|_nIt|t|dt
|ƒƒƒ}|iƒ|_|iƒ|_d|_|S(	s"Subtract other from self in place.iRs&Incorrect type for in-place operation.RRRiN(RR‘R,R}RIR½RiRVR.RHR4R’RR<R=R“RÐRpRGR‹R;(RR½RiR=RVR}RG((Rt__isub__sF



		!	cCsâ|iiƒ}t|dƒ}|iƒ}||jon<|tdjo1|tdjo|i	|ƒ}qvt
d‚nú|tdjoU|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n”|tdjoy|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qv|tdjo|i	|ƒ}qvt
d‚n
t
d‚t|ƒ}t
|t|d|ƒƒ}|iƒ|_|iƒ}||ij	o||_d|_n|S(	sDivide self by other in place.iRs&Incorrect type for in-place operation.RRRiN(RR‘R,R}RIR½RiRVR.RHR4R<tmoRÕRpRGR‹R;tdmR’R“(RR½RçRiRVR}RæRG((Rt__idiv__CsB



		
cCs
t||ƒS(N(tequalRR½(RR½((Rt__eq__jscCs
t||ƒS(N(t	not_equalRR½(RR½((Rt__ne__mscCs
t||ƒS(N(R^RR½(RR½((Rt__lt__pscCs
t||ƒS(N(ReRR½(RR½((Rt__le__sscCs
t||ƒS(N(R]RR½(RR½((Rt__gt__vscCs
t||ƒS(N(t
greater_equalRR½(RR½((Rt__ge__yscCs;|ii|ƒ}|i|iiƒƒt|d|iƒS(s#return self as array of given type.RN(	RR‘RHR‡R…RDRŽRFR’(RR‡R…((RRH|scCs
|iiƒS(s‰Returns the raw data field, byte_swapped. Included for consistency
         with Numeric but doesn't make sense in this context.
        N(RR‘tbyte_swapped(R((RRò‚scCslti|iƒ}|idjot|ƒSn9dti|iƒ}ti	||ƒ}t|ddƒSdS(s'A 1-D array of all the non-masked data.iREiN(R*RKRR‘R…R’RRFR=tcompressRŒ(RR…R=RŒ((Rt
compressedˆsc
CsI|i}|ii}t|ƒ}|djo~|djodSn|djo|dSn|djot
d„|ƒSq¬||}t|ƒ}||=t|ƒ|Sn|djo]ti|ƒitƒ}t|ƒ}|djo|d}	ntii
|ƒ}	||	Sn0t||ƒ}t|itƒ|ƒ}	||	SdS(s?Count of the non-masked elements in a, or along a certain axis.iicCs||S(N(R-RŸ(R-RŸ((Rt<lambda>sN(RR’R=R‘R?RR¬tlsRR‚RR­tlistR}tonesR*RKRHtInttwR”tn1tn2RÇtsum(
RR‚R=R­RRöRúR}RûRü((Rtcount’s2	






cCs
t||ƒS(s%s.dot(other) = innerproduct(s, other)N(tinnerproductRR½(RR½((Rtdot°scCs|iS(sGet the current fill value.N(Rt_fill_value(R((RR:´scCs|i}|i}|djoD|iƒo|Sqcti|d|i	ƒddd|i
ƒƒSn|}|djo
|i
}n|tjoti|ƒ}|i|_ngyDti|d|i	ƒddd|i
ƒƒ}ti|||ƒWnti|||fƒ}nX|S(sðA Numeric array with masked values filled. If fill_value is None,
           use self.fill_value(). 
           
           If mask is None, copy data only if not contiguous.
           Result is always a contiguous, Numeric array.
        R,REiRDN(RR‘R…R’R=RRTR*RFR,RŽR:RSRRrRGR?tputmasktchoose(RR:RGR…R=RS((RRI¸s*		




cCst|iƒt|iƒfS(s)Return the ids of the data and mask areasN(tidRR‘R’(R((RtidsÖscCs
|iiƒS(sIs the data contiguous?N(RR‘RT(R((RRTÚscCs
|iiƒS(sItem size of each data item.N(RR‘titemsize(R((RRÞscCsG|i}|djo|Sn&|iƒo|Snti|iƒSdS(s1Return the data mask, or None. Result contiguous.N(RR’R=RRTR*RF(RR=((RRâs	

cCs
t||ƒS(s's.outer(other) = outerproduct(s, other)N(touterproductRR½(RR½((RR„ìscCsŽti|iƒƒ}|idjo
|}ntid|i|ƒ}t	|ƒt|ƒjo
td‚nti|i
|t|ƒƒdS(s\Set the non-masked entries of self to filled(values). 
           No change to mask
        is(x.put(values) incorrect count of values.N(R*tarangeRR”tiotaR’RtindRóR¬tvaluesRtputR‘RI(RRR
R	((RRðs

cCs–|idj	o‚ti|iƒƒ}ti|i|ƒ}t	|ƒt|ƒjo
td‚nti|i
|t|ƒƒd|_d|_ndS(s\Set the masked entries of self to filled(values). 
           Mask changed to None.
        s(x.put(values) incorrect count of values.iN(RR’RR*RR”R	RóR
R¬RRRR‘RIR“(RRR
R	((RRýs
	cCs|iS(s_ The raw data; portions may be meaningless. 
            May be noncontiguous. Expert use only.N(RR‘(R((RR‹
scCs|iS(sh The raw mask; portions may be meaningless. 
            May be noncontiguous. Expert use only.
        N(RR’(R((RR;scCs
|iiƒS(sGet the spacesaver attribute.N(RR‘RŽ(R((RRŽscCs|ii|ƒdS(s%Set the spacesaver attribute to valueN(RR‘RDRS(RRS((RRDscCs0|djot|iƒƒ}n||_dS(s3Set the fill value to v. Omit v to restore default.N(tvRR1RR‹R(RR
((RR9s
cCsT|ii}|djo/t|ƒdjodSqPtd„|ƒSn	||SdS(s5Number of elements in array, or in a particular axis.iicCs||S(N(R-RŸ(R-RŸ((RRõ*sN(RR‘R?RR‚RR¬R(RR‚R((RR”#s
cCs
|iiƒS(s.spacesaver() queries the spacesaver attribute.N(RR‘RŽ(R((RRŽ.scCs
|iiƒS(N(RR‘R,(R((RR,2scCs|i|ƒiƒS(sConvert to listN(RRIR:ttolist(RR:((RR5scCs|i|ƒiƒS(sConvert to stringN(RRIR:ttostring(RR:((RR9scCsT|idjodSnt|iddƒ}|djod|_d|_ndS(s%Replace the mask by None if possible.NRii(RR’RRLR=R“(RR=((RR®=s
	cCs9|io+t|iddddƒ|_d|_ndS(s'If currently sharing mask, make a copy.REiRiN(RR“RLR’(R((RR˜Es
tdocs#tuple giving the shape of the arraysAccess array in flat form.s!Access the real part of the arrays&Access the imaginary part of the array(\R	R
Rthandler_cache_keyRRR™RšRœRžR R¢R£R¥R¦RRR°R²RµR·R¹RºR»R¾RÀRÂt__rand__t__ror__t__rxor__RÃRÅRÆRÈt__radd__RÊRËRÍRÏRÑRÒRÔt__rmul__RÖR×RÙRÚRÜRÝRàRâRãRäRåRèRêRìRíRîRïRñRHRòRôRþRR:RIRRTRRR„RRR‹R;RŽRDR9R”R,RRR®R˜tpropertyR?RR¡R¤timag(((RR)sºS											
	/																													+	+	-	'									
						
		
	
												tMaskedScalarcBs tZd„ZeeiƒZRS(NcCs8ti|dgddgƒf|i_f|i_dS(NiRi(R)RRR‘R?R’(R((RR\s(R	R
RRR)RšR?(((RR[s	cCs
t|tƒS(s9Is x a masked array, that is, an instance of MaskedArray?N(RR-R)(R-((RR7esf1.0000000000000001e-05f1e-08cCsÍtt|ƒt|ƒƒ}t|ƒ}
t|ƒ}	tt|
ddd|ƒ|ƒi
tƒ}tt|	ddd|ƒdƒi
tƒ}titi||ƒ||ti|ƒƒ}titi|ƒƒS(s¥ Returns true if all components of a and b are equal
        subject to given tolerances.
        If fill_value is 1, masked values considered equal.
        If fill_value is 0, masked values considered unequal.
        The relative error rtol should be positive and << 1.0
        The absolute error atol comes into play for those elements
        of b that are very small or zero; it says how small a must be also.
    REiRiN(RQR<R8RWR=RIRmR|RFR:RHRR-RŸR*ReR/tatoltrtolR…talltrueRK(R8RWR:RRR…R=RŸR-R|Rm((Rtallclosels**0cCsàtt|ƒt|ƒƒ}|djoDt|ƒ}t|ƒ}t	i
||ƒ}t	it	i
|ƒƒSnq|oet|ƒ}t|ƒ}t	i
||ƒ}t|d|ddƒ}t	it	i
t|dƒƒƒSndSdS(s„
        True if all entries of  a and b are equal, using 
        fill_value as a truth value where either or both are masked.
    RREiiN(RQR<R8RWR=RRIR-RŸR*RéR…RRKR:RFRç(R8RWR:R…R=RçRŸR-((Rtallequal}s
#c	
Cs¨ti}t||ƒ}|iƒtdjobti	|||ƒ||||ƒƒ}t
|ddƒ}t|d|d|d|d|ƒSnt||||ƒSdS(	s´
       masked_values(data, value, rtol=1.e-5, atol=1.e-8)
       Create a masked array; mask is None if possible.
       If copy==0, and otherwise possible, result
       may share data values with original array.
       Let d = filled(data, value). Returns d 
       masked where abs(data-value)<= atol + rtol * abs(value)
       if d is of a floating point type. Otherwise returns
       masked_object(d, value, copy, savespace)
    RRiRRDRER:N(R*R/tabsRIRŠRSR…R,R.ReRRR=RLRFRDREt
masked_object(	RŠRSRRRERDRR=R…((Rt
masked_values‘s	*c
CsOt||ƒ}tti||ƒddƒ}t|d|d|d|d|ƒS(s5Create array masked where exactly data equal to valueRiRRERDR:N(RIRŠRSR…RLR*RéRçRFRERD(RŠRSRERDRçR…((RR §s
cCstti||||ƒƒS(sqJust like range() except it returns a array whose type can be specfied
    by the keyword argument typecode.
    N(RFR*t
arrayrangetstarttstoptstepR,(R#R$R%R,((RR"®scCstti||ƒƒS(sAConstruct a masked array from a string. Result will have no mask.N(RpR*t
fromstringRR}(RR}((RR&¶scCskt|ƒ}|djo&tit|ƒ|ƒ}t	|ƒSn)tit|dƒ|ƒ}t	||ƒSdS(sLeft shift n bitsiN(
R<R8R=RR*RÌRIR­R…Rp(R8R­R…R=((RR̺s
cCskt|ƒ}|djo&tit|ƒ|ƒ}t	|ƒSn)tit|dƒ|ƒ}t	||ƒSdS(sRight shift n bitsiN(
R<R8R=RR*RÎRIR­R…Rp(R8R­R…R=((RRÎÄs
cCsjt|ƒ}|dj	oti||ƒ}nttit|ƒ|ƒd|ƒ}|i
t|ƒƒ|S(swresize(a, new_shape) returns a new array with the specified shape.
    The original array's total size can be any size.RN(R<R8R=RR*R—t	new_shapeRFRIRGR9R:(R8R'R=RG((RR—Îs
$cCs­t|ƒ}t|tiƒo!t|gt|ƒ|ƒ}nt
|ƒ}|dj	ot
i|||ƒ}nt
i|||ƒ}t||ƒ}|it|ƒƒ|S(srepeat elements of a repeats times along axis
       repeats is a sequence of length a.shape[axis]
       telling how many times to repeat each element.
    N(RIR8tafRtrepeatsRR"ttupleR?R‚R<R=RR*trepeatR…RpRGR9R:(R8R)R‚R…RGR(R=((RR+Øs!
cCstti|ƒƒS(s<identity(n) returns the identity matrix of shape n x n.
    N(RFR*tidentityR­(R­((RR,éscCstti||ƒƒS(s„indices(dimensions,typecode=None) returns an array representing a grid
    of indices with row-only, and column-only variation.
    N(RFR*tindicest
dimensionsR,(R.R,((RR-îscCstti|||ƒƒS(s_zeros(n, typecode=Int, savespace=0) = 
     an array of all zeros of the given length or shape.N(RFR*RMR?R,RD(R?R,RD((RRMôscCstti|||ƒƒS(s]ones(n, typecode=Int, savespace=0) = 
     an array of all ones of the given length or shape.N(RFR*RøR?R,RD(R?R,RD((RRøùscCst|ƒ}|i|ƒS(s?Count of the non-masked elements in a, or along a certain axis.N(RpR8RþR‚(R8R‚((RRþÿsc	Cs|dj	o
td‚nt|ƒ}t|ƒ}t||ƒ}t
|dƒ}t
|dƒ}|i
ƒtdjotti||ƒ|ƒSntti|dƒddƒ}t||ƒ}|djotti||ƒƒSn/ti|d|ƒ}tti||ƒ|ƒSdS(sa**bs3-argument power not supported.iRiRN(RßRRR<R8RzRWR{RQR=RItfatfbR,R.RpR*RÞRLRetmdR~(	R8RWRßR1RzR{R=R/R0((RRÞs 


cCsV|djo-t|ƒo|iƒ}q:t|ƒ}nt|d|ddd|ƒS(s~masked_array(a, mask=None) = 
       array(a, mask=mask, copy=0, fill_value=fill_value)
       Use fill_value(a) if None.
    RREiR:N(R:RR7R8R1RFR(R8RR:((RRps

c
Cst|ƒ}|iƒ}	|i}|fjo
d
}n|djo2|	djoˆ|djo1ti	|i
ƒiƒ}
t	d„|dƒ}qst|dƒi}tii	|i
ƒi|ƒ}
tii	|ƒ}~qV|djo@ti	|iƒ}
ti|	dƒi}tii	|ƒ}~qVtt|dƒtid|	ƒi}ti	|i|ƒ}
ti	|ƒ}~nà|	djoc|djo-||d}tii	|i
ƒ|ƒ}
qVt|dƒ}|i}|fjo
d}n||joGti|tddƒ}ti	|||ƒ}
ti	||ƒ}~qV|||fjo…||}tgt|ƒ}tdddƒ||<tdtt|ƒƒd	ƒ}ti	|||ƒ}
ti	||ƒ}~~qVtd
‚np|djo@ti	||ƒ}
ti|	dƒ}tii	||ƒ}~n#t|dƒ}|i}|fjo
d}n||joGt|td|	ddƒ}ti	|||ƒ}
ti	||ƒ}n|||fjo||}tgt|ƒ}tdddƒ||<tdtt|ƒƒdƒ}ti	|||ƒ}
ti	||ƒ}n
td
‚~t|
|ƒ}~
t |t!ƒop|i"ƒ|o[t |t!ƒpt|ƒ}n|i|ijpt$|itƒ|}n|i"ƒqèn|o||fSn|SdS(sJaverage(a, axis=0, weights=None)
       Computes average along indicated axis. 
       If axis is None, average over the entire array
       Inputs can be integer or floating types; result is of type Float.
       
       If weights are given, result is sum(a*weights)/(sum(weights)*1.0)
       weights must have a's shape or be the 1-d with length the size
       of a in the given axis.

       If returned, return a tuple: the result and the sum of the weights 
       or count of values. Results will have the same shape.

       masked values in the weights will be set to 0.0
    icCs||S(N(R-RŸ(R-RŸ((RRõBsf1.0f0.0RREisw[s] * ones(ash, Float)saverage: weights wrong shape.s(] * masked_array(ones(ash, Float), mask)N(i(f1.0f0.0(i(f1.0f0.0(i(%RpR8RR?tashR‚RtweightsRÇRR‹RR­R…RIRúR*RRFRtwshtnitNewAxisR¬trtslicetevaltreprR*t
ValueErrorRÕRGRR)R®treturnedRø(
R8R‚R3R<RGR5R2R…R4RR­R7Rú((Rtaverage*s¢	





$

	



 


	



 	
cCstt|dƒdƒ}|tjod}
d}n0t|ƒ}
t|ƒ}|djo
d}n|tjod}	d}n0t|ƒ}	t|ƒ}|djo
d}nt
i||	|
fƒ}t
i|||fƒ}t|ƒ}tt||ƒddddƒ}t||ƒS(swhere(condition, x, y) is x where condition is nonzero, y otherwise.
       condition must be convertible to an integer array.
       Answer is always the shape of condition.
       The type depends on x and y. It is integer if both x and y are 
       the value masked.
    iiRERN(RIRët	conditiontfcR-RrtxvtxmR<RRŸtyvtymR*RR…R1R=RLRQRp(R>R-RŸR1RCR…RAR=R?RBR@((RR~–s*







!cCsÇd„}
d„}t|dƒ}g}|D]}	|||	ƒq,~}g}|D]}	||
|	ƒqS~}t
i||ƒ}t
i||ƒ}tt|t|ƒƒddddƒ}t||ƒS(s=Returns array shaped like indices with elements chosen from tcCs|tjodSnt|ƒS(Ni(R-RrRI(R-((Rtfmask´s
cCs:|tjodSnt|ƒ}|djodSn|S(Nii(R-RrR<R=R(R-R=((Rtnmask·s

iRERiN(RDRERIR-RŒt_[1]R}R-tmasksR8R*RR…R=RLRQR<Rp(R-R}R8RŒRER…R=RGRFR-RD((RR²s		'''cCs@t|dƒ}tt|ƒ|ƒ}tt|ƒd|d|ƒS(sjReturn x as an array masked where condition is true. 
       Also masked where x or condition masked.
    iRERN(	RIR>tcmRQR<R-R=RFRE(R>R-RERHR=((Rtmasked_whereÄscCstt||ƒ||ƒS(s3masked_greater(x, value) = x masked where x > valueN(RIR]R-RSRE(R-RSRE((Rtmasked_greaterÌscCstt||ƒ||ƒS(s:masked_greater_equal(x, value) = x masked where x >= valueN(RIRðR-RSRE(R-RSRE((Rtmasked_greater_equalÐscCstt||ƒ||ƒS(s0masked_less(x, value) = x masked where x < valueN(RIR^R-RSRE(R-RSRE((Rtmasked_lessÔscCstt||ƒ||ƒS(s7masked_less_equal(x, value) = x masked where x <= valueN(RIReR-RSRE(R-RSRE((Rtmasked_less_equalØscCsLt|dƒ}ti||ƒ}t|t|ƒƒ}t
|d|d|ƒS(s6masked_not_equal(x, value) = x masked where x != valueiRREN(RIR-R…R*RëRSRŒRQR<R=RFRE(R-RSRERŒR…R=((Rtmasked_not_equalÜs
cCsLt|dƒ}ti||ƒ}t|t|ƒƒ}t
|d|d|ƒS(s{masked_equal(x, value) = x masked where x == value
       For floating point consider masked_values(x, value) instead.
    iRREN(RIR-R…R*RéRSRŒRQR<R=RFRE(R-RSRERŒR…R=((Rtmasked_equalãs
cCs‡||jo|}|}|}nt|dƒ}titi||ƒti	||ƒƒ}t|t|ƒƒ}t|d|d|ƒS(sjx with mask of all values of x that are inside [v1,v2]
       v1 and v2 can be given in either order.
    iRREN(tv2tv1R}RIR-R…R*RƒReRðRŒRQR<R=RFRE(R-RQRPRERŒR…R=R}((Rt
masked_insideìs

*cCs‡||jo|}|}|}nt|dƒ}titi||ƒti	||ƒƒ}t|t|ƒƒ}t|d|d|ƒS(skx with mask of all values of x that are outside [v1,v2]
       v1 and v2 can be given in either order.
    iRREN(RPRQR}RIR-R…R*RPR^R]RŒRQR<R=RFRE(R-RQRPRERŒR…R=R}((Rtmasked_outsideùs

*cCs_t|ƒ}tit|ƒ|ƒ}|djot	|ƒSnt	|dti||ƒƒSdS(sCopy of a with a new shape.RN(
R<R8R=R*treshapeRIR›R…RRp(R8R›R…R=((RRTs
cCsYt|ƒ}tit|ƒƒ}|djot|ƒSnt|dti|ƒƒSdS(s-a as one-dimensional, may share data and maskRN(	R<R8R=R*RKRIR…RRp(R8R…R=((RRKs
cCs»g}x!|D]}|it|ƒƒq
Wti||ƒ}x0|D]}t|ƒdj	oPqCqCWt
|ƒSg}x!|D]}|it|ƒƒq|Wti||ƒ}t
|d|ƒS(s+Concatenate the arrays along the given axisRN(
R…tarraysR-tappendRIR*tconcatenateR‚R<RRpRçR@(RUR‚RçR…R-((RRWs"	
cCszt|ƒ}t|ƒiƒ}|djotti|||ƒƒSn/tti|||ƒdti|||ƒƒSdS(s;take(a, indices, axis=0) returns selection of items from a.RN(R<R8R=RpR‹R…RR*ttakeR-R‚(R8R-R‚R…R=((RRX(s
cCskt|ƒ}t|ƒ}|djotti||ƒƒSn)tti||ƒdti||ƒƒSdS(s9transpose(a, axes=None) reorder dimensions per tuple axesRN(
R<R8R=RIR…RRpR*t	transposetaxes(R8RZR…R=((RRY2s
cCs{|iƒ}t|ƒ}t|ƒ}ti	|||ƒt
|ƒ}|dj	o'|i
ƒti	|iƒ|dƒndS(s{put(a, indices, values) sets storage-indexed locations to corresponding values. values and indices are filled if necessary.iN(R8R‹R…RIR-R
RR
R*RR<R=RR˜R;(R8R-RR…R=R
R
((RR<s

cCsv|djodSnti|iƒ||ƒt|ƒ}|djodSn|i	ƒti|i
ƒ|dƒdS(s0put (a, mask, values) sets a where mask is true.Ni(RRR*RR8R‹RR<R=R˜R;(R8RRR=((RRGs


cCszt|dƒ}t|dƒ}t|iƒdjo
d|_nt|iƒdjo
d|_ntti	||ƒƒS(sþinnerproduct(a,b) returns the dot product of two arrays, which has
    shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
    product of the elements from the last dimensions of a and b.
    Masked elements are replace by zeros.
    iiN(i(i(
RIR8R/RWR0R¬R?RpR*Rÿ(R8RWR/R0((RRÿQs

cCsÅt|dƒi}t|dƒi}ti||ƒ}t	|ƒ}t	|ƒ}|djo|djot
|ƒSnt|ƒ}t|ƒ}tdtid|d|ƒddƒ}t
||ƒS(s:outerproduct(a,b) = {a[i]*b[j]}, has shape (len(a),len(b))iiREN(RIR8RR/RWR0R*RR…R<RzR{RRpR@RLR=(R8RWRzR…R{R=R/R0((RR]s*cCs.tt|dƒtit|dƒddƒƒS(sØdot(a,b) returns matrix-multiplication between a and b.  The product-sum
    is over the last dimension of a and the second-to-last dimension of b.
    Masked values are replaced by zeros. See also innerproduct.
    iiÿÿÿÿiþÿÿÿN(RÿRIR8R*tswapaxesRW(R8RW((RRksiÿÿÿÿcCsit|dƒ}t|ƒ}|dj	oti|||ƒ}nti|t|ƒ|ƒ}t||ƒS(sqSelect those parts of x for which condition is true.
       Masked values in condition are considered false.
    iN(RIR>RŒR<R-R=RR*Rót	dimensionR…Rp(R>R-R\RŒR…R=((RRórs
t_minimum_operationcBs8tZdZd„Zed„Zdd„Zd„ZRS(sObject to calculate minimacCsdS(s`minimum(a, b) or minimum(a)
           In one argument case returns the scalar minimum.
        N((R((RRscCsŸ|djoqt|ƒ}|djott|ƒiƒ}|Sn|i	ƒ}t|ƒdjotSq›t|i
ƒƒSntt||ƒ||ƒdSdS(sExecute the call behavior.i.N(RWRR<R8R=tminRIRR…RôtacR¬RrR‹R~R^(RR8RWR…R=R_((RR_…s

icCs•t|ƒ}|djo)t|ƒ}ttii	||ƒƒSnPtii	t|t|ƒƒ|ƒ}tii	||ƒ}t||t
|ƒƒSdS(s#Reduce target along the given axis.N(R<R€R=RRIR}RpR*tminimumRR‚R5RƒR:(RR€R‚R=R}((RR”s
$cCs”t|ƒ}t|ƒ}|djo|djo
d}n+t|ƒ}t|ƒ}ti	||ƒ}t
ii	t|ƒt|ƒƒ}t||ƒS(s<Return the function applied to the outer product of a and b.N(R<R8RzRWR{RR=R@RPR„R*R`RIR…Rp(RR8RWRzR…R{R=((RR„Ÿs
!(R	R
RRRR_RR„(((RR]}s
	t_maximum_operationcBs8tZdZd„Zed„Zdd„Zd„ZRS(sObject to calculate maximacCsdS(s`maximum(a, b) or maximum(a)
           In one argument case returns the scalar maximum.
        N((R((RR°scCsŸ|djoqt|ƒ}|djott|ƒiƒ}|Sn|i	ƒ}t|ƒdjotSq›t|i
ƒƒSntt||ƒ||ƒdSdS(sExecute the call behavior.i.N(RWRR<R8R=tmaxRIRR…RôR_R¬RrR‹R~R](RR8RWR…R=R_((RR_¶s

icCs•t|ƒ}|djo)t|ƒ}ttii	||ƒƒSnPtii	t|t|ƒƒ|ƒ}tii	||ƒ}t||t
|ƒƒSdS(s#Reduce target along the given axis.N(R<R€R=RRIR}RpR*tmaximumRR‚R6RƒR:(RR€R‚R=R}((RRÅs
$cCs”t|ƒ}t|ƒ}|djo|djo
d}n+t|ƒ}t|ƒ}ti	||ƒ}t
ii	t|ƒt|ƒƒ}t||ƒS(s<Return the function applied to the outer product of a and b.N(R<R8RzRWR{RR=R@RPR„R*RcRIR…Rp(RR8RWRzR…R{R=((RR„Ðs
!(R	R
RRRR_RR„(((RRa®s
	cCsr|djot|ƒ}nt||ƒ}ti||ƒ}t
|ƒdjot|ƒSnt||ddƒS(s±If x does not have a mask, return a masked array formed from the 
       result of Numeric.sort(x, axis).
       Otherwise, fill x with fill_value. Sort it. 
       Set a mask where the result is equal to fill_value.
       Note that this may have unintended consequences if the data contains the
       fill value at a non-masked site.

       If fill_value is not given the default fill value for x's type will be
       used.
    REiN(
R:RR1R-RIR…R*tsortR‚RR<RpR!(R-R‚R:R…R((RRdßs

cCsktit|ƒ|||ƒ}t|ƒ}|djot||ƒSn t|ti||||ƒƒSdS(s9diagonal(a,k=0,axis1=0, axis2=1) = the k'th diagonal of aN(R*tdiagonalRIR8tktaxis1taxis2R…R<R=RRp(R8RfRgRhR=R…((RReòs
cCst||ƒ}ti||ƒS(sÊTreating masked values as if they have the value fill_value,
       return sort indices for sorting along given axis.
       if fill_value is None, use fill_value(x)
       Returns a Numeric array.
    N(RIR-R:R…R*targsortR‚(R-R‚R:R…((RRiûscCst||ƒ}ti||ƒS(sTreating masked values as if they have the value fill_value,
       return indices for minimum values along given axis.
       if fill_value is None, use fill_value(x).
       Returns a Numeric array if x has more than one dimension.
       Otherwise, returns a scalar index.
    N(RIR-R:R…R*targminR‚(R-R‚R:R…((RRjscCsQ|djo%t|ƒ}y|}Wq2q2Xnt||ƒ}ti||ƒS(s$Treating masked values as if they have the value fill_value,
       return sort indices for maximum along given axis.
       if fill_value is None, use -fill_value(x) if it exists.
       Returns a Numeric array if x has more than one dimension.
       Otherwise, returns a scalar index.
    N(	R:RR1R-RIR…R*targmaxR‚(R-R‚R:R…((RRks
cCstti||ƒƒS(s+apply f to s to create array as in Numeric.N(RpR*tfromfunctionRiR(RiR((RRlscCsNt|tƒo(|djp||iƒjo|Snt|d|ddƒS(s¥asarray(data, typecode=None) = array(data, typecode=None, copy=0)
       Returns data if typecode if data is a MaskedArray and typecode None
       or the same.
    R,REiN(RRŠR)R,RRF(RŠR,((Rtasarray"s0i,cCs»|i}tii|ƒ}|tjost|ƒdjo0dt	i
tt|ƒdƒ|i
ƒ|fSq·ti|t |||ddƒd|tSnti||||ddƒSdS(s9Calculate string representation, limiting size of output.is'array (%s) , type = %s, has %d elementst,is
 + %d more elementsN(R8R?RR*RÓRtelemst
__MaxElementsR¬tstringtjointmapRR,tarray2stringtmax_line_widtht	precisiontsuppress_small(R8RuRvRwRoR((RtlimitedArrayRepr/s	
0cCs”dk}t|ƒ}|a|djo6tt_tt_	|i
tdƒ|i
tdƒn3tt_tt_	|i
tdƒ|i
tdƒdS(sBSet the maximum # of elements for printing arrays. <=0  = no limitNii(t
multiarrayR±R=R­Rpt__original_strR*t	array_strt__original_reprt
array_reprtset_string_functionRx(R=RyR­((Rtset_print_limitCs	
				cCstS(s3Get the maximum # of elements for printing arrays. N(Rp(((Rtget_print_limitTs(©RR*RqRR2t	PrecisionRtpiR6tInt0RBRut	ExceptionRR
R§RFRHtFloat32R!t	Complex32R(R&tUnsignedInt8R$R0R1R5R6R9R<R@RCRLR>tcreate_maskRQRRIR:RYRZR`RcRfRgRsRvRRátlogtlog10texpt	conjugatetsinRbttantarcsintarccostarctantsinhtcoshttanhR/tfabsRÄtnonzerotaroundtfloortceilRJRtlogical_notRÇRÐRRÓRÕRØRÛRÉtfmodthypottarctan2RéRëReRðR^R]RƒRPtlogical_xorR¼R¿RÁtrankR?R”tobjectR)RRrR7tisarraytisMARRR!R R"RR&RÌRÎR—R+R,R-RùRMRøRþRÞRpRýtproductR=R~RRIRJRKRLRMRNRORRRSRTRKRWRXRYRRRÿRRRóR]R`RaRcRdReRiRjRkRlRmRpRxR{RzR}R|RR€(šRLRˆRzR^RRRR£R?R€R0RaRpRRÇRR6R,R—R™RøRŸRvRqR¡R"R¿RR*R>R›R-R¼R~RkR)R“RœRƒRRR–RmRýRÓRrR!RIRWRÞRKRYReROR’R9RÉR+RbR1RRRéRsRiRReR R§RÕRZR$RRgRBRCRFR”RžRxR‰RJRÐRÄRuRRLR`RSRMRYR‚RŠRdR(RRR—RRþRëRlRjR”RØRcRKR|R]RRÌRcRMRPR`RJRŒRÿRŽR/RÁR]R•R˜RNRTRáR‘R<RÎRXR6RÛRQRRfR7RóRIR2R5RRR&RšRðR&R=R:R
R!R‹R@R¢R((RRsH																



',K											ÿÿÿ[				
	
	
			l			

				

		
			/	/			
				

Anon7 - 2021