pygsti.report

pyGSTi Reporting Python Package

Subpackages

Submodules

Package Contents

Classes

Notebook

Python representation of an IPython notebook

Report

The internal model of a report.

GateEigenvalues

Gate eigenvalues

CircuitEigenvalues

Circuit eigenvalues

CircuitHalfDiamondNorm

1/2 diamond norm of difference between productA(circuit) and productB(circuit)

HalfDiamondNorm

Half the diamond distance bewteen model_a.operations[op_label] and model_b.operations[op_label]

Workspace

Central to data analysis, Workspace objects facilitate the building of reports and dashboards.

PrimitiveOpsSingleScaleWildcardBudget

A wildcard budget containing a single scaling parameter.

Functions

evaluate(model_fn[, cri, verbosity])

Evaluate a ModelFunction object using confidence region information

spam_dotprods(rho_vecs, povms)

SPAM dot products (concatenates POVMS)

choi_matrix(gate, mx_basis)

Choi matrix

choi_eigenvalues(gate, mx_basis)

Choi matrix eigenvalues

choi_trace(gate, mx_basis)

Trace of the Choi matrix

rel_circuit_eigenvalues(model_a, model_b, circuit)

Eigenvalues of dot(productB(circuit)^-1, productA(circuit))

circuit_frobenius_diff(model_a, model_b, circuit)

Frobenius distance btwn productA(circuit) and productB(circuit)

circuit_entanglement_infidelity(model_a, model_b, circuit)

Entanglement infidelity btwn productA(circuit) and productB(circuit)

circuit_avg_gate_infidelity(model_a, model_b, circuit)

Average gate infidelity between productA(circuit) and productB(circuit).

circuit_jtrace_diff(model_a, model_b, circuit)

Jamiolkowski trace distance between productA(circuit) and productB(circuit)

circuit_nonunitary_entanglement_infidelity(model_a, ...)

Nonunitary entanglement infidelity between productA(circuit) and productB(circuit)

circuit_nonunitary_avg_gate_infidelity(model_a, ...)

Nonunitary average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_entanglement_infidelity(model_a, ...)

Eigenvalue entanglement infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_avg_gate_infidelity(model_a, ...)

Eigenvalue average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_entanglement_infidelity(...)

Eigenvalue nonunitary entanglement infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_avg_gate_infidelity(...)

Eigenvalue nonunitary average gate infidelity between productA(circuit) and productB(circuit).

circuit_eigenvalue_diamondnorm(model_a, model_b, circuit)

Eigenvalue diamond distance between productA(circuit) and productB(circuit).

circuit_eigenvalue_nonunitary_diamondnorm(model_a, ...)

Eigenvalue nonunitary diamond distance between productA(circuit) and productB(circuit).

povm_entanglement_infidelity(model_a, model_b, povmlbl)

POVM entanglement infidelity between model_a and model_b.

povm_jtrace_diff(model_a, model_b, povmlbl)

POVM Jamiolkowski trace distance between model_a and model_b

povm_half_diamond_norm(model_a, model_b, povmlbl)

Half the POVM diamond distance between model_a and model_b.

decomposition(gate)

DEPRECATED: Decompose a 1Q gate into rotations about axes.

upper_bound_fidelity(gate, mx_basis)

Upper bound on entanglement fidelity

closest_ujmx(gate, mx_basis)

Jamiolkowski state of closest unitary to gate

maximum_fidelity(gate, mx_basis)

Fidelity between gate and its closest unitary

maximum_trace_dist(gate, mx_basis)

Jamiolkowski trace distance between gate and its closest unitary

angles_btwn_rotn_axes(model)

Array of angles between the rotation axes of the gates of model.

entanglement_fidelity(a, b, mx_basis)

Entanglement fidelity between a and b

entanglement_infidelity(a, b, mx_basis)

Entanglement infidelity between a and b

closest_unitary_fidelity(a, b, mx_basis)

Entanglement infidelity between closest unitaries to a and b

frobenius_diff(a, b, mx_basis)

Frobenius distance between a and b

jtrace_diff(a, b, mx_basis)

Jamiolkowski trace distance between a and b

std_unitarity(a, b, mx_basis)

a gauge-invariant quantity that behaves like the unitarity

eigenvalue_unitarity(a, b)

a gauge-invariant quantity that behaves like the unitarity

nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

eigenvalue_nonunitary_entanglement_infidelity(a, b, ...)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

eigenvalue_nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

eigenvalue_entanglement_infidelity(a, b, mx_basis)

Eigenvalue entanglement infidelity between a and b

eigenvalue_avg_gate_infidelity(a, b, mx_basis)

Eigenvalue average gate infidelity between a and b

eigenvalue_diamondnorm(a, b, mx_basis)

Eigenvalue diamond distance between a and b

eigenvalue_nonunitary_diamondnorm(a, b, mx_basis)

Eigenvalue nonunitary diamond distance between a and b

avg_gate_infidelity(a, b, mx_basis)

Returns the average gate infidelity between a and b, where b is the "target" operation.

model_model_angles_btwn_axes(a, b, mx_basis)

Angle between the rotation axes of a and b (1-qubit gates)

rel_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

rel_log_tig_eigenvalues(a, b, mx_basis)

Eigenvalues of log(b^{-1} * a)

rel_log_gti_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a * b^{-1})

rel_log_diff_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a) - log(b)

rel_gate_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

errorgen_and_projections(errgen, mx_basis)

Project errgen on all of the standard sets of error generators.

log_tig_and_projections(a, b, mx_basis)

Projections of log(b^{-1}*a).

log_gti_and_projections(a, b, mx_basis)

Projections of log(a*b^{-1}).

log_diff_and_projections(a, b, mx_basis)

Projections of log(a)-log(b).

robust_log_gti_and_projections(model_a, model_b, ...)

Projections of log(A*B^{-1}) using a gauge-robust technique.

general_decomposition(model_a, model_b)

Decomposition of gates in model_a using those in model_b as their targets.

average_gateset_infidelity(model_a, model_b)

Average model infidelity

predicted_rb_number(model_a, model_b)

Prediction of RB number based on estimated (A) and target (B) models

vec_fidelity(a, b, mx_basis)

State fidelity between state vectors a and b

vec_infidelity(a, b, mx_basis)

State infidelity fidelity between state vectors a and b

vec_trace_diff(a, b, mx_basis)

Trace distance between state vectors a and b

vec_as_stdmx(vec, mx_basis)

State vector as a standard density matrix

vec_as_stdmx_eigenvalues(vec, mx_basis)

Eigenvalues of the density matrix corresponding to a state vector

info_of_opfn_by_name(name)

Returns a nice human-readable name and tooltip for a given gate-function abbreviation.

evaluate_opfn_by_name(name, model, target_model, ...)

Evaluates that gate-function named by the abbreviation name.

instrument_infidelity(a, b, mx_basis)

