Ńň ]ĐKc@sÝdZddkZddkZddkZddkZddkZddkZddklZdddddd d d d d dddddddddddddgZ dZ dd„Z d„Z d„Z d „Zd!„Zeid" d#jo3d$eiƒgd%„Zd$eiƒd&„Zngd'„Zd(„Zeid)jo<eid* d+jo(ddddd,„Zd-dd.„Znd/edPd2„Zded3„Zd4„Zd5ded6„Zd5ded7„Zdedd8„Zded9„Zd:ded;„Z ded<„Z!d=„Z"d>„Z#ded?„Z$d@„Z%dA„Z&ddB„Z'dCddD„Z(dE„Z)dCdF„Z*dCddG„Z+ddH„Z,dI„Z-dJ„Z.dKe/fdL„ƒYZ0dMdQdN„ƒYZ1dO„Z2dS(Rs) Utility function to facilitate testing. i˙˙˙˙N(t import_noset assert_equaltassert_almost_equaltassert_approx_equaltassert_array_equaltassert_array_lesstassert_string_equaltassert_array_almost_equalt assert_raisest build_err_msgtdecorate_methodstjiffiestmemusagetprint_assert_equaltraisestrandtrundocst runstringtverbosetmeasuretassert_tassert_array_almost_equal_nulptassert_array_max_ulpt assert_warnsitcCs|pt|ƒ‚ndS(s Assert that works in release mode. The Python built-in ``assert`` does not work when executing code in optimized mode (the ``-O`` flag) - no byte-code is generated for it. For documentation on usage, refer to the Python documentation. N(tAssertionError(tvaltmsg((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRs cCsCddkl}||ƒ}t|tiƒotdƒ‚n|S(slike isnan, but always raise an error if type not supported instead of returning a TypeError object. Notes ----- isnan and other ufunc sometimes return a NotImplementedType object instead of raising any exception. This function is a wrapper to make sure an exception is always raised. This should be removed once this problem is solved at the Ufunc level.i˙˙˙˙(tisnans!isnan not supported for this type(t numpy.coreRt isinstancettypestNotImplementedTypet TypeError(txRtst((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytgisnan$s  cCsCddkl}||ƒ}t|tiƒotdƒ‚n|S(s‡like isfinite, but always raise an error if type not supported instead of returning a TypeError object. Notes ----- isfinite and other ufunc sometimes return a NotImplementedType object instead of raising any exception. This function is a wrapper to make sure an exception is always raised. This should be removed once this problem is solved at the Ufunc level.i˙˙˙˙(tisfinites$isfinite not supported for this type(RR%RRR R!(R"R%R#((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyt gisfinite5s  cCsCddkl}||ƒ}t|tiƒotdƒ‚n|S(slike isinf, but always raise an error if type not supported instead of returning a TypeError object. Notes ----- isinf and other ufunc sometimes return a NotImplementedType object instead of raising any exception. This function is a wrapper to make sure an exception is always raised. This should be removed once this problem is solved at the Ufunc level.i˙˙˙˙(tisinfs!isinf not supported for this type(RR'RRR R!(R"R'R#((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytgisinfFs  cGskddk}ddkl}l}|||ƒ}|i}x*tt|ƒƒD]}|iƒ||R6((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR ‚s cCs t‚dS(s9 Return memory usage of running python. [Not implemented]N(tNotImplementedError(((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR ‰stntis2.3c Csźddk}|djo |i}n|i|||d||fƒ}|iƒ}zT|i||ƒ} z-|i|ƒ|i| |ƒ\} } | SWd|i| ƒXWd|i |ƒXdS(Ni˙˙˙˙( twin32pdhtNonet PDH_FMT_LONGtMakeCounterPatht OpenQueryt AddCountertCollectQueryDatatGetFormattedCounterValuet RemoveCountert CloseQuery( tobjecttcountertinstancetinumtformattmachineRBtpaththqthcttypeR((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytGetPerformanceAttributess  !  tpythoncCs(ddk}tdd|||idƒS(Ni˙˙˙˙tProcesss Virtual Bytes(RBRVRDRC(t processNameRNRB((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR ¨s  sItems are not equal:tACTUALtDESIREDc Csd|g}|o]|idƒdjo6t|ƒdt|ƒjo|dd|g}qq|i|ƒn|o™x–t|ƒD]„\}}yt|ƒ}Wn d}nX|idƒdjo'di|iƒd ƒ}|d7}n|id |||fƒq…Wndi|ƒS( Ns i˙˙˙˙iOiR5s [repr failed]is...s %s: %s(tfindR.R7t enumeratetreprtcounttjoint splitlines( tarraysterr_msgtheaderRtnamesRR2taR4((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR Żs" 3  #cCs#t|tƒoľt|tƒpttt|ƒƒƒ‚ntt|ƒt|ƒ||ƒxb|iƒD]T\}}||jott|ƒƒ‚nt||||d||f|ƒqhWdSt|tt fƒo|t|tt fƒoftt|ƒt|ƒ||ƒx?t t|ƒƒD]+}t||||d||f|ƒq#WdSddk l }l }l}ddkl} l} l} t||ƒpt||ƒot||||ƒSt||g|d|ƒ} y| |ƒp | |ƒ} Wntj o t} nX| oÄ| |ƒo| |ƒ}| |ƒ}n |}d}| |ƒo| |ƒ}| |ƒ}n |}d}yt||ƒt||ƒWqâtj o)td t|ƒt|ƒfƒ‚qâXnyř||ƒ||ƒjot| ƒ‚nt|ƒo t|ƒpjt|ƒ}t|ƒ}|p|o"|o|pt| ƒ‚qn||jpt| ƒ‚ndS|djo:|djo-||ƒ||ƒjpt| ƒ‚qŮnWn%tj ontj onX||jot| ƒ‚ndS( s[ Raise an assertion if two objects are not equal. Given two objects (lists, tuples, dictionaries or numpy arrays), check that all elements of these objects are equal. An exception is raised at the first conflicting values. Parameters ---------- actual : list, tuple, dict or ndarray The object to check. desired : list, tuple, dict or ndarray The expected object. err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired are not equal. Examples -------- >>> np.testing.assert_equal([4,5], [4,6]) ... : Items are not equal: item=1 ACTUAL: 5 DESIRED: 6 s key=%r %sNs item=%r %si˙˙˙˙(tndarraytisscalartsignbit(t iscomplexobjtrealtimagRis,Items are not equal: ACTUAL: %s DESIRED: %s (RtdictRR^RURR.titemstlistttupleR-RRgRhRit numpy.libRjRkRlRR t ValueErrortFalsetstrR&R$R!(tactualtdesiredRcRtkR2RgRhRiRjRkRlRt usecomplextactualrtactualitdesiredrtdesireditisdesnantisactnan((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRÄs~#  ),)       %    cCsŻddk}y||jpt‚Wn„tj oxddk}|iƒ}|i|ƒ|idƒ|i||ƒ|idƒ|i||ƒt|iƒƒ‚nXdS(sľ Test if two objects are equal, and print an error message if test fails. The test is performed with ``actual == desired``. Parameters ---------- test_string : str The message supplied to AssertionError. actual : object The object to test for equality against `desired`. desired : object The expected result. Examples -------- >>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 1]) >>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 2]) Traceback (most recent call last): ... AssertionError: Test XYZ of func xyz failed ACTUAL: [0, 1] DESIRED: [0, 2] i˙˙˙˙Ns failed ACTUAL: s DESIRED: (tpprintRt cStringIOtStringIOtwritetgetvalue(t test_stringRuRvRR€R((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR 7s      icCsuddkl}ddkl}l}l}y||ƒp ||ƒ} Wntj o t} nX| oĐ||ƒo||ƒ} ||ƒ} n |} d} ||ƒo||ƒ} ||ƒ} n |} d} y*t| | d|ƒt| | d|ƒWq<t j o)t dt |ƒt |ƒfƒ‚q<Xnt ||t t fƒpt ||t t fƒot||||ƒSt||g|d|dd ƒ}yˆt|ƒo t|ƒpjt|ƒp t|ƒo.t|ƒo t|ƒpt |ƒ‚q%n||jpt |ƒ‚nd SWntj onXtt||ƒ|ƒdjot |ƒ‚nd S( sC Raise an assertion if two items are not equal up to desired precision. The test is equivalent to abs(desired-actual) < 0.5 * 10**(-decimal) Given two objects (numbers or ndarrays), check that all elements of these objects are almost equal. An exception is raised at conflicting values. For ndarrays this delegates to assert_array_almost_equal Parameters ---------- actual : number or ndarray The object to check. desired : number or ndarray The expected object. decimal : integer (decimal=7) desired precision err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired are not equal up to specified precision. See Also -------- assert_array_almost_equal: compares array_like objects assert_equal: tests objects for equality Examples -------- >>> npt.assert_almost_equal(2.3333333333333, 2.33333334) >>> npt.assert_almost_equal(2.3333333333333, 2.33333334, decimal=10) ... : Items are not equal: ACTUAL: 2.3333333333333002 DESIRED: 2.3333333399999998 >>> npt.assert_almost_equal(np.array([1.0,2.3333333333333]), np.array([1.0,2.33333334]), decimal=9) ... : Arrays are not almost equal (mismatch 50.0%) x: array([ 1. , 2.33333333]) y: array([ 1. , 2.33333334]) i˙˙˙˙(Rg(RjRkRlitdecimals,Items are not equal: ACTUAL: %s DESIRED: %s RRdsArrays are not almost equalN(RRgRqRjRkRlRrRsRRRtRRpRoRR R&R$R!troundtabs(RuRvR…RcRRgRjRkRlRxRyRzR{R|R((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR`sP7     %    c CsÓddk}tt||fƒ\}}||jodSd|i|ƒ|i|ƒ}|id|i|i|ƒƒƒ}y||}Wntj o d}nXy||}Wntj o d}nXt||g|dd|d|ƒ} yˆt |ƒo t |ƒpjt |ƒp t |ƒo.t |ƒo t |ƒpt | ƒ‚qxn||jpt | ƒ‚ndSWnt j onX|i||ƒ|id |d  ƒjot | ƒ‚ndS( s Raise an assertion if two items are not equal up to significant digits. Given two numbers, check that they are approximately equal. Approximately equal is defined as the number of significant digits that agree. Parameters ---------- actual : number The object to check. desired : number The expected object. significant : integer (significant=7) desired precision err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired are not equal up to specified precision. See Also -------- assert_almost_equal: compares objects by decimals assert_array_almost_equal: compares array_like objects by decimals assert_equal: tests objects for equality Examples -------- >>> np.testing.assert_approx_equal(0.12345677777777e-20, 0.1234567e-20) >>> np.testing.assert_approx_equal(0.12345670e-20, 0.12345671e-20, significant=8) >>> np.testing.assert_approx_equal(0.12345670e-20, 0.12345672e-20, significant=8) ... : Items are not equal to 8 significant digits: ACTUAL: 1.234567e-021 DESIRED: 1.2345672000000001e-021 the evaluated condition that raises the exception is >>> abs(0.12345670e-20/1e-21 - 0.12345672e-20/1e-21) >= 10**-(8-1) True i˙˙˙˙Ngŕ?i gRds-Items are not equal to %d significant digits:Rg$@i( tnumpytmaptfloatR‡tpowertfloortlog10tZeroDivisionErrorR R&R$RR!( RuRvt significantRcRtnptscalet sc_desiredt sc_actualR((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRÎs<4   $     +cCsddkl}l}l}||dtdtƒ}||dtdtƒ}d„} yd|idjp |idjp|i|ij} | pVt||g|d|i|ifd|d|d dƒ} | pt| ƒ‚qçn| |ƒo0| |ƒoě|||ƒƒp|||ƒƒoĆ||ƒ} ||ƒ} yt | | ƒWnTtj oHt||g|d | | fd|d|d dƒ} t| ƒ‚nX|i |i jo d jnodS||| || ƒ}n|||ƒ}t |t ƒo|} dg}n%|i ƒ}|iƒ} |iƒ}| pndd|id ƒt|ƒ}t||g|d|fd|d|d dƒ} | pt| ƒ‚q¸nWnFtj o:t||g|d|d|d dƒ} t| ƒ‚nXdS(Ni˙˙˙˙(tarrayRtanytcopytsubokcSs|iidjS(Ns?bhilqpBHILQPfdgFDG(tdtypetchar(R"((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytisnumber-ss (shapes %s, %s mismatch)RRdReR"tys0 (x and y nan location mismatch %s, %s mismatch)iiidgY@s (mismatch %s%%)(((R"R›(R"R›(R"R›(R"R›(RR”RR•RstTruetshapeR RRtsizeRtbooltraveltallttolistR_R.Rr(t comparisonR"R›RcRRdR”RR•RštcondRtxnanidtynanidRtreducedtmatch((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytassert_array_compare'sf 2    @     $    !    c Cs)tti||d|d|ddƒdS(sý Raise an assertion if two array_like objects are not equal. Given two array_like objects, check that the shape is equal and all elements of these objects are equal. An exception is raised at shape mismatch or conflicting values. In contrast to the standard usage in numpy, NaNs are compared like numbers, no assertion is raised if both objects have NaNs in the same positions. The usual caution for verifying equality with floating point numbers is advised. Parameters ---------- x : array_like The actual object to check. y : array_like The desired, expected object. err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired objects are not equal. See Also -------- assert_array_almost_equal: test objects for equality up to precision assert_equal: tests objects for equality Examples -------- the first assert does not raise an exception >>> np.testing.assert_array_equal([1.0,2.33333,np.nan], [np.exp(0),2.33333, np.nan]) assert fails with numerical inprecision with floats >>> np.testing.assert_array_equal([1.0,np.pi,np.nan], [1, np.sqrt(np.pi)**2, np.nan]) ... : AssertionError: Arrays are not equal (mismatch 50.0%) x: array([ 1. , 3.14159265, NaN]) y: array([ 1. , 3.14159265, NaN]) use assert_array_almost_equal for these cases instead >>> np.testing.assert_array_almost_equal([1.0,np.pi,np.nan], [1, np.sqrt(np.pi)**2, np.nan], decimal=15) RcRRdsArrays are not equalN(RŠtoperatort__eq__(R"R›RcR((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRgs=ics€ddkl‰l‰l‰ddkl‰ddkl‰‡‡‡‡‡‡fd†}t|||d|d|dd ƒd S( s Raise an assertion if two objects are not equal up to desired precision. The test verifies identical shapes and verifies values with abs(desired-actual) < 0.5 * 10**(-decimal) Given two array_like objects, check that the shape is equal and all elements of these objects are almost equal. An exception is raised at shape mismatch or conflicting values. In contrast to the standard usage in numpy, NaNs are compared like numbers, no assertion is raised if both objects have NaNs in the same positions. Parameters ---------- x : array_like The actual object to check. y : array_like The desired, expected object. decimal : integer (decimal=6) desired precision err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired are not equal up to specified precision. See Also -------- assert_almost_equal: simple version for comparing numbers assert_array_equal: tests objects for equality Examples -------- the first assert does not raise an exception >>> np.testing.assert_array_almost_equal([1.0,2.333,np.nan], [1.0,2.333,np.nan]) >>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan], [1.0,2.33339,np.nan], decimal=5) ... : AssertionError: Arrays are not almost equal (mismatch 50.0%) x: array([ 1. , 2.33333, NaN]) y: array([ 1. , 2.33339, NaN]) >>> np.testing.assert_array_almost_equal([1.0,2.33333,np.nan], [1.0,2.33333, 5], decimal=5) : ValueError: Arrays are not almost equal x: array([ 1. , 2.33333, NaN]) y: array([ 1. , 2.33333, 5. ]) i˙˙˙˙(taroundtnumbertfloat_(t issubdtype(R•csyˆt|ƒƒpˆt|ƒƒost|ƒ}t|ƒ}||jptS|i|ijo djno ||jS||}||}nWntj onXt||ƒ}ˆ|iˆƒp|iˆƒ}nˆ|ˆƒdˆ jS(Nig$@(R(RsRžR!R‡R˜tastype(R"R›txinfidtyinfidtz(RŹRŽR…R­RŻtnpany(s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytcompareęs &   $  RcRRdsArrays are not almost equalN( RRŹR­RŽtnumpy.core.numerictypesRŻtnumpy.core.fromnumericR•RŠ(R"R›R…RcRRľ((R…R­RŽRŻR´RŹs9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR§s @c Cs)tti||d|d|ddƒdS(s< Raise an assertion if two array_like objects are not ordered by less than. Given two array_like objects, check that the shape is equal and all elements of the first object are strictly smaller than those of the second object. An exception is raised at shape mismatch or incorrectly ordered values. Shape mismatch does not raise if an object has zero dimension. In contrast to the standard usage in numpy, NaNs are compared, no assertion is raised if both objects have NaNs in the same positions. Parameters ---------- x : array_like The smaller object to check. y : array_like The larger object to compare. err_msg : string The error message to be printed in case of failure. verbose : bool If True, the conflicting values are appended to the error message. Raises ------ AssertionError If actual and desired objects are not equal. See Also -------- assert_array_equal: tests objects for equality assert_array_almost_equal: test objects for equality up to precision Examples -------- >>> np.testing.assert_array_less([1.0, 1.0, np.nan], [1.1, 2.0, np.nan]) >>> np.testing.assert_array_less([1.0, 1.0, np.nan], [1, 2.0, np.nan]) ... : Arrays are not less-ordered (mismatch 50.0%) x: array([ 1., 1., NaN]) y: array([ 1., 2., NaN]) >>> np.testing.assert_array_less([1.0, 4.0], 3) ... : Arrays are not less-ordered (mismatch 50.0%) x: array([ 1., 4.]) y: array(3) >>> np.testing.assert_array_less([1.0, 2.0, 3.0], [4]) ... : Arrays are not less-ordered (shapes (3,), (1,) mismatch) x: array([ 1., 2., 3.]) y: array([4]) RcRRdsArrays are not less-orderedN(RŠRŞt__lt__(R"R›RcR((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR˙sAcBs ||UdS(N((tastrRm((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRDsc CsBddk}t|tƒptt|ƒ ƒ‚nt|tƒptt|ƒ ƒ‚ntid|d|tiƒodSt|i ƒi |i dƒ|i dƒƒƒ}g}xC|o;|i dƒ}|i dƒoqšn|i dƒoô|g}|i dƒ}|i d ƒo |i|ƒ|i dƒ}n|i d ƒpt| ƒ‚n|i|ƒ|i dƒ}|i d ƒo|i|ƒn|id|ƒtid|d d|d ƒoqšn|i|ƒqšnt| ƒ‚qšW|pdSd d i|ƒiƒ} ||jot| ƒ‚ndS(sž Test if two strings are equal. If the given strings are equal, `assert_string_equal` does nothing. If they are not equal, an AssertionError is raised, and the diff between the strings is shown. Parameters ---------- actual : str The string to test for equality against the expected string. desired : str The expected string. Examples -------- >>> np.testing.assert_string_equal('abc', 'abc') >>> np.testing.assert_string_equal('abc', 'abcd') Traceback (most recent call last): File "", line 1, in ... AssertionError: Differences in strings: - abc+ abcd? + i˙˙˙˙Ns\As\Ziis s- s? s+ isDifferences in strings: %sR(tdifflibRRtRRUtreR¨tMRotDifferRľRatpopt startswithR7tinserttextendR`trstrip( RuRvRştdifft diff_listtd1R?td2td3R((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRGsJ !0   #  c sjddk}ddk}|djo tidƒ}|id}ntiitii |ƒƒd}tii |ƒg}|i ||ƒ\}}} z|i |||| ƒ} Wd|i ƒX|iƒi| ƒ} |idtƒ} g‰|o‡fd†} nd} x!| D]}| i|d| ƒqW| idjo$|otd d iˆƒƒ‚ndS( sH Run doctests found in the given file. By default `rundocs` raises an AssertionError on failure. Parameters ---------- filename : str The path to the file for which the doctests are run. raise_on_error : bool Whether to raise an AssertionError when a doctest fails. Default is True. Notes ----- The doctests can be run by the user/developer by adding the ``doctests`` argument to the ``test()`` call. For example, to run all tests (including doctests) for `numpy.lib`:: >>> np.lib.test(doctests=True) i˙˙˙˙Nit__file__iRcs ˆi|ƒS((R7(ts(R(s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytąstoutsSome doctests failed: %ss (tdoctesttimpRCtsyst _getframet f_globalstosRRtsplitexttbasenametdirnamet find_modulet load_moduleR;t DocTestFinderR\t DocTestRunnerRstruntfailuresRR`(tfilenametraise_on_errorRĚRÍR1tnameRRtfiletpathnamet descriptiontmtteststrunnerRËttest((Rs9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR‰s* " cOstƒ}|ii||ŽS(N(RttoolsR(R/tkwargstnose((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRźs cOstƒ}|ii||ŽS(s‹ assert_raises(exception_class, callable, *args, **kwargs) Fail unless an exception of class exception_class is thrown by callable when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. (RRĺR(R/RćRç((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRŔs c Cs÷|djotidtiƒ}nti|ƒ}|i}ddkl}t||i ƒƒ}xŒ|D]„}y*t |dƒo |i }n |i }Wnt j o qknX|i|ƒo+|idƒ ot||||ƒƒqkqkWdS(s  Apply a decorator to all methods in a class matching a regular expression. The given decorator is applied to all public methods of `cls` that are matched by the regular expression `testmatch` (``testmatch.search(methodname)``). Methods that are private, i.e. start with an underscore, are ignored. Parameters ---------- cls : class Class whose methods to decorate. decorator : function Decorator to apply to methods testmatch : compiled regexp or str, optional The regular expression. Default value is None, in which case the nose default (``re.compile(r'(?:^|[\b_\.%s-])[Tt]est' % os.sep)``) is used. If `testmatch` is a string, it is compiled to a regular expression first. s(?:^|[\\b_\\.%s-])[Tt]esti˙˙˙˙(t isfunctiontcompat_func_namet_N(RCRťtcompileRŃtsept__dict__tinspectRčtfiltertvaluesthasattrRét__name__tAttributeErrortsearchRżtsetattr(tclst decoratort testmatchtcls_attrRčtmethodstfunctiontfuncname((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR Ďs"    !ic Bs…eidƒ}|i|i}}e|d|dƒ}d}eƒ}x&||jo|d7}|||UqJWeƒ|}d|S(sD Return elapsed time for executing code in the namespace of the caller. The supplied code string is compiled with the Python builtin ``compile``. The precision of the timing is 10 milli-seconds. If the code will execute fast on this timescale, it can be executed many times to get reasonable timing accuracy. Parameters ---------- code_str : str The code to be timed. times : int, optional The number of times the code is executed. Default is 1. The code is only compiled once. label : str, optional A label to identify `code_str` with. This is passed into ``compile`` as the second argument (for run-time error messages). Returns ------- elapsed : float Total elapsed time in seconds for executing `code_str` `times` times. Examples -------- >>> etime = np.testing.measure('for i in range(1000): np.sqrt(i**2)', ... times=times) >>> print "Time for a single execution : ", etime / times, "s" Time for a single execution : 0.005 s isTest name: %s texecig{ŽGáz„?(RÎRĎtf_localsRĐRëR ( tcode_strttimestlabeltframetlocstglobstcodeR2telapsed((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRţs!     c Cs˜ddk}|idƒ}|idƒiddƒ}|}d}ti|ƒ}x#tdƒD]}|||ƒ}q^Wti|ƒ|jpt‚dS(sg Check that ufuncs don't mishandle refcount of object `1`. Used in a few regression tests. i˙˙˙˙Nidiii'i'(RˆtarangetreshapeRÎt getrefcountR-R( topRRftbtcR2trctjtd((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyt_assert_valid_refcount-s  c Csßddk}|i|ƒ}|i|ƒ}||i|i||j||ƒƒ}|i|i||ƒ|jƒpf|i|ƒp|i|ƒod|}n)|it||ƒƒ}d||f}t|ƒ‚ndS(séCompare two arrays relatively to their spacing. It is a relatively robust method to compare two arrays whose amplitude is variable. Note ---- An assertion is raised if the following condition is not met: abs(x - y) <= nulps * spacing(max(abs(x), abs(y))) Parameters ---------- x: array_like first input array y: array_like second input array nulp: int max number of unit in the last place for tolerance (see Note) i˙˙˙˙NsX and Y are not equal to %d ULPs+X and Y are not equal to %d ULP (max is %g)( RˆR‡tspacingtwhereRĄRjtmaxt nulp_diffR( R"R›tnulpRtaxtaytrefRtmax_nulp((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR?s (# cCsLddk}t|||ƒ}|i||jƒptd|ƒ‚n|S(s`Given two arrays a and b, check that every item differs in at most N Unit in the Last Place.i˙˙˙˙Ns(Arrays are not almost equal up to %g ULP(RˆRRĄR(RfR tmaxulpR˜Rtret((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyR^s  cs5ddk‰|o.ˆi|d|ƒ}ˆi|d|ƒ}nˆi|ƒ}ˆi|ƒ}ˆi||ƒ}ˆi|ƒpˆi|ƒotdƒ‚nˆi|d|ƒ}ˆi|d|ƒ}|i|ijp td|i|ifƒ‚n‡fd†}t|ƒ}t|ƒ}||||ƒS(sDFor each item in x and y, eeturn the number of representable floating points between them. Parameters ---------- x : array_like first input array y : array_like second input array Returns ------- nulp: array_like number of representable floating point numbers between each item in x and y. Examples -------- # By definition, epsilon is the smallest number such as 1 + eps != 1, so # there should be exactly one ULP between 1 and 1 + eps >>> nulp_diff(1, 1 + np.finfo(x.dtype).eps) 1.0 i˙˙˙˙NR˜s'_nulp not implemented for complex arrays+x and y do not have the same shape: %s - %scs&ˆi||d|ƒ}ˆi|ƒS(NR˜(R”R‡(trxtrytvdtRĂ(R(s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyt_diff“s(RˆR”t common_typeRjR@RRrt integer_repr(R"R›R˜ttRRR((Rs9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRhs$    cCs`|i|ƒ}|idjp"|||dj||djtalwaysis!No warning raised when calling %ss(First warning for %s is not a %s( is %s)N( R8RœRFR9t simplefilterR.RRňR+RG(t warning_classtfuncR/tkwtctxR?((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pyRs    "(RZR[((3R7RŃRÎRťRŞRR9t nosetesterRt__all__RRR$R&R(RtplatformtgetpidR R RÝtversionRCRVRœR RR RRRŠRRRRRRRRR RRRRRR%R!RLR)R8R(((s9/usr/lib64/python2.6/site-packages/numpy/testing/utils.pytst                   $ s )nY ?@XE  B3   //   3  4