ó _Û3Lc@sndZddlZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z dddgZ ddd„ZiZejƒdk rêe jdkrÄd Znd Zd „Zeed |d kr>d}|d7}|d7}t|‚nd}|d k rôt||ƒ}||krôt|ƒ}t|ƒ}t|ƒ} t|ƒ} |d7}|d|d7}|d|d7}|d| d7}|d | d7}qôn|d k r½t||ƒ} |r)| t|ƒ} n|| kr½t| ƒ} t|ƒ} t|ƒ}t|ƒ}|d7}|d|d7}|d|d7}|d | d7}|d | d7}q½n|rÇ|Sd Sd S( s Fail if the floating point values are not close enough, with the givem message. You can specify a relative tolerance, absolute tolerance, or both. s4You haven't specified a 'relTol' relative tolerance s5or a 'absTol' absolute tolerance function argument. sYou must specify one.ts s Expected: s Actual: s Abs Diff: s Abs Tol: s Rel Diff: s Rel Tol: N(tNonet ValueErrortabststr(texpectedtactualtrelToltabsToltexMsgtmsgtabsDifft expectedStrt actualStrt absDiffStrt absTolStrtrelDifft relDiffStrt relTolStr((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRsF                 twin32tgswin32ctgscCstddddd||gS(Ns-qs-sDEVICE=png16ms -dNOPAUSEs-dBATCHs -sOutputFile=(R(toldtnew((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyt\stpdftepscCsd|d|gS(Ntinkscapes --export-png=((RR((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRcstsvgcCsdgtjƒS(sSReturns the list of file formats that compare_images can compare on this system.tpng(t convertertkeys(((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRgsc Cs$|jddƒ\}}|tkr4td|‚n|d|d}tjj|ƒshtd|‚nt|||ƒ}tj|dtj dtj ƒ}|j ƒ\}}|j ƒ}tjj|ƒ sÓ|r d d j |ƒ} |rý| d |7} n|r| d |7} nt| ‚n|S( sX Convert the named file into a png file. Returns the name of the created file. t.is)Don't know how to convert %s files to pngt_s.pngs'%s' does not existtstdouttstderrsConversion command failed: %s t sStandard output: %s sStandard error: %s ( trsplitR"RtostpathtexiststIOErrort subprocesstPopentPIPEt communicatetwaittjoin( tfilenametbaset extensiontnewnametcmdtpipeR&R'terrcodeR((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pytconvertls$ !  c Cstjj|ƒs"td|‚n|jddƒ\}}tj|d ƒ}|d k rÿ||ƒ}tj |dtj dtj ƒ}|j ƒ\}}|j ƒ}|dkrÿddj |ƒ} |rÙ| d |7} n|rð| d |7} nt| ‚qÿnd S( s? Verify the file through some sort of verification tool. s'%s' does not existR$iR&R'is%File verification command failed: %s R(sStandard output: %s sStandard error: %s N(R*R+R,R-R)t verifierstgetRR.R/R0R1R2R3( R4R5R6tverifierR8R9R&R'R:R((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pytverify†s   !  cCsdddd|gS(Ntxmllints--valids --nowarnings--noout((R4((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRsc Cs±y ddlm}m}m}Wn3tk rU}d|}|rNt|‚qV|SnXt|ƒ|jdƒd} | dkr›t|ƒt|ƒ}}n|j |ƒjdƒ} |j |ƒjdƒ} |j | dƒ} |j | dƒ} | j ƒ} | j ƒ} t j ttjtd„| | ƒƒt| ƒƒ}tjjtjj|ƒd tjj|ƒƒ}d tjj|ƒ}|d |krÚtjj|ƒr´tj|ƒntjj|ƒrÖtj|ƒndSt|||ƒ|r7tj||ƒtd |d t|ƒdt|ƒdt|ƒƒ}|Stjj|ƒrYtj|ƒndt|d ƒdt|ƒdt|ƒdt|ƒdt|ƒd}|SdS(s=Compare two image files - not the greatest, but fast and good enough. = EXAMPLE # img1 = "./baseline/plot.png" # img2 = "./output/plot.png" # # compare_images( img1, img2, 0.001 ): = INPUT VARIABLES - expected The filename of the expected image. - actual The filename of the actual image. - tol The tolerance (a unitless float). This is used to determine the 'fuzziness' to use when comparing images. - in_decorator If called from image_comparison decorator, this should be True. (default=False) iÿÿÿÿ(tImagetImageOpst ImageFiltersÎImage Comparison requires the Python Imaging Library to be installed. To run tests without using PIL, then use the '--without-tag=PIL' command-line option. Importing PIL failed with the following error: %sR$R!tRGBicSs ||dS(Ni((tatb((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRÑss failed-diff-s expected-gˆÃ@trmsR R tdiffs1 Error: Image files did not match. RMS Value: s Expected: s Actual: s Difference: s Tolerance: s N( tPILRARBRCt ImportErrortNotImplementedErrorR?tsplitR;topent autocontrastt histogramtmathtsqrttreducetoperatortaddtmaptlenR*R+R3tdirnametbasenameR,tunlinkRtsave_diff_imagetshutiltcopyfiletdictR(R R ttolt in_decoratorRARBRCteRR6t expectedImaget actualImageth1th2RGt diff_imaget expected_copytresults((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyR sR      4  Pc Csõddlm}tj|j|ƒjdƒƒjtjƒ}tj|j|ƒjdƒƒjtjƒ}|j|jks‚t ‚|j |j ksšt ‚t ||ƒ}|d9}tj |ddƒjtj ƒ}|j|ƒ}|j|ƒdS(Niÿÿÿÿ(RARDi iiÿ(RIRAtnptarrayRMR;tastypetfloattndimtAssertionErrortshapeRtcliptuint8t fromarraytsave( R R toutputRARaRbt absDiffImaget save_image_npt save_image((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyRZös-- !(t__doc__t matplotlibtmatplotlib.testing.noseclassesRRPRSR*tnumpyRhR[R.tsyst__all__RRR"tcheckdep_ghostscripttplatformRR8tcheckdep_inkscapeRR;R<R?tcheckdep_xmllinttFalseRRZ(((sM/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyts@         ;          V