Infidelity between instruments a and b

instrument_half_diamond_norm(a, b, mx_basis)

The diamond norm distance between instruments a and b.

evaluate_instrumentfn_by_name(name, model, ...)

Evaluates that instrument-function named by the abbreviation name.

create_offline_zip([output_dir])

Creates a zip file containing the a directory ("offline") of files need to display "offline" reports.

create_general_report(results, filename[, title, ...])

DEPRECATED: use pygsti.report.create_standard_report(...)

create_standard_report(results, filename[, title, ...])

Create a "standard" GST report, containing details about each estimate in results individually.

create_nqnoise_report(results, filename[, title, ...])

Creates a report designed to display results containing for n-qubit noisy model estimates.

create_report_notebook(results, filename[, title, ...])

Create a "report notebook".

find_std_clifford_compilation(model[, verbosity])

Returns the standard Clifford compilation for model, if one exists. Otherwise returns None.

construct_standard_report(results[, title, ...])

Create a "standard" GST report, containing details about each estimate in results individually.

construct_nqnoise_report(results[, title, ...])

Creates a report designed to display results containing for n-qubit noisy model estimates.

create_drift_report(results[, title, ws, verbosity])

Creates a Drift report.

empty_volumetric_plot([figsize, y_values, x_values, ...])

Creates an empty volumetric plot with just the axes set.

volumetric_plot(data[, y_values, x_values, title, ...])

Creates a volumetric benchmarking plot.

volumetric_boundary_plot(data[, y_values, x_values, ...])

Creates a volumetric benchmarking boundary plot, that displays boundary at which the given data

capability_region_plot(vbdataframe[, metric, ...])

Creates a capability regions plot from a VBDataFrame. Default options creates plots like those shown

volumetric_distribution_plot(vbdataframe[, metric, ...])

