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
  • templates (dict (str -> Path-like)) – A map of the available report generation types (html, pdf, notebook) to template paths.

  • results (Results or similar) – The underlying Results-like object used to generate this report.

  • sections (iterable of Section) – Collection of sections to be built into the generated report.

  • flags (set of str) – Set of flags controlling aspects of report generation.

  • global_qtys (dict (str -> any)) – Key-value map of report quantities not tied to any specific section.

  • report_params (dict (str -> any)) – Key-value map of report quantities used when building sections.

  • build_defaults (dict (str -> any), optional) – Default values for the build_options parameter of this instance’s build methods. Defaults to an empty dict.

  • pdf_available (bool, 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.

  • workspace (Workspace, optional) – A Workspace used for caching figure computation. By default, a new workspace will be used.

_build(self, build_options=None)

Render all sections to a map of report elements for templating

write_html(self, 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
  • path (str 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_open (bool, optional) – Whether the output file should be automatically opened in a web browser.

  • link_to (list, 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.

  • connected (bool, 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_options (dict) – Dict of options for building plots. Expected values are defined during construction of this report object.

  • brevity (int, 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

  • precision (int 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.

  • resizable (bool, 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_file (bool, 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.

  • verbosity (int, optional) – Amount of detail to print to stdout.

write_notebook(self, 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.

Parameters
  • path (str or path-like object) – The filesystem path to write the report to. By convention, this should use the .ipynb file extension.

  • auto_open (bool, optional) – If True, automatically open the report in a web browser after it has been generated.

  • connected (bool, 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.

  • verbosity (int, optional) – How much detail to send to stdout.

write_pdf(self, 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
  • path (str or path-like object) – The filesystem path to write the report to. By convention, this should use the .pdf file extension.

  • latex_cmd (str, 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_options (dict) – Dict of options for building plots. Expected values are defined during construction of this report object.

  • brevity (int, 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

  • precision (int 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_open (bool, optional) – Whether the output file should be automatically opened in a web browser.

  • comm (mpi4py.MPI.Comm, optional) – When not None, an MPI communicator for distributing the computation across multiple processors.

  • verbosity (int, optional) – Amount of detail to print to stdout.