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/texmanager.pyc
�
�)�Uc@sHdZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
yddlmZWn!e
k
r�ddlmZnXddlZddlZddlZddlmZddlmZddljZddlZeZejjd�r"dZnd	Zd
�Zdd
d��YZ dS(s�
This module supports embedded TeX expressions in matplotlib via dvipng
and dvips for the raster and postscript backends.  The tex and
dvipng/dvips information is cached in ~/.matplotlib/tex.cache for reuse between
sessions

Requirements:

* latex
* \*Agg backends: dvipng
* PS backend: latex w/ psfrag, dvips, and Ghostscript 8.51
  (older versions do not work properly)

Backends:

* \*Agg
* PS
* PDF

For raster output, you can get RGBA numpy arrays from TeX expressions
as follows::

  texmanager = TexManager()
  s = '\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!'
  Z = self.texmanager.get_rgba(s, size=12, dpi=80, rgb=(1,0,0))

To enable tex rendering of all text in your matplotlib figure, set
text.usetex in your matplotlibrc file (http://matplotlib.sf.net/matplotlibrc)
or include these two lines in your script::

  from matplotlib import rc
  rc('text', usetex=True)

i����N(tPopentPIPEtSTDOUT(tmd5(trcParams(tread_pngtwint&t;c
Cs�tddtdtdtdtdtjdk�}|j|j}}xl|D]d}|jd�rM|j	�d	}t
jjd
|d�t
jj|�}|t
jjd�kSqMWt
jjd
d�tS(Nsdvipng -versiontshelltstdintstdouttstderrt	close_fdstwin32sdvipng i����sFound dvipng version %sthelpfuls1.6sNo dvipng was found(RtTrueRRtsystplatformR
Rt
startswithtsplittmpltverbosetreportt	distutilstversiontLooseVersiontFalse(tpR
RtlineR((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytdvipng_hack_alpha9s
t
TexManagercBsfeZdZej�Zed?kr3ej�Znej	j
ed�Zej�Z
ej	j
e
d�Zej	je�r�ejdeefIJejee�nej	je�s�eje�nd?ZiZiZiZdZd@ZdAZdBZdCZdZdDZidEd6dFd6dGd6dHd6dId6dJd
6dKd6dLd6dMd6dNd!6dOd$6dPd'6dQd6dRd(6dSd)6dTd*6Z d?Z!dUe"gdVeD]Z#d-e#^q��Z$d.�Z%d?d/�Z&d0�Z'd1�Z(d2�Z)d3�Z*d4�Z+e,j-d5�Z.d6�Z/d7�Z0d8�Z1d9�Z2d:�Z3d;�Z4d?d?d<�Z5d?d?dWd=�Z6d?d>�Z7RS(XsZ
    Convert strings to dvi files using TeX, caching the results to a
    working dir
    s
.tex.caches	tex.cachesmWARNING: found a TeX cache dir in the deprecated location "%s".
  Moving it to the new default location "%s".itcmrttcmsstcmtttpzcs\usepackage{chancery}tserifs
sans-seriftcursivet	monospacetpncs\renewcommand{\rmdefault}{pnc}snew century schoolbooktpbks\renewcommand{\rmdefault}{pbk}tbookmantptms\usepackage{mathptmx}ttimestppls\usepackage{mathpazo}tpalatinos
zapf chancerytpchs\usepackage{charter}tchartertphvs\usepackage{helvet}t	helveticatpags\usepackage{avant}savant gardetpcrs\usepackage{courier}tcourierscomputer modern romanscomputer modern sans serifscomputer modern typewriterstext.latex.preambletfamilysfont.cCsHtjj|j�s(tj|j�ntdj�}||jkrS||_n t	j
jd|d�d|_|jg}xg|jD]}||jdd�f^q�D]�\}}x�td|D]�}|j�|j
kr@|j
|j�}t|||j
|j��tr<d|||j
|j�fGHnPq�tr�d	GHq�q�Wt	j
jd
|d�t|||j
|�|jt||�d�q�Wdj|�|_|jd
|jd
|jd
g}|jdkr�|j|jd
�nxd|kr|jd�q�Wdj|�}djd|dg�|_dS(Nsfont.familysOThe %s font family is not compatible with LaTeX. serif will be used by default.RR%t-t_sfont.sfamily: %s, font: %s, info: %ss%$s font is not compatible with usetexsQNo LaTeX-compatible font found for the %s font family in rcParams. Using default.iR!iR&s\usepackage{type1cm}s
s\usepackage{textcomp}(tostpathtisdirttexcachetmkdirRtlowert
font_familiestfont_familyRRRtreplacet	font_infotsetattrtDEBUGtappendtgetattrtjoint_fontconfigR%t
sans_serifR'R&tremovet_font_preamble(tselftfft
fontconfigR@tfont_family_attrtfontt
found_fonttcmd((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyt__init__�sB	8	$cCsqdj||j�d||j�t|p.d�g�}t|�jd�}tjj|jt	|�j
��S(sU
        returns a filename based on a hash of the string, fontsize, and dpi
        R!s%fsutf-8(RGtget_font_configtget_custom_preambletstrtunicodetencodeR9R:R<Rt	hexdigest(RLttextfontsizetdpitstbytes((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_basefile�s!cCs|jdkr=tg|jD]}|df^q�|_ng|jD]#}t||j|krG|^qG}|r�tr�dG|GHnxN|D]F}tr�d||j|t|fGHntjt|�|j|<q�Wtr�dG|jGHn|j	�ntrdG|jGHn|jS(s8Reinitializes self if relevant rcParams on have changed.sDEBUG following keys changed:sDEBUG %-20s: %-10s -> %-10ssDEBUG RE-INIT
old fontconfig:sDEBUG fontconfig:N(
t	_rc_cachetNonetdictt_rc_cache_keysRRDtcopytdeepcopyRHRS(RLtktpartchanged((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyRT�s$.

cCs|jS(sU
        returns a string containing font configuration for the tex preamble
        (RK(RL((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_font_preamble�scCsdjtd�S(s>returns a string containing user additions to the tex preambles
stext.latex.preamble(RGR(RL((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyRU�scGsRtjdkr2dtjj|j�dg}ng}|j|�dj|�S(s�
        On windows, changing directories can be complicated by the presence of
        multiple drives. get_shell_cmd deals with this issue.
        Rs%sis && (RRR9R:t
splitdriveR<textendRG(RLtargstcommand((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyt_get_shell_cmd�s
#
cCs|j||�}d|}t|d�}|j�}idd6dd6j|jd�}||}tdrwd	}nd
}d|j||||d|f}	tdr�|j|	jd
��n=y|j|	�Wn)t	k
r�}
t
jjdd��nX|j
�|S(su
        Generate a tex file to render the tex string at a specific font size

        returns the file name
        s%s.textws{\sffamily %s}s
sans-serifs{\ttfamily %s}R's{\rmfamily %s}stext.latex.unicodes-\usepackage{ucs}
\usepackage[utf8x]{inputenc}R!s�\documentclass{article}
%s
%s
%s
\usepackage[papersize={72in,72in}, body={70in,70in}, margin={1in,1in}]{geometry}
\pagestyle{empty}
\begin{document}
\fontsize{%f}{%f}%s
\end{document}
g�?tutf8sbYou are using unicode and latex, but have not enabled the matplotlib 'text.latex.unicode' rcParam.R(R_tfileRUtgetR@RRKtwriteRXtUnicodeEncodeErrorRRRtclose(RLRZR[tbasefilettexfiletfhtcustom_preambletfontcmdtunicode_preambleR]terr((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytmake_tex�s.

	

	

s3MatplotlibBox:\(([\d.]+)pt\+([\d.]+)pt\)x([\d.]+)ptcCs|j||�}d|}t|d�}|j�}idd6dd6j|jd�}||}tdrwd	}nd
}d|j||||d|f}	tdr�|j|	jd
��n=y|j|	�Wn)t	k
r�}
t
jjdd��nX|j
�|S(s�
        Generate a tex file to render the tex string at a specific
        font size.  It uses the preview.sty to determin the dimension
        (width, height, descent) of the output.

        returns the file name
        s%s.texRos{\sffamily %s}s
sans-serifs{\ttfamily %s}R's{\rmfamily %s}stext.latex.unicodes-\usepackage{ucs}
\usepackage[utf8x]{inputenc}R!s�\documentclass{article}
%s
%s
%s
\usepackage[active,showbox,tightpage]{preview}
\usepackage[papersize={72in,72in}, body={70in,70in}, margin={1in,1in}]{geometry}

%% we override the default showbox as it is treated as an error and makes
%% the exit status not zero
\def\showbox#1{\immediate\write16{MatplotlibBox:(\the\ht#1+\the\dp#1)x\the\wd#1}}

\begin{document}
\begin{preview}
{\fontsize{%f}{%f}%s}
\end{preview}
\end{document}
g�?RpsbYou are using unicode and latex, but have not enabled the matplotlib 'text.latex.unicode' rcParam.R(R_RqRURrR@RRKRsRXRtRRRRu(RLRZR[RvRwRxRyRzR{R]R|((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytmake_tex_previews.

	

	

c
Cs�tdr|j||�S|j||�}d|}tsOtjj|�r�|j||�}|d}|jd|j	dtjj
|�d|f�}tjj
|d�tj|�}y&t|�}	|	j�}
|	j�Wntk
r�d}
nXytj|�t}Wntk
r0t}nX|s>|r[td	t|�|
��ntjj
|
d�xgtj|d
�D]O}|jd�r�q�|jd�r�q�ytj|�Wq�tk
r�q�Xq�Wn|S(
sm
        generates a dvi file containing latex's layout of tex string

        returns the file name
        stext.latex.previews%s.dvis.outputscd "%s"s(latex -interaction=nonstopmode %s > "%s"i����tdebugs No latex error report available.seLaTeX was not able to process the following string:
%s
Here is the full report generated by LaTeX: 

t*tdviRZ(Rtmake_dvi_previewR_RDR9R:texistsR}RnR<RRRRtsystemRqtreadRutIOErrortstatRtOSErrorRtRuntimeErrortreprtglobtendswithRJ(
RLRZR[RvtdvifileRwtoutfileRmtexit_statusRxRR�tfname((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytmake_dviPsJ


 







cCs�|j||�}d|}d|}tsRtjj|�sRtjj|�r�|j||�}|d}|jd|jdtjj|�d|f�}t	j
j|d�tj|�}	y&t
|�}
|
j�}|
j�Wntk
rd}nX|	r&td	t|�|��nt	j
j|d�tjj|�}t|d
d�jdj|j���xytj|d
�D]a}
|
jd�r�q�|
jd�r�q�|
jd�r�q�ytj|
�Wq�tk
r�q�Xq�Wn|S(s�
        generates a dvi file containing latex's layout of tex
        string. It calls make_tex_preview() method and store the size
        information (width, height, descent) in a separte file.

        returns the file name
        s%s.dvis%s.baselines.outputscd "%s"s(latex -interaction=nonstopmode %s > "%s"i����Rs No latex error report available.seLaTeX was not able to process the following string:
%s
Here is the full report generated by LaTeX: 

s	.baselineRot R�R�RZtbaseline(R_RDR9R:R�R~RnR<RRRRR�RqR�RuR�R�R�Rt_re_vboxtsearchtopenRsRGtgroupsR�R�RJR�(RLRZR[RvR�tbaselinefileRwR�RmR�RxRtmR�((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyR�sH


 

)
cCs[|j|||�}d|}ts8tjj|�rW|j||�}|d}|jd|jd|tjj|�dtjj|�d|f�}t	j
j|d�tj|�}	y&t
|�}
|
j�}|
j�Wntk
r�d}nX|	rtd||��nt	j
j|d�ytj|�WqWtk
rSqWXn|S(	so
        generates a png file containing latex's rendering of tex string

        returns the filename
        s%s.pngs.outputscd "%s"sQdvipng -bg Transparent -D %s -T tight -o                         "%s" "%s" > "%s"i����Rs!No dvipng error report available.sedvipng was not able to process the following file:
%s
Here is the full report generated by dvipng: 

(R_RDR9R:R�R�RnR<RRRRR�RqR�RuR�R�RJR�(RLRZR[R\RvtpngfileR�R�RmR�RxR((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytmake_png�s2

 


c
Cs|j||�}d|}ts5tjj|�r|j||�}|d}|jd|jdtjj|�dtjj|�d|f�}t	j
j|d�tj|�}t
|�}	|r�td||	j���nt	j
j|	j�d�|	j�tj|�n|S(sw
        generates a postscript file containing latex's rendering of tex string

        returns the file name
        s%s.epsfs.outputscd "%s"sdvips -q -E -o "%s" "%s" > "%s"i����Rscdvipng was not able to process the flowing file:
%s
Here is the full report generated by dvipng: 

(R_RDR9R:R�R�RnR<RRRRR�RqR�R�RuRJ(
RLRZR[RvtpsfileR�R�RmR�Rx((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytmake_ps�s&

 
cCsy|j||�}t|�}xD|D]<}|jd�r%g|j�dD]}t|�^qKSq%Wtd|��dS(sw
        returns a list containing the postscript bounding box for latex's
        rendering of the tex string
        s%%BoundingBox:isCould not parse %sN(R�RqRRtintR�(RLRZR[R�tpsRtval((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_ps_bbox�s
+c	Cs||j�||f}|jj|�}|dkr|j|||�}ttjj|j	|��}t
ddk	r�t
d}n'tjdkr�t
�t_ntj}|r�d|dd�dd�df}n|dd�dd�df}||j|<n|S(sreturns the alpha channelstext.dvipnghackiNii����(RTtgrey_arraydRrRaR�RR9R:RGR<RRt_dvipng_hack_alphaR(	RLRZR[R\tkeytalphaR�tXthack((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_grey�s
	&cCsE|std}n|s&td}n|\}}}||j�||t|�f}|jj|�}	|	dkrA|j|||�}