Creates volumetric benchmarking plots that display the maximum, mean and minimum of a given figure-of-merit (by

Attributes

FINITE_DIFF_EPS

Spam_dotprods

Choi_matrix

Choi_evals

Choi_trace

Rel_circuit_eigenvalues

Circuit_fro_diff

Circuit_entanglement_infidelity

Circuit_avg_gate_infidelity

Circuit_jt_diff

Circuit_nonunitary_entanglement_infidelity

Circuit_nonunitary_avg_gate_infidelity

Circuit_eigenvalue_entanglement_infidelity

Circuit_eigenvalue_avg_gate_infidelity

Circuit_eigenvalue_nonunitary_entanglement_infidelity

Circuit_eigenvalue_nonunitary_avg_gate_infidelity

Circuit_eigenvalue_diamondnorm

Circuit_eigenvalue_nonunitary_diamondnorm

POVM_entanglement_infidelity

POVM_jt_diff

Upper_bound_fidelity

Closest_ujmx

Maximum_fidelity

Maximum_trace_dist

Angles_btwn_rotn_axes

Entanglement_fidelity

Entanglement_infidelity

Closest_unitary_fidelity

Fro_diff

Jt_diff

Nonunitary_entanglement_infidelity

Nonunitary_avg_gate_infidelity

Eigenvalue_nonunitary_entanglement_infidelity

Eigenvalue_nonunitary_avg_gate_infidelity

Eigenvalue_entanglement_infidelity

Eigenvalue_avg_gate_infidelity

Eigenvalue_diamondnorm

Eigenvalue_nonunitary_diamondnorm

Avg_gate_infidelity

Model_model_angles_btwn_axes

Rel_eigvals

Rel_logTiG_eigvals

Rel_logGTi_eigvals

Rel_logGmlogT_eigvals

Rel_gate_eigenvalues

LogTiG_and_projections

LogGTi_and_projections

LogGmlogT_and_projections

Robust_LogGTi_and_projections

General_decomposition

Average_gateset_infidelity

Predicted_rb_number

Vec_fidelity

Vec_infidelity

Vec_tr_diff

Vec_as_stdmx

Vec_as_stdmx_eigenvalues

Instrument_infidelity

Instrument_half_diamond_norm

ROBUST_SUFFIX_LIST

DEFAULT_NONMARK_ERRBAR_THRESHOLD

class pygsti.report.Notebook(cells=None, notebook_text_files=None)

Bases: object

Python representation of an IPython notebook

Parameters

cellslist, optional

List of NotebookCell objects.

notebook_text_fileslist, optional

List of filenames (text files with ‘@@markdown’ or ‘@@code’ designating cells).

Attributes

DefaultTemplatestr

The default template notebook to use (a .ipynb file).

Create an IPython notebook from a list of cells, list of notebook_text_files, or both.

Parameters

cellslist, optional

List of NotebookCell objects

notebook_text_fileslist, optional

List of filenames (text files with ‘@@markdown’ or ‘@@code’ designating cells)

DefaultTemplate = 'Empty.ipynb'
to_json_dict(template_filename=DefaultTemplate)

Using an existing (usually empty) notebook as a template, generate the json for a new notebook.

Parameters
template_filenamestr, optional

Name of an existing notebook file to build from

Returns

dict

save_to(output_filename, template_filename=DefaultTemplate)

Save this class to a file as a jupyter notebook

Parameters
output_filenamestr

File to save the output jupyter notebook to

template_filenamestr, optional

Name of an existing notebook file to build from

Returns

None

add(cell)

Add a cell to the notebook

Parameters
cellNotebookCell object

Cell to add.

Returns

None

add_block(block, cell_type)

Add a block to the notebook

Parameters
blockstr

block of either code or markdown

cell_typestr

tag for the cell. Either ‘code’ or ‘markdown’

Returns

None

add_file(filename, cell_type)

Read in a cell block from a file

Parameters
filenamestr

filename containing either code or markdown

cell_typestr

tag for the cell. Either ‘code’ or ‘markdown’

Returns

None

add_code(block)

Add code to notebook

Parameters
blockstr

Block of python code

Returns

None

add_markdown(block)

Add markdown to notebook

Parameters
blockstr

Block of markdown (or HTML)

Returns

None

add_code_file(filename)

Add a code file to the notebook

Parameters
filenamestr

name of file containing python code

Returns

None

add_markdown_file(filename)

Add a markdown file to the notebook

Parameters
filenamestr

name of file containing markdown

Returns

None

add_notebook_text(text)

Add custom formatted text to the notebook.

Text contains both python and markdown, with cells differentiated by @@code and @@markdown tags. At least one cell tag must be present for the file to be correctly parsed

Parameters
textstr

notebook formatted text

Returns

None

add_notebook_text_file(filename)

Add a custom formatted text file to the notebook.

Text file contains both python and markdown, with cells differentiated by @@code and @@markdown tags. At least one cell tag must be present for the file to be correctly parsed

Parameters
filenamestr

name of file containing notebook formatted text

Returns

None

add_notebook_text_files(filenames)

Add multiple notebook text files to the notebook, in order

Parameters
filenameslist(str)

names of file containing notebook formatted text

Returns

None

add_notebook_file(filename)

Append an .ipynb file to this notebook

Parameters
filenamestr

ipynb file to append

Returns

None

add_notebook_files(filenames)

Add multiple notebook files to the notebook, in order

Parameters
filenameslist(str)

names of file containing ipynb json

Returns

None

launch_new(output_filename, template_filename=DefaultTemplate)

Save and then launch this notebook with a new Jupyter server.

Note that this function waits to return until the notebook server exists, and so is difficult to work with.

Parameters
output_filenamestr

filename to save this notebook to

template_filenamestr, optional

filename to build this notebook from (see save_to)

Returns

None

launch(output_filename, template_filename=DefaultTemplate, port='auto')

Save and then launch this notebook

Parameters
output_filenamestr

filename to save this notebook to

template_filenamestr, optional

filename to build this notebook from (see save_to)

portint, optional

Port to launch server on.

Returns

None

class pygsti.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.

pygsti.report.FINITE_DIFF_EPS = 1e-07
pygsti.report.evaluate(model_fn, cri=None, verbosity=0)

Evaluate a ModelFunction object using confidence region information

Parameters

model_fnModelFunction

The function to evaluate

criConfidenceRegionFactoryView, optional

View for computing confidence intervals.

verbosityint, optional

Amount of detail to print to stdout.

Returns

ReportableQty or dict

If model_fn does returns a dict of ReportableQty objects, otherwise a single ReportableQty.

pygsti.report.spam_dotprods(rho_vecs, povms)

SPAM dot products (concatenates POVMS)

Parameters

rho_vecslist

A list of State objects.

povmslist

A list of POVM objects.

Returns

numpy.ndarray

A 2D array of shape (len(rho_vecs), num_evecs) where num_evecs is the total number of effect vectors in all of povms.

pygsti.report.Spam_dotprods
pygsti.report.choi_matrix(gate, mx_basis)

Choi matrix

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

numpy.ndarray

pygsti.report.Choi_matrix
pygsti.report.choi_eigenvalues(gate, mx_basis)

Choi matrix eigenvalues

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

numpy.ndarray

pygsti.report.Choi_evals
pygsti.report.choi_trace(gate, mx_basis)

Trace of the Choi matrix

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

float

pygsti.report.Choi_trace
class pygsti.report.GateEigenvalues(model, oplabel)

Bases: pygsti.report.modelfunction.ModelFunction

Gate eigenvalues

Parameters

modelModel

Model gate is contained within.

oplabelLabel

The gate’s label within model.

Creates a new ModelFunction object.

Parameters

modelModel

A sample model giving the constructor a template for what type/parameterization of model to expect in calls to evaluate().

dependencieslist

A list of (type,*label*) tuples, or the special strings “all” and “spam”, indicating which Model parameters the function depends upon. Here type can be “gate”, “prep”, “povm”, or “instrument”, and label can be any of the corresponding labels found in the models being evaluated. The reason for specifying this at all is to speed up computation of the finite difference derivative needed to find the error bars.

evaluate(model)

Evaluate at model

Parameters
modelModel

A model nearby in parameter space.

Returns

numpy.ndarray

evaluate_nearby(nearby_model)

Evaluate at a nearby model

Parameters
nearby_modelModel

A model nearby in parameter space.

Returns

numpy.ndarray

class pygsti.report.CircuitEigenvalues(model, circuit)

Bases: pygsti.report.modelfunction.ModelFunction

Circuit eigenvalues

Parameters

modelModel

Model used to evaluate circuit.

circuitCircuit

The circuit whose process matrix we want the eigenvalues of.

Creates a new ModelFunction object.

Parameters

modelModel

A sample model giving the constructor a template for what type/parameterization of model to expect in calls to evaluate().

dependencieslist

A list of (type,*label*) tuples, or the special strings “all” and “spam”, indicating which Model parameters the function depends upon. Here type can be “gate”, “prep”, “povm”, or “instrument”, and label can be any of the corresponding labels found in the models being evaluated. The reason for specifying this at all is to speed up computation of the finite difference derivative needed to find the error bars.

evaluate(model)

Evaluate at model

Parameters
modelModel

Model to evaluate at.

Returns

numpy.ndarray

evaluate_nearby(nearby_model)

Evaluate at nearby model

Parameters
nearby_modelModel

A model nearby in parameter space.

Returns

numpy.ndarray

pygsti.report.rel_circuit_eigenvalues(model_a, model_b, circuit)

Eigenvalues of dot(productB(circuit)^-1, productA(circuit))

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

numpy.ndarray

pygsti.report.Rel_circuit_eigenvalues
pygsti.report.circuit_frobenius_diff(model_a, model_b, circuit)

Frobenius distance btwn productA(circuit) and productB(circuit)

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_fro_diff
pygsti.report.circuit_entanglement_infidelity(model_a, model_b, circuit)

Entanglement infidelity btwn productA(circuit) and productB(circuit)

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_entanglement_infidelity
pygsti.report.circuit_avg_gate_infidelity(model_a, model_b, circuit)

Average gate infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_avg_gate_infidelity
pygsti.report.circuit_jtrace_diff(model_a, model_b, circuit)

Jamiolkowski trace distance between productA(circuit) and productB(circuit)

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_jt_diff
class pygsti.report.CircuitHalfDiamondNorm(model_a, model_b, circuit)

Bases: pygsti.report.modelfunction.ModelFunction

1/2 diamond norm of difference between productA(circuit) and productB(circuit)

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Creates a new ModelFunction object.

Parameters

modelModel

A sample model giving the constructor a template for what type/parameterization of model to expect in calls to evaluate().

dependencieslist

A list of (type,*label*) tuples, or the special strings “all” and “spam”, indicating which Model parameters the function depends upon. Here type can be “gate”, “prep”, “povm”, or “instrument”, and label can be any of the corresponding labels found in the models being evaluated. The reason for specifying this at all is to speed up computation of the finite difference derivative needed to find the error bars.

evaluate(model)

Evaluate this function at model

Parameters
modelModel

Model to evaluate at.

Returns

float

evaluate_nearby(nearby_model)

Evaluate at a nearby model

Parameters
nearby_modelModel

A model nearby in parameter space.

Returns

float

pygsti.report.circuit_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Nonunitary entanglement infidelity between productA(circuit) and productB(circuit)

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_nonunitary_entanglement_infidelity
pygsti.report.circuit_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Nonunitary average gate infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_nonunitary_avg_gate_infidelity
pygsti.report.circuit_eigenvalue_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue entanglement infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_entanglement_infidelity
pygsti.report.circuit_eigenvalue_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue average gate infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_avg_gate_infidelity
pygsti.report.circuit_eigenvalue_nonunitary_entanglement_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary entanglement infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_nonunitary_entanglement_infidelity
pygsti.report.circuit_eigenvalue_nonunitary_avg_gate_infidelity(model_a, model_b, circuit)

Eigenvalue nonunitary average gate infidelity between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_nonunitary_avg_gate_infidelity
pygsti.report.circuit_eigenvalue_diamondnorm(model_a, model_b, circuit)

Eigenvalue diamond distance between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_diamondnorm
pygsti.report.circuit_eigenvalue_nonunitary_diamondnorm(model_a, model_b, circuit)

Eigenvalue nonunitary diamond distance between productA(circuit) and productB(circuit).

Parameters

model_aModel

The first model (to evaluate productA)

model_bModel

The second model (to evaluate productB)

circuitCircuit

The circuit.

Returns

float

pygsti.report.Circuit_eigenvalue_nonunitary_diamondnorm
pygsti.report.povm_entanglement_infidelity(model_a, model_b, povmlbl)

POVM entanglement infidelity between model_a and model_b.

Equal to 1 - entanglement_fidelity(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters

model_aModel

The first model.

model_bModel

The second model.

povmlblLabel

The POVM label (must be present in both models).

Returns

float

pygsti.report.POVM_entanglement_infidelity
pygsti.report.povm_jtrace_diff(model_a, model_b, povmlbl)

POVM Jamiolkowski trace distance between model_a and model_b

Equal to Jamiolkowski_trace_distance(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters

model_aModel

The first model.

model_bModel

The second model.

povmlblLabel

The POVM label (must be present in both models).

Returns

float

pygsti.report.POVM_jt_diff
pygsti.report.povm_half_diamond_norm(model_a, model_b, povmlbl)

Half the POVM diamond distance between model_a and model_b.

Equal to half_diamond_dist(POVM_MAP) where POVM_MAP is the extension of the POVM from the classical space of k-outcomes to the space of (diagonal) k by k density matrices.

Parameters

model_aModel

The first model.

model_bModel

The second model.

povmlblLabel

The POVM label (must be present in both models).

Returns

float

pygsti.report.decomposition(gate)

DEPRECATED: Decompose a 1Q gate into rotations about axes.

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

Returns

ReportableQty

pygsti.report.upper_bound_fidelity(gate, mx_basis)

Upper bound on entanglement fidelity

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

float

pygsti.report.Upper_bound_fidelity
pygsti.report.closest_ujmx(gate, mx_basis)

Jamiolkowski state of closest unitary to gate

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

float

pygsti.report.Closest_ujmx
pygsti.report.maximum_fidelity(gate, mx_basis)

Fidelity between gate and its closest unitary

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

float

pygsti.report.Maximum_fidelity
pygsti.report.maximum_trace_dist(gate, mx_basis)

Jamiolkowski trace distance between gate and its closest unitary

Parameters

gatenumpy.ndarray

the transfer-matrix specifying a gate’s action.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that gate is in.

Returns

float

pygsti.report.Maximum_trace_dist
pygsti.report.angles_btwn_rotn_axes(model)

Array of angles between the rotation axes of the gates of model.

Parameters

modelModel

The model to process.

Returns

numpy.ndarray

Of size (nOperations,nGate) where nOperations=len(model.operations)

pygsti.report.Angles_btwn_rotn_axes
pygsti.report.entanglement_fidelity(a, b, mx_basis)

Entanglement fidelity between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Entanglement_fidelity
pygsti.report.entanglement_infidelity(a, b, mx_basis)

Entanglement infidelity between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Entanglement_infidelity
pygsti.report.closest_unitary_fidelity(a, b, mx_basis)

Entanglement infidelity between closest unitaries to a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Closest_unitary_fidelity
pygsti.report.frobenius_diff(a, b, mx_basis)

Frobenius distance between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Fro_diff
pygsti.report.jtrace_diff(a, b, mx_basis)

Jamiolkowski trace distance between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Jt_diff
class pygsti.report.HalfDiamondNorm(model_a, model_b, oplabel)

Bases: pygsti.report.modelfunction.ModelFunction

Half the diamond distance bewteen model_a.operations[op_label] and model_b.operations[op_label]

Parameters

model_aModel

The first model.

model_bModel

The second model.

oplabelLabel

The operation (gate) label to compare.

Creates a new ModelFunction object.

Parameters

modelModel

A sample model giving the constructor a template for what type/parameterization of model to expect in calls to evaluate().

dependencieslist

A list of (type,*label*) tuples, or the special strings “all” and “spam”, indicating which Model parameters the function depends upon. Here type can be “gate”, “prep”, “povm”, or “instrument”, and label can be any of the corresponding labels found in the models being evaluated. The reason for specifying this at all is to speed up computation of the finite difference derivative needed to find the error bars.

evaluate(model)

Evaluate at model_a = model

Parameters
modelModel

Model to evaluate at.

Returns

float

evaluate_nearby(nearby_model)

Evaluates at a nearby model

Parameters
nearby_modelModel

A model nearby in parameter space.

Returns

float

pygsti.report.std_unitarity(a, b, mx_basis)

a gauge-invariant quantity that behaves like the unitarity

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.eigenvalue_unitarity(a, b)

a gauge-invariant quantity that behaves like the unitarity

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

Returns

float

pygsti.report.nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Nonunitary_entanglement_infidelity
pygsti.report.nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the unitarity of a*b^{-1}

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Nonunitary_avg_gate_infidelity
pygsti.report.eigenvalue_nonunitary_entanglement_infidelity(a, b, mx_basis)

Returns (d^2 - 1)/d^2 * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_nonunitary_entanglement_infidelity
pygsti.report.eigenvalue_nonunitary_avg_gate_infidelity(a, b, mx_basis)

Returns (d - 1)/d * (1 - sqrt(U)), where U is the eigenvalue-unitarity of a*b^{-1}

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_nonunitary_avg_gate_infidelity
pygsti.report.eigenvalue_entanglement_infidelity(a, b, mx_basis)

Eigenvalue entanglement infidelity between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_entanglement_infidelity
pygsti.report.eigenvalue_avg_gate_infidelity(a, b, mx_basis)

Eigenvalue average gate infidelity between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_avg_gate_infidelity
pygsti.report.eigenvalue_diamondnorm(a, b, mx_basis)

Eigenvalue diamond distance between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_diamondnorm
pygsti.report.eigenvalue_nonunitary_diamondnorm(a, b, mx_basis)

Eigenvalue nonunitary diamond distance between a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Eigenvalue_nonunitary_diamondnorm
pygsti.report.avg_gate_infidelity(a, b, mx_basis)

Returns the average gate infidelity between a and b, where b is the “target” operation.

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Avg_gate_infidelity
pygsti.report.model_model_angles_btwn_axes(a, b, mx_basis)

Angle between the rotation axes of a and b (1-qubit gates)

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Model_model_angles_btwn_axes
pygsti.report.rel_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.Rel_eigvals
pygsti.report.rel_log_tig_eigenvalues(a, b, mx_basis)

Eigenvalues of log(b^{-1} * a)

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.Rel_logTiG_eigvals
pygsti.report.rel_log_gti_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a * b^{-1})

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.Rel_logGTi_eigvals
pygsti.report.rel_log_diff_eigenvalues(a, b, mx_basis)

Eigenvalues of log(a) - log(b)

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.Rel_logGmlogT_eigvals
pygsti.report.rel_gate_eigenvalues(a, b, mx_basis)

Eigenvalues of b^{-1} * a

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

numpy.ndarray

pygsti.report.Rel_gate_eigenvalues
pygsti.report.errorgen_and_projections(errgen, mx_basis)

Project errgen on all of the standard sets of error generators.

Parameters

errgennumpy.ndarray

The error generator.

mx_basisBasis

the basis that errgen is in.

Returns

dict

Dictionary of ‘error generator’, ‘X projections’, and ‘X projection power’ keys, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.log_tig_and_projections(a, b, mx_basis)

Projections of log(b^{-1}*a).

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

dict

A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.LogTiG_and_projections
pygsti.report.log_gti_and_projections(a, b, mx_basis)

Projections of log(a*b^{-1}).

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

dict

A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.LogGTi_and_projections
pygsti.report.log_diff_and_projections(a, b, mx_basis)

Projections of log(a)-log(b).

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

dict

A dictionary of quantities with keys ‘error generator’, ‘X projections’, and ‘X projection power’, where X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.LogGmlogT_and_projections
pygsti.report.robust_log_gti_and_projections(model_a, model_b, synthetic_idle_circuits)

Projections of log(A*B^{-1}) using a gauge-robust technique.

Parameters

model_aModel

The first model (A gates).

model_bModel

The second model (B gates).

synthetic_idle_circuitslist

Circuits that encode synthetic idles.

Returns

dict

A dictionary of quantities with keys ‘G error generator’, ‘G X projections’, and ‘G X projection power’, where G is a operation label and X is ‘hamiltonian’, ‘stochastic’, and ‘affine’.

pygsti.report.Robust_LogGTi_and_projections
pygsti.report.general_decomposition(model_a, model_b)

Decomposition of gates in model_a using those in model_b as their targets.

This function uses a generalized decomposition algorithm that can gates acting on a Hilbert space of any dimension.

Parameters

model_aModel

The model.

model_bModel

The target model.

Returns

dict

pygsti.report.General_decomposition
pygsti.report.average_gateset_infidelity(model_a, model_b)

Average model infidelity

Parameters

model_aModel

The first model.

model_bModel

The second model.

Returns

float

pygsti.report.Average_gateset_infidelity
pygsti.report.predicted_rb_number(model_a, model_b)

Prediction of RB number based on estimated (A) and target (B) models

Parameters

model_aModel

The first model.

model_bModel

The second model.

Returns

float

pygsti.report.Predicted_rb_number
pygsti.report.vec_fidelity(a, b, mx_basis)

State fidelity between state vectors a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Vec_fidelity
pygsti.report.vec_infidelity(a, b, mx_basis)

State infidelity fidelity between state vectors a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Vec_infidelity
pygsti.report.vec_trace_diff(a, b, mx_basis)

Trace distance between state vectors a and b

Parameters

anumpy.ndarray

The first process (transfer) matrix.

bnumpy.ndarray

The second process (transfer) matrix.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Vec_tr_diff
pygsti.report.vec_as_stdmx(vec, mx_basis)

State vector as a standard density matrix

Parameters

vecnumpy.ndarray

state vector as a 1D dense array.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that vec is in.

Returns

numpy.ndarray

A 2D array (matrix) that is vec in the standard basis.

pygsti.report.Vec_as_stdmx
pygsti.report.vec_as_stdmx_eigenvalues(vec, mx_basis)

Eigenvalues of the density matrix corresponding to a state vector

Parameters

vecnumpy.ndarray

state vector as a 1D dense array.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that vec is in.

Returns

numpy.ndarray

pygsti.report.Vec_as_stdmx_eigenvalues
pygsti.report.info_of_opfn_by_name(name)

Returns a nice human-readable name and tooltip for a given gate-function abbreviation.

Parameters

namestr

An appreviation for a gate-function name. Allowed values are:

  • “inf” : entanglement infidelity

  • “agi” : average gate infidelity

  • “trace” : 1/2 trace distance

  • “diamond” : 1/2 diamond norm distance

  • “nuinf” : non-unitary entanglement infidelity

  • “nuagi” : non-unitary entanglement infidelity

  • “evinf” : eigenvalue entanglement infidelity

  • “evagi” : eigenvalue average gate infidelity

  • “evnuinf” : eigenvalue non-unitary entanglement infidelity

  • “evnuagi” : eigenvalue non-unitary entanglement infidelity

  • “evdiamond” : eigenvalue 1/2 diamond norm distance

  • “evnudiamond” : eigenvalue non-unitary 1/2 diamond norm distance

  • “frob” : frobenius distance

  • “unmodeled” : unmodeled “wildcard” budget

Returns

nicename : str tooltip : str

pygsti.report.evaluate_opfn_by_name(name, model, target_model, op_label_or_string, confidence_region_info)

Evaluates that gate-function named by the abbreviation name.

Parameters

namestr

An appreviation for a operation-function name. Allowed values are the same as those of info_of_opfn_by_name().

modelModel

The model used by the operation-function.

target_modelModel

The target model.

op_label_or_stringstr or Circuit or tuple

The operation label or sequence of labels to compare. If a sequence of labels is given, then the “virtual gate” computed by taking the product of the specified gate matrices is compared.

confidence_region_infoConfidenceRegion, optional

If not None, specifies a confidence-region used to compute error intervals.

Returns

ReportableQty

pygsti.report.instrument_infidelity(a, b, mx_basis)

Infidelity between instruments a and b

Parameters

aInstrument

The first instrument.

bInstrument

The second instrument.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Instrument_infidelity
pygsti.report.instrument_half_diamond_norm(a, b, mx_basis)

The diamond norm distance between instruments a and b.

Parameters

aInstrument

The first instrument.

bInstrument

The second instrument.

mx_basisBasis or {‘pp’, ‘gm’, ‘std’}

the basis that a and b are in.

Returns

float

pygsti.report.Instrument_half_diamond_norm
pygsti.report.evaluate_instrumentfn_by_name(name, model, target_model, inst_label, confidence_region_info)

Evaluates that instrument-function named by the abbreviation name.

Parameters

namestr

An appreviation for a operation-function name. Allowed values are the same as those of info_of_opfn_by_name().

modelModel

The model used by the operation-function.

target_modelModel

The target model.

inst_labelLabel

The instrument label to compare.

confidence_region_infoConfidenceRegion, optional

If not None, specifies a confidence-region used to compute error intervals.

Returns

ReportableQty

class pygsti.report.Workspace(cachefile=None)

Bases: object

Central to data analysis, Workspace objects facilitate the building of reports and dashboards.

In particular, they serve as a:

  • factory for tables, plots, and other types of output

  • cache manager to optimize the construction of such output

  • serialization manager for saving and loading analysis variables

Workspace objects are typically used either 1) within an ipython notebook to interactively build a report/dashboard, or 2) within a script to build a hardcoded (“fixed”) report/dashboard.

