HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/testing/compare.pyc
�
_�3Lc@sndZddlZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZdddgZddd�ZiZej�dk	r�ejdkr�d	Znd
Zd�Zeed<eed
<nej�dk	rd�Zeed<nd�Zd�ZiZd�Zej�rUerUd�ed<ned�Zd�ZdS(s+ A set of utilities for comparing results.
i����N(tImageComparisonFailuret
compare_floattcompare_imagestcomparable_formatscCs�|dkr>|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(texpectedtactualtrelToltabsToltexMsgtmsgtabsDifftexpectedStrt	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<lambda>\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
subprocesstPopentPIPEtcommunicatetwaittjoin(
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�}|dk	r�||�}tj	|dtj
dtj
�}|j�\}}|j�}|dkr�ddj
|�}	|r�|	d	|7}	n|r�|	d
|7}	nt|	�q�ndS(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.pyR�sc
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����(tImagetImageOpstImageFilters�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( tPILRARBRCtImportErrortNotImplementedErrorR?tsplitR;topentautocontrastt	histogramtmathtsqrttreducetoperatortaddtmaptlenR*R+R3tdirnametbasenameR,tunlinkRtsave_diff_imagetshutiltcopyfiletdictR(R	R
ttoltin_decoratorRARBRCteRR6t
expectedImagetactualImageth1th2RGt
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.pyt<module>s@	;		

	
			V