tj|
j	d|
j	ddftj
�}	||	dd�dd�df<||	dd�dd�df<||	dd�dd�df<|
|	dd�dd�df<|	|j|<n|	S(	sN
        Returns latex's rendering of the tex string as an rgba array
        s	font.sizessavefig.dpiiiiNii(RRTttupletrgba_arraydRrRaR�tnptzerostshapetfloat(RLRZR[R\trgbtrtgtbR�tZR�((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_rgba+s 

!,cCsB|j�dkrdS|r.|jd�}nd}tdr�|j||�}d|}tsstjj|�r�|j||�}nt	|�j
�j�}g|D]}	t|	�|^q�\}
}}||
||fS|j
||�}tj|d|�}
t|
�j�}|
j�|j|j|j|jfSdS(	s?
        return width, heigth and descent of the text.
        R!ig�?stext.latex.previews%s.baselineiHN(iii(tstriptpoints_to_pixelsRR_RDR9R:R�R�R�R�RR�R�tdvireadtDvititertnextRutwidththeighttdescent(RLRZR[trenderertdpi_fractionRvR�R�tltl1R�tdepthR�R�tpage((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pytget_text_width_height_descentCs$

,
N(R R!(R"R!(R#R!(R$s\usepackage{chancery}(sserifs
sans-serifscursives	monospace(R(s\renewcommand{\rmdefault}{pnc}(R)s\renewcommand{\rmdefault}{pbk}(R+s\usepackage{mathptmx}(R-s\usepackage{mathpazo}(R$s\usepackage{chancery}(R$s\usepackage{chancery}(R/s\usepackage{charter}(R R!(R"R!(R1s\usepackage{helvet}(R3s\usepackage{avant}(R4s\usepackage{courier}(R#R!(R R!(R"R!(R#R!(stext.latex.preamble(R6(iii(8t__name__t
__module__t__doc__Rtget_hometoldpathRat
get_data_pathR9R:RGtoldcachet
get_configdirt	configdirR<R�RRtshutiltmoveR=R�R�R�tpostscriptdtpscntR%RIR'R&R@R?RBR`R�tnRcRSR_RTRiRURnR}tretcompileR�R~R�R�R�R�R�R�R�R�(((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyRHsz
(	)
					0	?	/	0	#		0((!R�RdR�R9R�Rtwarningst
subprocessRRRthashlibRtImportErrortdistutils.versionRtnumpyR�t
matplotlibRRtmatplotlib._pngRtmatplotlib.dvireadR�R�RRDRRt	cmd_splitRR(((sH/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/texmanager.pyt<module>"s&H