Parameters

cachefilestr, optional

filename with cached workspace results

Initialize a Workspace object.

Parameters

cachefilestr, optional

filename with cached workspace results

save_cache(cachefile, show_unpickled=False)

Save this Workspace’s cache to a file.

Parameters
cachefilestr

The filename to save the cache to.

show_unpickledbool, optional

Whether to print quantities (keys) of cache that could not be saved because they were not pickle-able.

Returns

None

load_cache(cachefile)

Load this Workspace’s cache from cachefile.

Parameters
cachefilestr

The filename to load the cache from.

Returns

None

init_notebook_mode(connected=False, autodisplay=False)

Initialize this Workspace for use in an iPython notebook environment.

This function should be called prior to using the Workspace when working within an iPython notebook.

Parameters
connectedbool , optional

Whether to assume you are connected to the internet. If you are, then setting this to True allows initialization to rely on web- hosted resources which will reduce the overall size of your notebook.

autodisplaybool , optional

Whether to automatically display workspace objects after they are created.

Returns

None

switched_compute(fn, *args)

Calls a compute function with special handling of SwitchedValue arguments.

This is similar to calling fn, given its name and arguments, when some or all of those arguments are SwitchedValue objects.

Caching is employed to avoid duplicating function evaluations which have the same arguments. Note that the function itself doesn’t need to deal with SwitchValue objects, as this routine resolves such objects into a series of function evaluations using the underlying value(s) within the SwitchValue. This routine is primarily used internally for the computation of tables and plots.

