![]() write ( to_latex ( circuit, settings )) result = subprocess. join ( tmpdir, "diagram.tex" ), "w" ) as texfile : texfile. TemporaryDirectory () as tmpdir : with open ( os. which ( "convert" ) if pdflatex_path is None : raise FileNotFoundError ( "Unable to locate 'pdflatex'." ) if convert_path is None : raise FileNotFoundError ( "Unable to locate 'convert'." ) with tempfile. which ( "pdflatex" ) convert_path = shutil. Second, Imagemagick's 'convert' is called to translate # this to a png image. ![]() """ # The conversion process relies on two passes: first, 'pdflatex' is called to # render the tikz to a pdf. :return: PNG image render of the circuit. ![]() :param settings: An optional object of settings controlling diagram rendering and layout. :param circuit: The circuit to be drawn, represented as a pyquil program. If it does not, you need to install these yourself. Further, your LaTeX installation should include class and style files for ``standalone``, ``geometry``, ``tikz``, and ``quantikz``. note:: For this to work, you need two external programs, ``pdflatex`` and ``convert``, to be installed and accessible via your shell path. Def display ( circuit : Program, settings : Optional = None, ** image_options : Any ) -> Image : """ Displays a PyQuil circuit as an IPython image object.
0 Comments
Leave a Reply. |