pygsti.report.report

Internal model of a report during generation

Module Contents

Classes

Report

The internal model of a report.

class pygsti.report.report.Report(templates, results, sections, flags, global_qtys, report_params, build_defaults=None, pdf_available=True, workspace=None)

The internal model of a report.

This class should never be instantiated directly. Instead, users should use the appropriate factory method in pygsti.report.factory.

Parameters

templatesdict (str -> Path-like)

A map of the available report generation types (html, pdf, notebook) to template paths.

resultsResults or similar

The underlying Results-like object used to generate this report.

sectionsiterable of Section

Collection of sections to be built into the generated report.

flagsset of str

Set of flags controlling aspects of report generation.

global_qtysdict (str -> any)

Key-value map of report quantities not tied to any specific section.

report_paramsdict (str -> any)

Key-value map of report quantities used when building sections.

build_defaultsdict (str -> any), optional

Default values for the build_options parameter of this instance’s build methods. Defaults to an empty dict.

pdf_availablebool, optional

True if the underlying results can be represented as a static PDF. If this report cannot be represented statically, write_pdf will raise. Defaults to True.

workspaceWorkspace, optional

A Workspace used for caching figure computation. By default, a new workspace will be used.

write_html(path, auto_open=False, link_to=None, connected=False, build_options=None, brevity=0, precision=None, resizable=True, autosize='initial', single_file=False, verbosity=0)

Write this report to the disk as a collection of HTML documents.

Parameters
pathstr or path-like object

The filesystem path of a directory to write the report to. If the specified directory does not exist, it will be created automatically

auto_openbool, optional

Whether the output file should be automatically opened in a web browser.

link_tolist, optional

If not None, a list of one or more items from the set {“tex”, “pdf”, “pkl”} indicating whether or not to create and include links to Latex, PDF, and Python pickle files, respectively.

connectedbool, optional

Whether output HTML should assume an active internet connection. If True, then the resulting HTML file size will be reduced because it will link to web resources (e.g. CDN libraries) instead of embedding them.

build_optionsdict

Dict of options for building plots. Expected values are defined during construction of this report object.

brevityint, optional

Amount of detail to include in the report. Larger values mean smaller “more briefr” reports, which reduce generation time, load time, and disk space consumption. In particular:

  • 1: Plots showing per-sequences quantities disappear at brevity=1

  • 2: Reference sections disappear at brevity=2

  • 3: Germ-level estimate tables disappear at brevity=3

  • 4: Everything but summary figures disappears at brevity=4

precisionint or dict, optional

The amount of precision to display. A dictionary with keys “polar”, “sci”, and “normal” can separately specify the precision for complex angles, numbers in scientific notation, and everything else, respectively. If an integer is given, it this same value is taken for all precision types. If None, then {‘normal’: 6, ‘polar’: 3, ‘sci’: 0} is used.

resizablebool, optional

Whether plots and tables are made with resize handles and can be resized within the report.

autosize{‘none’, ‘initial’, ‘continual’}

Whether tables and plots should be resized, either initially – i.e. just upon first rendering (“initial”) – or whenever the browser window is resized (“continual”).

single_filebool, optional

If true, the report will be written to a single HTML document, with external dependencies baked-in. This mode is not recommended for large reports, because this file can grow large enough that major web browsers may struggle to render it.

verbosityint, optional

Amount of detail to print to stdout.

write_notebook(path, auto_open=False, connected=False, verbosity=0)

Write this report to the disk as an IPython notebook

A notebook report allows the user to interact more flexibly with the data underlying the figures, and to easily generate customized variants on the figures. As such, this type of report will be most useful for experts who want to tinker with the standard analysis presented in the static HTML or LaTeX format reports.

Note that interactive cells in report notebooks require JavaScript, and therefore do not work with JupyterLab. Please continue to use classic Jupyter notebooks for PyGSTi report notebooks. To track this issue, see https://github.com/pyGSTio/pyGSTi/issues/205.

Parameters
pathstr or path-like object

The filesystem path to write the report to. By convention, this should use the .ipynb file extension.

auto_openbool, optional

If True, automatically open the report in a web browser after it has been generated.

connectedbool, optional

Whether output notebook should assume an active internet connection. If True, then the resulting file size will be reduced because it will link to web resources (e.g. CDN libraries) instead of embedding them.

verbosityint, optional

How much detail to send to stdout.

write_pdf(path, latex_cmd='pdflatex', latex_flags=None, build_options=None, brevity=0, precision=None, auto_open=False, comm=None, verbosity=0)

Write this report to the disk as a PDF document.

Parameters
pathstr or path-like object

The filesystem path to write the report to. By convention, this should use the .pdf file extension.

latex_cmdstr, optional

Shell command to run to compile a PDF document from the generated LaTeX source.

latex_flags[str], optional

List of flags to pass when calling latex_cmd.

build_optionsdict

Dict of options for building plots. Expected values are defined during construction of this report object.

brevityint, optional

Amount of detail to include in the report. Larger values mean smaller “more briefr” reports, which reduce generation time, load time, and disk space consumption. In particular:

  • 1: Plots showing per-sequences quantities disappear at brevity=1

  • 2: Reference sections disappear at brevity=2

  • 3: Germ-level estimate tables disappear at brevity=3

  • 4: Everything but summary figures disappears at brevity=4

precisionint or dict, optional

The amount of precision to display. A dictionary with keys “polar”, “sci”, and “normal” can separately specify the precision for complex angles, numbers in scientific notation, and everything else, respectively. If an integer is given, it this same value is taken for all precision types. If None, then {‘normal’: 6, ‘polar’: 3, ‘sci’: 0} is used.

auto_openbool, optional

Whether the output file should be automatically opened in a web browser.

commmpi4py.MPI.Comm, optional

When not None, an MPI communicator for distributing the computation across multiple processors.

verbosityint, optional

Amount of detail to print to stdout.