if any of the arguments is an instance of NotApplicable then fn is not evaluated and the instance is returned as the evaluation result. If multiple arguments are NotApplicable instances, the first is used as the result.

Parameters
fnfunction

The function to evaluate

Returns
fn_valueslist

The function return values for all relevant sets of arguments. Denote the length of this list by N.

switchboardslist

A list of all the relevant Switchboards used during the function evaluation. Denote the length of this list by M.

switchboard_switch_indiceslist

A list of length M whose elements are tuples containing the 0-based indices of the relevant switches (i.e. those used by any of the arguments) for each switchboard (element of switchboards).

switchpos_mapdict

A dictionary whose keys are switch positions, and whose values are integers between 0 and N which index the element of fn_values corresponding to the given switch positions. Each “switch positions” key is a tuple of length M whose elements (one per switchboard) are tuples of 0-based switch-position indices indicating the position of the relevant switches of that switchboard. Thus, len(key[i]) = len(switchboard_switch_indices[i]), where key is a dictionary key.

class pygsti.report.PrimitiveOpsSingleScaleWildcardBudget(primitive_op_labels, reference_values=None, alpha=0, idle_name=None, reference_name=None)

Bases: PrimitiveOpsWildcardBudgetBase

A wildcard budget containing a single scaling parameter.

