/usr/local/lib64/python3.6/site-packages/numpy/ma/__pycache__
NameSizeModeActions
bench.cpython-36.pyc37990644editdlrm
core.cpython-36.pyc2162430644editdlrm
extras.cpython-36.pyc516770644editdlrm
mrecords.cpython-36.pyc217270644editdlrm
setup.cpython-36.pyc5390644editdlrm
testutils.cpython-36.pyc82100644editdlrm
timer_comparison.cpython-36.pyc112750644editdlrm
__init__.cpython-36.pyc15320644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/numpy/ma/__pycache__/testutils.cpython-36.pyc (8210B)
3 Eg;(@sLdZddlZddlZddlmZmZddljjZddl Zddl m Z m Z m Z m Z mZddlmZmZmZmZmZmZddd d d d d dddddddgZddlmZdddddgZeeZd1ddZd2d dZd3d"d#Zd$dZd4d%dZd5d&d'ZeZ d6d)d Z!e!Z"d7d*d Z#d8d+d Z$d9d,dZ%d:d-d Z&d;d.d Z'dzMiscellaneous functions for testing masked arrays and subclasses :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu :version: $Id: testutils.py 3529 2007-11-13 08:01:14Z jarrod.millman $ N)ndarrayfloat_)assert_assert_allcloseassert_array_almost_equal_nulp assert_raises build_err_msg)mask_orgetmask masked_arraynomaskmaskedfilledalmostapproxassert_almost_equalassert_array_almost_equalassert_array_approx_equalassert_array_compareassert_array_equalassert_array_less assert_close assert_equalassert_equal_recordsassert_mask_equalassert_not_equalfail_if_array_equal)TestCaserrrrrTh㈵>:0yE>c Cstt|t|}t|}t|}|jjdks:|jjdkrJtj||jStt|d|d|j t }tt|d|ddj t } tj t j || ||t j | } | jS)a Returns true if all components of a and b are equal to given tolerances. If fill_value is True, masked values considered equal. Otherwise, masked values are 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. OF)copymaskr )r r rdtypecharnpequalravelr astyperZ less_equalumathabsolute) ab fill_valuertolZatolmd1d2xydr6>/usr/local/lib64/python3.6/site-packages/numpy/ma/testutils.pyr)s $c Cstt|t|}t|}t|}|jjdks:|jjdkrJtj||jStt|d|d|j t }tt|d|ddj t }tj tj |||d| k} | jS)z Returns True if a and b are equal up to decimal places. If fill_value is True, masked values considered equal. Otherwise, masked values are considered unequal. r!F)r"r#r g$@) r r rr$r%r&r'r(r r)rZaroundabs) r,r-decimalr.r0r1r2r3r4r5r6r6r7r?s cCsJtt|t||x0tt|D] }t||||d||fq"WdS)z; Asserts the equality of two non-array sequences. z item=%r %sN)rlenrange)actualdesirederr_msgkr6r6r7_assert_equal_on_sequencesRs rBcCsht|j|jxT|jjD]H}tj||tj||}}|tk r|tk rttj||tj||qWdS)zI Asserts that two records are equal. Pretty crude for now. N)rr$namesoperatorgetitemr)r,r-fafZbfr6r6r7r]s cCst|trt|ts$ttt|tt|t||xH|jD]<\}}||krbtd||ft||||d||fqBWdSt|tt frt|tt frt ||ddSt|t pt|t st ||g|}||kst|dS|t ko|t k s |t kr(|t k r(t ||g|dd d}t|tj|d d d }tj|d d d }|j|j}}|jd kr|jd krt |j|jddSt|||S)z, Asserts that two items are equal. z %s not in %sz key=%r %sNr;)r@r3r4)headerrCFT)r"subokS)r3r4) isinstancedictAssertionErrorreprtyperr<itemslisttuplerBrrr ValueErrorr&arrayr$r%tolistr)r>r?r@rAimsgZ actual_dtypeZ desired_dtyper6r6r7rls:    cCs4t|trt|ts$ttt|tt|t||xD|jD]8\}}||kr^tt|t||||d||fqBWdSt|tt frt|tt frtt|t||x0t t|D] }t||||d||fqWdSt|t j st|t j rt |||St||g|}||ks0t|dS)z< Raises an assertion error if two items are equal. z key=%r %sNz item=%r %s)rKrLrMrNrO fail_if_equalr<rPrQrRr=r&rrr)r>r?r@rArVrWr6r6r7rXs&       rXcCs^t|tjst|tjr*t|||||dSt||g||d}tt|||dksZt|dS)z~ Asserts that two items are almost equal. The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal). )r:r@verbose)r@rZrN)rKr&rrrroundr9rM)r>r?r:r@rZrWr6r6r7rs  c Cstt|t|}t|d|ddd}t|d|ddd}|tkrF|tk sV|tkrt|tk rtt||g|||dd}t|tjj||j ||j ||||dS)zn Asserts that comparison between two masked arrays is satisfied. The comparison is elementwise. F)r"r#Z keep_maskrIr3r4)r@rZrHrC)r@rZrH)r3r4) r r r rrrSr&Ztestingrr) Z comparisonr3r4r@rZrHr.r0rWr6r6r7rs   cCsttj||||dddS)z@ Checks the elementwise equality of two masked arrays. zArrays are not equal)r@rZrHN)rrD__eq__)r3r4r@rZr6r6r7rs cCs dd}t|||||dddS)zT Raises an assertion error if two masked arrays are not equal elementwise. cSstjt|| S)N)r&Zalltruer)r3r4r6r6r7comparesz$fail_if_array_equal..comparezArrays are not equal)r@rZrHN)r)r3r4r@rZr]r6r6r7rs cs$fdd}t|||||dddS)z| Checks the equality of two masked arrays, up to given number odecimals. The equality is checked elementwise. cst||d dS)z.comparezArrays are not almost equal)r@rZrHN)r)r3r4r:r@rZr]r6)r:r7rs  cs$fdd}t|||||dddS)z| Checks the equality of two masked arrays, up to given number odecimals. The equality is checked elementwise. cs t||S)z.comparezArrays are not almost equal)r@rZrHN)r)r3r4r:r@rZr]r6)r:r7rs  cCsttj||||dddS)z7 Checks that x is smaller than y elementwise. zArrays are not less-ordered)r@rZrHN)rrD__lt__)r3r4r@rZr6r6r7r s cCs:|tkrt|tk|tkr(t|tkt|||ddS)z- Asserts the equality of two masks. )r@N)r rr)m1m2r@r6r6r7rs   )Trr )r8T)r;)r;)r;)rYr;T)r;Tr;T)r;T)r;T)r8r;T)r8r;T)r;T)r;)*__doc__rDZnumpyr&rrZnumpy.core.umathcorer*Z numpy.testingrrrrrr r r r rrZ __all__maskedZunittestrZ__some__from_testing__all__rrrBrrrXrrrrrrrrrrr6r6r6r7sB       '