pygsti.extras.idletomography.idtreport

Idle Tomography reporting and plotting functions

Module Contents

Classes

IdleTomographyObservedRatesTable

A table of the largest N (in absolute value) observed error rates.

IdleTomographyObservedRatesForIntrinsicRateTable

A table showing the observed error rates relevant for determining a

IdleTomographyObservedRatePlot

A plot showing how an observed error rate is obtained by fitting a sequence

IdleTomographyIntrinsicErrorsTable

A table of all the intrinsic rates found by idle tomography.

Functions

create_idletomography_report(results, filename[, ...])

Creates an Idle Tomography report, summarizing the results of running

class pygsti.extras.idletomography.idtreport.IdleTomographyObservedRatesTable(ws, idtresults, threshold=1.0, mdl_simulator=None)

Bases: pygsti.report.workspace.WorkspaceTable

A table of the largest N (in absolute value) observed error rates.

Create a IdleTomographyObservedRatesTable object.

Parameters

idtresultsIdleTomographyResults

The idle tomography results object from which to extract observed-rate data.

thresholdint or float

Specifies how many observed error rates to display. If an integer, display the top threshold rates. If a float, display the top threshold fraction of all the rates (e.g. 0.2 will show the to 20%).

mdl_simulatorModel, optional

If not None, use this Model to simulate the observed data points and plot these simulated values alongside the data.

Returns

ReportTable

class pygsti.extras.idletomography.idtreport.IdleTomographyObservedRatesForIntrinsicRateTable(ws, idtresults, typ, error_op, threshold=1.0, mdl_simulator=None)

Bases: pygsti.report.workspace.WorkspaceTable

A table showing the observed error rates relevant for determining a particular intrinsic rate. Output can be limited to just the largest observed rates.

Create a IdleTomographyObservedRatesForIntrinsicRateTable.

Parameters

idtresultsIdleTomographyResults

The idle tomography results object from which to extract observed-rate data.

typ{“hamiltonian”, “stochastic”, “affine”}

The type of the intrinsic rate to target.

error_opNQPauliOp

The intrinsic error (of the given typ), specified as a N-qubit Pauli operator.

thresholdint or float

Specifies how many observed error rates to consider. If an integer, display the top threshold rates of all the observed rates. For example, if threshold=10 and none of the top 10 rates are applicable to the given typ,`error_op` error, then nothing is displayed. If a float, display the top threshold fraction, again of all the rates (e.g. 0.2 means the top 20%).

mdl_simulatorModel, optional

If not None, use this Model to simulate the observed data points and plot these simulated values alongside the data.

Returns

ReportTable

class pygsti.extras.idletomography.idtreport.IdleTomographyObservedRatePlot(ws, idtresults, typ, fidpair, obs_or_outcome, title='auto', scale=1.0, mdl_simulator=None)

Bases: pygsti.report.workspace.WorkspacePlot

A plot showing how an observed error rate is obtained by fitting a sequence of observed data to a simple polynomial.

Create a IdleTomographyObservedRatePlot.

Parameters

idtresultsIdleTomographyResults

The idle tomography results object from which to extract observed-rate data.

typ{“samebasis”,”diffbasis”}

The type of observed-rate: same-basis or definite-outcome rates prepare and measure in the same Pauli basis. Other rates prepare and measure in different bases, and so have non-definite-outcomes.

fidpairtuple

A (prep,measure) 2-tuple of NQPauliState objects specifying the fiducial pair (a constant) for the data used to obtain the observed rate being plotted.

obs_or_outcomeNQPauliOp or NQOutcome

The observable (if typ == “diffbasis”) or outcome (if typ == “samebasis”) identifying the observed rate to plot.

titlestr, optional

The plot title to use. If “auto”, then one is created based on the parameters.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

mdl_simulatorModel, optional

If not None, use this Model to simulate the observed data points and plot these simulated values alongside the data.

class pygsti.extras.idletomography.idtreport.IdleTomographyIntrinsicErrorsTable(ws, idtresults, display=('H', 'S', 'A'), display_as='boxes')

Bases: pygsti.report.workspace.WorkspaceTable

A table of all the intrinsic rates found by idle tomography.

Create a IdleTomographyIntrinsicErrorsTable.

Parameters

idtresultsIdleTomographyResults

The idle tomography results object from which to extract observed-rate data.

displaytuple of {“H”,”S”,”A”}

Specifes which columns to include: the intrinsic Hamiltonian, Stochastic, and/or Affine errors. Note that if an error type is not included in idtresults it’s column will not be displayed regardless of the value of display.

display_as{“numbers”, “boxes”}, optional

How to display the matrices, as either numerical grids (fine for small matrices) or as a plot of colored boxes (space-conserving and better for large matrices).

Returns

ReportTable

pygsti.extras.idletomography.idtreport.create_idletomography_report(results, filename, title='auto', ws=None, auto_open=False, link_to=None, brevity=0, advanced_options=None, verbosity=1)

Creates an Idle Tomography report, summarizing the results of running idle tomography on a data set.

Parameters

resultsIdleTomographyResults

An object which represents the set of results from an idle tomography run, typically obtained from running do_idle_tomography() OR a dictionary of such objects, representing multiple idle tomography runs to be compared (typically all with different data sets). The keys of this dictionary are used to label different data sets that are selectable in the report.

filenamestring, optional

The output filename where the report file(s) will be saved. If None, then no output file is produced (but returned Workspace still caches all intermediate results).

titlestring, optional

The title of the report. “auto” causes a random title to be generated (which you may or may not like).

wsWorkspace, optional

The workspace used as a scratch space for performing the calculations and visualizations required for this report. If you’re creating multiple reports with similar tables, plots, etc., it may boost performance to use a single Workspace for all the report generation.

auto_openbool, optional

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

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. “tex” creates latex source files for tables; “pdf” renders PDFs of tables and plots ; “pkl” creates Python versions of plots (pickled python data) and tables (pickled pandas DataFrams).

advanced_optionsdict, optional

A dictionary of advanced options for which the default values aer usually are fine. Here are the possible keys of advanced_options:

  • 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.

  • cachefilestr, optional

    filename with cached workspace results

  • 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”).

verbosityint, optional

How much detail to send to stdout.

Returns

Workspace

The workspace object used to create the report