This type of wildcard budget has a single parameter, and sets the wildcard error of each primitive op to be this scale parameter multiplied by a fixed reference value for the primitive op.

Typically, the reference values are chosen to be a modeled metric of gate quality, such as a gate’s gauge-optimized diamond distance to its target gate. Then, once a feasible wildcard error vector is found, the scaling parameter is the fractional increase of the metric (e.g. the diamond distance) of each primitive op needed to reconcile the model and data.

Parameters

primitive_op_labelslist

A list of primitive-operation labels, e.g. Label(‘Gx’,(0,)), which give all the possible primitive ops (components of circuit layers) that will appear in circuits.

reference_valueslist, optional

A list of the reference values for each primitive op, in the same order as primitive_op_list.

alphafloat, optional

The initial value of the single scaling parameter that multiplies the reference values of each op to give the wildcard error that op.

idle_namestr, optional

The gate name to be used for the 1-qubit idle gate. If not None, then circuit budgets are computed by considering layers of the circuit as being “padded” with 1-qubit idles gates on any empty lines.

Create a new WildcardBudget.

Parameters

w_vecnumpy array

The “wildcard vector” which stores the parameters of this budget which can be varied when trying to find an optimal budget (similar to the parameters of a Model).

property alpha
property description

A dictionary of quantities describing this budget.

Return the contents of this budget in a dictionary containing (description, value) pairs for each element name.

Returns
dict

Keys are primitive op labels and values are (description_string, value) tuples.

pygsti.report.ROBUST_SUFFIX_LIST = ['.robust', '.Robust', '.robust+', '.Robust+']
pygsti.report.DEFAULT_NONMARK_ERRBAR_THRESHOLD = 100000.0
pygsti.report.create_offline_zip(output_dir='.')

Creates a zip file containing the a directory (“offline”) of files need to display “offline” reports.

This offline directory is often generated by reports when connected=False is specified..

For offline reports to display, the “offline” folder must be placed in the same directory as the report’s HTML file. This function can be used to easily obtain a copy of the offline folder for the purpose of sharing offline reports with other people. If you’re just creating your own offline reports using pyGSTi, the offline folder is automatically copied into it’s proper position - so you don’t need to call this function.

Parameters

output_dirstr, optional

The directory in which “offline.zip” should be place.

Returns

None

pygsti.report.create_general_report(results, filename, title='auto', confidence_level=None, linlog_percentile=5, errgen_type='logGTi', nmthreshold=DEFAULT_NONMARK_ERRBAR_THRESHOLD, precision=None, comm=None, ws=None, auto_open=False, cachefile=None, brief=False, connected=False, link_to=None, resizable=True, autosize='initial', verbosity=1)

DEPRECATED: use pygsti.report.create_standard_report(…)

Deprecated since version v0.9.9: create_general_report will be removed in the next major release of pyGSTi. It is replaced by construct_standard_report, which returns a Report object.

pygsti.report.create_standard_report(results, filename, title='auto', confidence_level=None, comm=None, ws=None, auto_open=False, link_to=None, brevity=0, advanced_options=None, verbosity=1)

Create a “standard” GST report, containing details about each estimate in results individually.

Either a PDF or HTML report is generated, based on whether filename ends in “.pdf” or not. In the richer HTML-mode, switches (drop-down boxes, buttons, etc.) allow the viewer to choose which estimate is displayed. The estimates in multiple Results objects can be viewed by providing a dictionary of Results objects as the results argument. Note that when comparing many estimates it is often more convenient to view the report generated by create_comparison_report(), which is organized for this purpose.

In PDF-mode this interactivity is not possible and so results may contain just a single estimate. The chief advantage of this more limited mode is that is produces a highly-portable and self-contained PDF file.

Deprecated since version v0.9.9: create_standard_report will be removed in the next major release of pyGSTi. It is replaced by construct_standard_report, which returns a Report object.

Parameters

resultsResults

An object which represents the set of results from one or more GST estimation runs, typically obtained from running run_long_sequence_gst() or run_stdpractice_gst(), OR a dictionary of such objects, representing multiple GST 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).

confidence_levelint, optional

If not None, then the confidence level (between 0 and 100) used in the computation of confidence regions/intervals. If None, no confidence regions or intervals are computed.

commmpi4py.MPI.Comm, optional

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

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

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

advanced_optionsdict, optional

A dictionary of advanced options for which the default values are 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

  • linlogPercentilefloat, optional

    Specifies the colorscale transition point for any logL or chi2 color box plots. The lower (100 - linlogPercentile) percentile of the expected chi2 distribution is shown in a linear grayscale, and the top linlogPercentile is shown on a logarithmic colored scale.

  • errgen_type: {“logG-logT”, “logTiG”, “logGTi”}

    The type of error generator to compute. Allowed values are:

    • “logG-logT” : errgen = log(gate) - log(target_op)

    • “logTiG” : errgen = log( dot(inv(target_op), gate) )

    • “logGTi” : errgen = log( dot(gate, inv(target_op)) )

  • nmthresholdfloat, optional

    The threshold, in units of standard deviations, that triggers the usage of non-Markovian error bars. If None, then non-Markovian error bars are never computed.

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

  • embed_figures: bool, optional

    Whether figures should be embedded in the generated report.

  • combine_robustbool, optional

    Whether robust estimates should automatically be combined with their non-robust counterpart when displayed in reports. (default is True).

  • confidence_interval_brevityint, optional

    Roughly specifies how many figures will have confidence intervals (when applicable). Defaults to ‘1’. Smaller values mean more tables will get confidence intervals (and reports will take longer to generate).

  • idt_basis_dictstuple, optional

    Tuple of (prepDict,measDict) pauli-basis dictionaries, which map between 1-qubit Pauli basis strings (e.g. ‘-X’ or ‘Y’) and tuples of gate names (e.g. (‘Gx’,’Gx’)). If given, idle tomography will be performed on the ‘Gi’ gate and included in the report.

  • idt_idle_oplabelLabel, optional

    The label identifying the idle gate (for use with idle tomography).

  • colorboxplot_bgcolorstr, optional

    Background color for the color box plots in this report. Can be common color names, e.g. “black”, or string RGB values, e.g. “rgb(255,128,0)”.

verbosityint, optional

How much detail to send to stdout.

Returns

Workspace

The workspace object used to create the report

pygsti.report.create_nqnoise_report(results, filename, title='auto', confidence_level=None, comm=None, ws=None, auto_open=False, link_to=None, brevity=0, advanced_options=None, verbosity=1)

Creates a report designed to display results containing for n-qubit noisy model estimates.

Such models are characterized by the fact that gates and SPAM objects may not have dense representations (or it may be very expensive to compute them) , and that these models are likely CloudNoiseModel objects or have similar structure.

Deprecated since version v0.9.9: create_nqnoise_report will be removed in the next major release of pyGSTi. It is replaced by construct_standard_report, which returns a Report object.

Parameters

resultsResults

An object which represents the set of results from one or more GST estimation runs, typically obtained from running run_long_sequence_gst() or run_stdpractice_gst(), OR a dictionary of such objects, representing multiple GST 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).

confidence_levelint, optional

If not None, then the confidence level (between 0 and 100) used in the computation of confidence regions/intervals. If None, no confidence regions or intervals are computed.

commmpi4py.MPI.Comm, optional

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

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

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

advanced_optionsdict, optional

A dictionary of advanced options for which the default values are 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

  • linlogPercentilefloat, optional

    Specifies the colorscale transition point for any logL or chi2 color box plots. The lower (100 - linlogPercentile) percentile of the expected chi2 distribution is shown in a linear grayscale, and the top linlogPercentile is shown on a logarithmic colored scale.

  • nmthresholdfloat, optional

    The threshold, in units of standard deviations, that triggers the usage of non-Markovian error bars. If None, then non-Markovian error bars are never computed.

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

  • combine_robustbool, optional

    Whether robust estimates should automatically be combined with their non-robust counterpart when displayed in reports. (default is True).

  • confidence_interval_brevityint, optional

    Roughly specifies how many figures will have confidence intervals (when applicable). Defaults to ‘1’. Smaller values mean more tables will get confidence intervals (and reports will take longer to generate).

  • colorboxplot_bgcolorstr, optional

    Background color for the color box plots in this report. Can be common color names, e.g. “black”, or string RGB values, e.g. “rgb(255,128,0)”.

verbosityint, optional

How much detail to send to stdout.

Returns

Workspace

The workspace object used to create the report

pygsti.report.create_report_notebook(results, filename, title='auto', confidence_level=None, auto_open=False, connected=False, verbosity=0)

Create a “report notebook”.

A Jupyter ipython notebook file which, when its cells are executed, will generate similar figures to those contained in an html report (via create_standard_report()).

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.

Deprecated since version v0.9.9: create_report_notebook will be removed in the next major release of pyGSTi. It is replaced by the Report.write_notebook

Parameters

resultsResults

An object which represents the set of results from one or more GST estimation runs, typically obtained from running run_long_sequence_gst() or run_stdpractice_gst(), OR a dictionary of such objects, representing multiple GST 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 (via setting Python variables) in the report.

filenamestring, optional

The output filename where the report file(s) will be saved. Must end in “.ipynb”.

titlestring, optional

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

confidence_levelint, optional

If not None, then the confidence level (between 0 and 100) used in the computation of confidence regions/intervals. If None, no confidence regions or intervals are computed.

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.

Returns

None

pygsti.report.find_std_clifford_compilation(model, verbosity=0)

Returns the standard Clifford compilation for model, if one exists. Otherwise returns None.

Parameters

modelModel

The ideal (target) model of primitive gates.

verbosityint, optional

How much detail to send to stdout.

Returns

dict or None

The Clifford compilation dictionary (if one can be found).

pygsti.report.construct_standard_report(results, title='auto', confidence_level=None, comm=None, ws=None, advanced_options=None, verbosity=1)

Create a “standard” GST report, containing details about each estimate in results individually.

Parameters

resultsResults

An object which represents the set of results from one or more GST estimation runs, typically obtained from running run_long_sequence_gst() or run_stdpractice_gst(), OR a dictionary of such objects, representing multiple GST 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.

titlestring, optional

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

confidence_levelint, optional

If not None, then the confidence level (between 0 and 100) used in the computation of confidence regions/intervals. If None, no confidence regions or intervals are computed.

commmpi4py.MPI.Comm, optional

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

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.

advanced_optionsdict, optional

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

  • linlogPercentilefloat, optional

    Specifies the colorscale transition point for any logL or chi2 color box plots. The lower (100 - linlogPercentile) percentile of the expected chi2 distribution is shown in a linear grayscale, and the top linlogPercentile is shown on a logarithmic colored scale.

  • nmthresholdfloat, optional

    The threshold, in units of standard deviations, that triggers the usage of non-Markovian error bars. If None, then non-Markovian error bars are never computed.

  • embed_figures: bool, optional

    Whether figures should be embedded in the generated report.

  • combine_robustbool, optional

    Whether robust estimates should automatically be combined with their non-robust counterpart when displayed in reports. (default is True).

  • idt_basis_dictstuple, optional

    Tuple of (prepDict,measDict) pauli-basis dictionaries, which map between 1-qubit Pauli basis strings (e.g. ‘-X’ or ‘Y’) and tuples of gate names (e.g. (‘Gx’,’Gx’)). If given, idle tomography will be performed on the ‘Gi’ gate and included in the report.

  • idt_idle_oplabelLabel, optional

    The label identifying the idle gate (for use with idle tomography).

verbosityint, optional

How much detail to send to stdout.

Returns

Workspace

The workspace object used to create the report

pygsti.report.construct_nqnoise_report(results, title='auto', confidence_level=None, comm=None, ws=None, advanced_options=None, verbosity=1)

Creates a report designed to display results containing for n-qubit noisy model estimates.

Such models are characterized by the fact that gates and SPAM objects may not have dense representations (or it may be very expensive to compute them) , and that these models are likely CloudNoiseModel objects or have similar structure.

Parameters

resultsResults

An object which represents the set of results from one or more GST estimation runs, typically obtained from running run_long_sequence_gst() or run_stdpractice_gst(), OR a dictionary of such objects, representing multiple GST 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.

titlestring, optional

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

confidence_levelint, optional

If not None, then the confidence level (between 0 and 100) used in the computation of confidence regions/intervals. If None, no confidence regions or intervals are computed.

commmpi4py.MPI.Comm, optional

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

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.

advanced_optionsdict, optional

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

  • linlogPercentilefloat, optional

    Specifies the colorscale transition point for any logL or chi2 color box plots. The lower (100 - linlogPercentile) percentile of the expected chi2 distribution is shown in a linear grayscale, and the top linlogPercentile is shown on a logarithmic colored scale.

  • nmthresholdfloat, optional

    The threshold, in units of standard deviations, that triggers the usage of non-Markovian error bars. If None, then non-Markovian error bars are never computed.

  • combine_robustbool, optional

    Whether robust estimates should automatically be combined with their non-robust counterpart when displayed in reports. (default is True).

  • confidence_interval_brevityint, optional

    Roughly specifies how many figures will have confidence intervals (when applicable). Defaults to ‘1’. Smaller values mean more tables will get confidence intervals (and reports will take longer to generate).

  • embed_figures: bool, optional

    Whether figures should be embedded in the generated report.

verbosityint, optional

How much detail to send to stdout.

Returns

: class:Report : A constructed report object

pygsti.report.create_drift_report(results, title='auto', ws=None, verbosity=1)

Creates a Drift report.

Parameters

resultsStabilityAnalysisResults

The drift-analysis results to create the report from.

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.

verbosityint, optional

How much detail to send to stdout.

Returns

Report : A constructed report object

pygsti.report.empty_volumetric_plot(figsize=None, y_values=None, x_values=None, title=None, xlabel='Depth', ylabel='Width')

Creates an empty volumetric plot with just the axes set.

Parameters

figsizetuple or None, optional

The figure size.

y_valueslist or None, optional

The y-axis values, typically corresponding to circuit widths.

x_valueslist or None, optional

The x-axis values, typically corresponding to circuit depths.

titlestring or None, optional

Plot title

xlabelstring, optional

x-axis label

ylabelstring, optional

y-axis label.

Return

fig, ax : matplolib fig and ax.

pygsti.report.volumetric_plot(data, y_values=None, x_values=None, title=None, fig=None, ax=None, cmap=None, color=None, flagQV=False, qv_threshold=None, figsize=(10, 10), scale=1.0, centerscale=1.0, linescale=1.0, pass_threshold=0, show_threshold=0)

Creates a volumetric benchmarking plot.

pygsti.report.volumetric_boundary_plot(data, y_values=None, x_values=None, boundary=None, threshold=0.5, missing_data_action='continue', monotonic=True, color='k', linewidth=4, linestyle='-', dashing=None, fig=None, ax=None, figsize=None, title=None, label=None)

Creates a volumetric benchmarking boundary plot, that displays boundary at which the given data drops below the specified threshold

pygsti.report.capability_region_plot(vbdataframe, metric='polarization', threshold=1 / _np.e, significance=0.05, figsize=(10, 10), scale=1.0, title=None, colors=None)

Creates a capability regions plot from a VBDataFrame. Default options creates plots like those shown in Fig. 3 of “Measuring the Capabilities of Quantum Computers” arXiv:2008.11294.

pygsti.report.volumetric_distribution_plot(vbdataframe, metric='polarization', threshold=1 / _np.e, hypothesis_test='standard', significance=0.05, figsize=(10, 10), scale=None, title=None, cmap=None)

Creates volumetric benchmarking plots that display the maximum, mean and minimum of a given figure-of-merit (by default, circuit polarization) as a function of circuit shape. This function can be used to create figures like those shown in Fig. 1 of “Measuring the Capabilities of Quantum Computers” arXiv:2008.11294.

Parameters

vbdataframeVBDataFrame

A VBDataFrame object containing the data to be plotted in a VB plot.

metricstring, optional

The quantity to plot. Default is ‘polarization’ as used and defined in arXiv:2008.11294. The plot will show the maximum, mean, and minimum of this metric at each circuit shape.

thresholdfloat, optional

The threshold for “success” for the figure-of-merit defined by metric. This threshold is used to compute the three “success” boundaries that are shown in the plot.

hypothesis_teststring, optional

The type of statistical significance adjustment to apply to the boundaries. The options are

  • ‘standard’: this reproduces the method used and described in arXiv:2008.11294 (see the appendices for details). With this option, there will be a difference between the boundary for the minimum and maximum polarization only if there is statistically significant evidence in the data for this.

  • ‘none’: no statistical significance adjustment: all three boundaries show the point at which relevant statistic (maximum, mean, minimum) drops below the threshold.

significancefloat, optional

The statistical significance in the hypothesis tests. Only used in hypothesis_test is not ‘none’.

figsizetuple, optional

The figure size

scaledict, optional

The scale for the three concentric squares, showing the maximum, mean and minimum. Defaults to {‘min’: 1.95, ‘mean’: 1, ‘max’: 0.13}.

titlesting, optional

The figure title.

cmapColorMap, optional

A matplotlib colormap.

Return

fig, ax : matplolib fig and ax.