pygsti.report.workspaceplots

Classes corresponding to plots within a Workspace context.

Module Contents

Classes

BoxKeyPlot

Plot serving as a key for fiducial rows/columns of each plaquette of a circuit color box plot.

ColorBoxPlot

Plot of colored boxes arranged into plaquettes showing various quanties for each circuit in an analysis.

GateMatrixPlot

Plot of a operation matrix using colored boxes.

MatrixPlot

Plot of a general matrix using colored boxes

PolarEigenvaluePlot

Polar plot of complex eigenvalues

ProjectionsBoxPlot

Plot of matrix of (usually error-generator) projections

ChoiEigenvalueBarPlot

Bar plot of eigenvalues showing red bars for negative values

GramMatrixBarPlot

Bar plot of Gram matrix eigenvalues stacked against those of target

FitComparisonBarPlot

Bar plot showing the overall (aggregate) goodness of fit (along one dimension).

FitComparisonBoxPlot

Box plot showing the overall (aggregate) goodness of fit (along 2 dimensions).

DatasetComparisonSummaryPlot

A grid of grayscale boxes comparing data sets pair-wise.

DatasetComparisonHistogramPlot

Histogram of p-values comparing two data sets

WildcardSingleScaleBarPlot

Stacked bar plot showing per-gate reference values and wildcard budgets.

RandomizedBenchmarkingPlot

Plot of RB Decay curve

Attributes

go_x_axis

pygsti.report.workspaceplots.go_x_axis
class pygsti.report.workspaceplots.BoxKeyPlot(ws, prep_fiducials, meas_fiducials, xlabel='Preparation fiducial', ylabel='Measurement fiducial', scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

Plot serving as a key for fiducial rows/columns of each plaquette of a circuit color box plot.

This plot shows the layout of a single sub-block of a goodness-of-fit box plot (such as those produced by ColorBoxPlot)

Parameters

wsWorkspace

The containing (parent) workspace.

prep_fiducialslist of Circuits

Preparation fiducials.

meas_fiducialslist of Circuits

Measurement fiducials.

xlabel: str, optional

X-axis label

ylabel: str, optional

Y-axis label

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Create a plot showing the layout of a single sub-block of a goodness-of-fit box plot (such as those produced by ColorBoxPlot)

Parameters

prep_fiducials, meas_fiducialslist of Circuits

Preparation and measurement fiducials.

xlabel, ylabelstr, optional

X and Y axis labels

scalefloat, optional

Scaling factor to adjust the size of the final figure.

class pygsti.report.workspaceplots.ColorBoxPlot(ws, plottype, circuits, dataset, model, sum_up=False, box_labels=False, hover_info=True, invert=False, prec='compact', linlg_pcntle=0.05, direct_gst_models=None, dscomparator=None, stabilityanalyzer=None, mdc_store=None, submatrices=None, typ='boxes', scale=1.0, comm=None, wildcard=None, colorbar=False, bgcolor='white', genericdict=None, genericdict_threshold=None)

Bases: pygsti.report.workspace.WorkspacePlot

Plot of colored boxes arranged into plaquettes showing various quanties for each circuit in an analysis.

Parameters

wsWorkspace

The containing (parent) workspace.

plottype{“chi2”,”logl”,”tvd”,”blank”,”errorrate”,”dscmp”, “driftdetector”, “driftsize”}

Specifies the type of plot. “errorate” requires that direct_gst_models be set.

circuitsCircuitList or list of Circuits

Specifies the set of circuits, usually along with their structure, e.g. fiducials, germs, and maximum lengths.

datasetDataSet

The data used to specify frequencies and counts.

modelModel

The model used to specify the probabilities and SPAM labels.

sum_upbool, optional

False displays each matrix element as it’s own color box True sums the elements of each (x,y) matrix and displays a single color box for the sum.

box_labelsbool, optional

Whether box labels are displayed. It takes much longer to generate the figure when this is set to True.

hover_infobool, optional

Whether to include interactive hover labels.

invertbool, optional

If True, invert the nesting order of the color box plot (applicable only when sum_up == False).

precint, optional

Precision for box labels. Allowed values are: * ‘compact’ = round to nearest whole number using at most 3 characters * ‘compacthp’ = show as much precision as possible using at most 3 characters * int >= 0 = fixed precision given by int * int < 0 = number of significant figures given by -int

linlg_pcntlefloat, optional

Specifies the (1 - linlg_pcntle) percentile to compute for the boxplots

direct_gst_modelsdict, optional

A dictionary of “direct” Models used when displaying certain plot types. Keys are circuits and values are corresponding gate sets (see plottype above).

dscomparatorDataComparator, optional

The data set comparator used to produce the “dscmp” plot type.

stabilityanalyzerStabilityAnalyzer or 3-tuple, optional

Only used to produce the “driftdetector” and “driftsize” boxplot. If a StabilityAnalyzer, then this contains the results of the drift / stability analysis to be displayed. For non-expert users, this is the best option. If a tuple, then the first element of the tuple is this StabilityAnalyzer object, and the second and third elements of the tuple label which instability detection results to display (a StabilityAnalyzer can contain multiple distinct tests for instability). The second element is the “detectorkey”, which can be None (the default), or a string specifying which of the drift detection results to use for the plot. If it is None, then the default set of results are used. The third element of the tuple is either None, or a tuple that specifies which “level” of tests to use from the drift detection run (specified by the detectorkey), e.g., per-circuit with outcomes averaged or per-circuit per-outcome.

submatricesdict, optional

A dictionary whose keys correspond to other potential plot types and whose values are each a list-of-lists of the sub matrices to plot, corresponding to the used x and y values of the structure of circuits.

typ{“boxes”,”scatter”,”histogram”}

Which type of plot to make: the standard grid of “boxes”, a “scatter” plot of the values vs. sequence length, or a “histogram” of all the values.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function that increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by model before comparing with the frequencies in dataset. Currently, this functionality is only supported for plottype == “logl”.

colorbarbool, optional

Whether to include a colorbar.

bgcolorstr, optional

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

Create a plot displaying the value of per-circuit quantities. TODO: docstring

Values are shown on a grid of colored boxes, organized according to the structure of the circuits (e.g. by germ and “L”).

Parameters

plottype{“chi2”,”logl”,”tvd”,”blank”,”errorrate”,”dscmp”, “driftdetector”, “driftsize”}

Specifies the type of plot. “errorate” requires that direct_gst_models be set.

circuitsCircuitList or list of Circuits

Specifies the set of circuits, usually along with their structure, e.g. fiducials, germs, and maximum lengths.

datasetDataSet

The data used to specify frequencies and counts.

modelModel

The model used to specify the probabilities and SPAM labels.

sum_upbool, optional

False displays each matrix element as it’s own color box True sums the elements of each (x,y) matrix and displays a single color box for the sum.

box_labelsbool, optional

Whether box labels are displayed. It takes much longer to generate the figure when this is set to True.

hover_infobool, optional

Whether to include interactive hover labels.

invertbool, optional

If True, invert the nesting order of the color box plot (applicable only when sum_up == False).

precint, optional
Precision for box labels. Allowed values are:

‘compact’ = round to nearest whole number using at most 3 characters ‘compacthp’ = show as much precision as possible using at most 3 characters int >= 0 = fixed precision given by int int < 0 = number of significant figures given by -int

linlg_pcntlefloat, optional

Specifies the (1 - linlg_pcntle) percentile to compute for the boxplots

direct_gst_modelsdict, optional

A dictionary of “direct” Models used when displaying certain plot types. Keys are circuits and values are corresponding gate sets (see plottype above).

dscomparatorDataComparator, optional

The data set comparator used to produce the “dscmp” plot type.

stabilityanalyzerStabilityAnalyzer or 3-tuple, optional

Only used to produce the “driftdetector” and “driftsize” boxplot. If a StabilityAnalyzer, then this contains the results of the drift / stability analysis to be displayed. For non-expert users, this is the best option. If a tuple, then the first element of the tuple is this StabilityAnalyzer object, and the second and third elements of the tuple label which instability detection results to display (a StabilityAnalyzer can contain multiple distinct tests for instability). The second element is the “detectorkey”, which can be None (the default), or a string specifying which of the drift detection results to use for the plot. If it is None, then the default set of results are used. The third element of the tuple is either None, or a tuple that specifies which “level” of tests to use from the drift detection run (specified by the detectorkey), e.g., per-circuit with outcomes averaged or per-circuit per-outcome.

submatricesdict, optional

A dictionary whose keys correspond to other potential plot types and whose values are each a list-of-lists of the sub matrices to plot, corresponding to the used x and y values of the structure of circuits.

typ{“boxes”,”scatter”,”histogram”}

Which type of plot to make: the standard grid of “boxes”, a “scatter” plot of the values vs. sequence length, or a “histogram” of all the values.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function that increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by model before comparing with the frequencies in dataset. Currently, this functionality is only supported for plottype == “logl”.

colorbarbool, optional

Whether to include a colorbar.

bgcolorstr, optional

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

class pygsti.report.workspaceplots.GateMatrixPlot(ws, op_matrix, color_min=-1.0, color_max=1.0, mx_basis=None, xlabel=None, ylabel=None, box_labels=False, colorbar=None, prec=0, mx_basis_y=None, scale=1.0, eb_matrix=None)

Bases: pygsti.report.workspace.WorkspacePlot

Plot of a operation matrix using colored boxes.

More specific than MatrixPlot because of basis formatting for x and y labels.

Parameters

wsWorkspace

The containing (parent) workspace.

op_matrixndarray

The operation matrix data to display.

color_minfloat, optional

Minimum value of the color scale.

color_maxfloat, optional

Maximum value of the color scale.

mx_basisstr or Basis object, optional

The basis, often of op_matrix, used to create the x-labels (and y-labels when mx_basis_y is None). Typically in {“pp”,”gm”,”std”,”qt”}. If you don’t want labels, leave as None.

xlabelstr, optional

A x-axis label for the plot.

ylabelstr, optional

A y-axis label for the plot.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

mx_basis_ystr or Basis object, optional

The basis, used to create the y-labels (for rows) when these are different from the x-labels. Typically in {“pp”,”gm”,”std”,”qt”}. If you don’t want labels, leave as None.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

eb_matrixnumpy array, optional

An array, of the same size as op_matrix, which gives error bars to be be displayed in the hover info.

Creates a color box plot of a operation matrix using a diverging color map.

This can be a useful way to display large matrices which have so many entries that their entries cannot easily fit within the width of a page.

Parameters

op_matrixndarray

The operation matrix data to display.

color_min, color_maxfloat, optional

Min and max values of the color scale.

mx_basisstr or Basis object, optional

The basis, often of op_matrix, used to create the x-labels (and y-labels when mx_basis_y is None). Typically in {“pp”,”gm”,”std”,”qt”}. If you don’t want labels, leave as None.

xlabelstr, optional

A x-axis label for the plot.

ylabelstr, optional

A y-axis label for the plot.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

mx_basis_ystr or Basis object, optional

The basis, used to create the y-labels (for rows) when these are different from the x-labels. Typically in {“pp”,”gm”,”std”,”qt”}. If you don’t want labels, leave as None.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

eb_matrixnumpy array, optional

An array, of the same size as op_matrix, which gives error bars to be be displayed in the hover info.

class pygsti.report.workspaceplots.MatrixPlot(ws, matrix, color_min=-1.0, color_max=1.0, xlabels=None, ylabels=None, xlabel=None, ylabel=None, box_labels=False, colorbar=None, colormap=None, prec=0, scale=1.0, grid='black')

Bases: pygsti.report.workspace.WorkspacePlot

Plot of a general matrix using colored boxes

Parameters

wsWorkspace

The containing (parent) workspace.

matrixndarray

The operation matrix data to display.

color_minfloat

Color scale minimum.

color_maxfloat

Color scale maximum.

xlabelslist, optional

List of (str) box labels along the x-axis.

ylabelslist, optional

List of (str) box labels along the y-axis.

xlabelstr, optional

A x-axis label for the plot.

ylabelstr, optional

A y-axis label for the plot.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

colormapColormap, optional

A color map object used to convert the numerical matrix values into colors.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

scalefloat, optional

Scaling factor to adjust the size of the final figure.

grid{“white”,”black”,None}

What color grid lines, if any, to add to the plot. Advanced usage allows the addition of :N where N is an integer giving the line width.

Creates a color box plot of a matrix using the given color map.

This can be a useful way to display large matrices which have so many entries that their entries cannot easily fit within the width of a page.

Parameters

matrixndarray

The operation matrix data to display.

color_min, color_maxfloat, optional

Min and max values of the color scale.

xlabels, ylabels: list, optional

List of (str) box labels for each axis.

xlabelstr, optional

A x-axis label for the plot.

ylabelstr, optional

A y-axis label for the plot.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

colormapColormap, optional

A color map object used to convert the numerical matrix values into colors.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

scalefloat, optional

Scaling factor to adjust the size of the final figure.

grid{“white”,”black”,None}

What color grid lines, if any, to add to the plot. Advanced usage allows the addition of :N where N is an integer giving the line width.

class pygsti.report.workspaceplots.PolarEigenvaluePlot(ws, evals_list, colors, labels=None, scale=1.0, amp=None, center_text=None)

Bases: pygsti.report.workspace.WorkspacePlot

Polar plot of complex eigenvalues

Parameters

wsWorkspace

The containing (parent) workspace.

evals_listlist

A list of eigenvalue arrays to display.

colorslist

A corresponding list of color names to use for arrays given by evals_list (must have len(colors) == len(evals_list)). Colors can be standard names, e.g. “blue”, or rgb strings such as “rgb(23,92,64)”.

labelslist, optional

A list of labels, one for each element of evals_list to be placed in the plot legend.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

ampfloat, optional

An amount to amplify (raise to the exponent amp) each set of eigenvalues. (Amplified eigenvalues are shown in the same color but with smaller markers.) If amp is None, no amplification is performed.

center_textstr, optional

Text to be placed at the very center of the polar plot (sometimes useful to use as a title).

Creates a polar plot of one or more sets of eigenvalues (or any complex #s).

Parameters

evals_listlist

A list of eigenvalue arrays to display.

colorslist

A corresponding list of color names to use for arrays given by evals_list (must have len(colors) == len(evals_list)). Colors can be standard names, e.g. “blue”, or rgb strings such as “rgb(23,92,64)”.

labelslist, optional

A list of labels, one for each element of evals_list to be placed in the plot legend.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

ampfloat, optional

An amount to amplify (raise to the exponent amp) each set of eigenvalues. (Amplified eigenvalues are shown in the same color but with smaller markers.) If amp is None, no amplification is performed.

center_textstr, optional

Text to be placed at the very center of the polar plot (sometimes useful to use as a title).

class pygsti.report.workspaceplots.ProjectionsBoxPlot(ws, projections, projection_basis, color_min=None, color_max=None, box_labels=False, colorbar=None, prec='compacthp', scale=1.0, eb_matrix=None, title=None)

Bases: pygsti.report.workspace.WorkspacePlot

Plot of matrix of (usually error-generator) projections

Parameters

wsWorkspace

The containing (parent) workspace.

projectionsndarray

A 1-dimensional array of length equal to the numer of elements in the given basis (usually equal to the gate dimension). Ordering of the values is assumed to correspond to the ordering given by the routines in pygsti.tools, (e.g. pp_matrices() when projection_basis equals “pp”).

projection_basis{‘std’, ‘gm’, ‘pp’, ‘qt’}

The basis is used to construct the error generators onto which the gate error generator is projected. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp) and Qutrit (qt).

color_minfloat, optional

Minimum value of the color scale. If None, then computed automatically from the data range.

color_maxfloat, optional

Maximum value of the color scale. If None, then computed automatically from the data range.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

scalefloat, optional

Scaling factor to adjust the size of the final figure.

eb_matrixnumpy array, optional

An array, of the same size as projections, which gives error bars to be be displayed in the hover info.

titlestr, optional

A title for the plot

Creates a color box plot displaying projections.

Typically projections is obtained by calling std_errorgen_projections(), and so holds the projections of a gate error generator onto the generators corresponding to a set of standard errors constructed from the given basis.

Parameters

projectionsndarray

A 1-dimensional array of length equal to the numer of elements in the given basis (usually equal to the gate dimension). Ordering of the values is assumed to correspond to the ordering given by the routines in pygsti.tools, (e.g. pp_matrices() when projection_basis equals “pp”).

projection_basis{‘std’, ‘gm’, ‘pp’, ‘qt’}

The basis is used to construct the error generators onto which the gate error generator is projected. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp) and Qutrit (qt).

color_min,color_maxfloat, optional

Color scale min and max values, respectivey. If None, then computed automatically from the data range.

box_labelsbool, optional

Whether box labels are displayed.

colorbarbool optional

Whether to display a color bar to the right of the box plot. If None, then a colorbar is displayed when box_labels == False.

precint or {‘compact’,’compacthp’}, optional

Precision for box labels. Only relevant when box_labels == True. Allowed values are:

  • ‘compact’ = round to nearest whole number using at most 3 characters

  • ‘compacthp’ = show as much precision as possible using at most 3 characters

  • int >= 0 = fixed precision given by int

  • int < 0 = number of significant figures given by -int

scalefloat, optional

Scaling factor to adjust the size of the final figure.

eb_matrixnumpy array, optional

An array, of the same size as projections, which gives error bars to be be displayed in the hover info.

titlestr, optional

A title for the plot

class pygsti.report.workspaceplots.ChoiEigenvalueBarPlot(ws, evals, errbars=None, scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

Bar plot of eigenvalues showing red bars for negative values

Parameters

wsWorkspace

The containing (parent) workspace.

evalsndarray

An array containing the eigenvalues to plot.

errbarsndarray, optional

An array containing the lengths of the error bars to place on each bar of the plot.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Creates a bar plot showing the real parts of each of the eigenvalues given. This is useful for plotting the eigenvalues of Choi matrices, since all elements are positive for a CPTP map.

Parameters

evalsndarray

An array containing the eigenvalues to plot.

errbarsndarray, optional

An array containing the lengths of the error bars to place on each bar of the plot.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

class pygsti.report.workspaceplots.GramMatrixBarPlot(ws, dataset, target, maxlen=10, fixed_lists=None, scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

Bar plot of Gram matrix eigenvalues stacked against those of target

Parameters

wsWorkspace

The containing (parent) workspace.

datasetDataSet

The DataSet

targetModel

A target model which is used for it’s mapping of SPAM labels to SPAM specifiers and for Gram matrix comparision.

maxleninteger, optional

The maximum length string used when searching for the maximal (best) Gram matrix. It’s useful to make this at least twice the maximum length fiducial sequence.

fixed_lists(prep_fiducials, meas_fiducials), optional

2-tuple of circuit lists, specifying the preparation and measurement fiducials to use when constructing the Gram matrix, and thereby bypassing the search for such lists.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Creates a bar plot showing eigenvalues of the Gram matrix compared to those of the a target model’s Gram matrix.

Parameters

datasetDataSet

The DataSet

targetModel

A target model which is used for it’s mapping of SPAM labels to SPAM specifiers and for Gram matrix comparision.

maxleninteger, optional

The maximum length string used when searching for the maximal (best) Gram matrix. It’s useful to make this at least twice the maximum length fiducial sequence.

fixed_lists(prep_fiducials, meas_fiducials), optional

2-tuple of circuit lists, specifying the preparation and measurement fiducials to use when constructing the Gram matrix, and thereby bypassing the search for such lists.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

class pygsti.report.workspaceplots.FitComparisonBarPlot(ws, x_names, circuits_by_x, model_by_x, dataset_by_x, objfn_builder='logl', x_label='L', np_by_x=None, scale=1.0, comm=None, wildcard=None)

Bases: pygsti.report.workspace.WorkspacePlot

Bar plot showing the overall (aggregate) goodness of fit (along one dimension).

Parameters

wsWorkspace

The containing (parent) workspace.

x_nameslist

List of x-values. Typically these are the integer maximum lengths or exponents used to index the different iterations of GST, but they can also be strings.

circuits_by_xlist of (CircuitLists or lists of Circuits)

Specifies the set of circuits used at each x-value.

model_by_xlist of Models

Model corresponding to each x-value.

dataset_by_xDataSet or list of DataSets

The data sets to compare each model against. If a single DataSet is given, then it is used for all comparisons.

objfn_builderObjectiveFunctionBuilder or {“logl”, “chi2”}, optional

The objective function to use, or one of the given strings to use a defaut log-likelihood or chi^2 function.

x_labelstr, optional

A label for the ‘x’ variable which indexes the different models. This string will be the x-label of the resulting bar plot.

np_by_xlist of ints, optional

A list of parameter counts to use for each x. If None, then the number of non-gauge parameters for each model is used.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function (objective), which increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by a model before comparing with the frequencies in dataset. Currently, this functionality is only supported for objective == “logl”.

Creates a bar plot showing the overall (aggregate) goodness of fit for one or more model estimates to corresponding data sets.

Parameters

x_nameslist

List of x-values. Typically these are the integer maximum lengths or exponents used to index the different iterations of GST, but they can also be strings.

circuits_by_xlist of (CircuitLists or lists of Circuits)

Specifies the set of circuits used at each x-value.

model_by_xlist of Models

Model corresponding to each x-value.

dataset_by_xDataSet or list of DataSets

The data sets to compare each model against. If a single DataSet is given, then it is used for all comparisons.

objfn_builderObjectiveFunctionBuilder or {“logl”, “chi2”}, optional

The objective function to use, or one of the given strings to use a defaut log-likelihood or chi^2 function.

x_labelstr, optional

A label for the ‘x’ variable which indexes the different models. This string will be the x-label of the resulting bar plot.

np_by_xlist of ints, optional

A list of parameter counts to use for each x. If None, then the number of non-gauge parameters for each model is used.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function (objective), which increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by a model before comparing with the frequencies in dataset. Currently, this functionality is only supported for objective == “logl”.

class pygsti.report.workspaceplots.FitComparisonBoxPlot(ws, xs, ys, circuits_by_y_then_x, model_by_y_then_x, dataset_by_y_then_x, objfn_builder='logl', x_label=None, y_label=None, scale=1.0, comm=None, wildcard=None)

Bases: pygsti.report.workspace.WorkspacePlot

Box plot showing the overall (aggregate) goodness of fit (along 2 dimensions).

Parameters

wsWorkspace

The containing (parent) workspace.

xslist

List of X-values (converted to strings).

yslist

List of Y-values (converted to strings).

circuits_by_y_then_xlist of lists of PlaquetteGridCircuitStructure objects

Specifies the circuits used at each Y and X value, indexed as circuits_by_y_then_x[iY][iX], where iX and iY are X and Y indices, respectively.

model_by_y_then_xlist of lists of Models

Model corresponding to each X and Y value.

dataset_by_y_then_xlist of lists of DataSets

DataSet corresponding to each X and Y value.

objfn_builderObjectiveFunctionBuilder or {“logl”, “chi2”}, optional

The objective function to use, or one of the given strings to use a defaut log-likelihood or chi^2 function.

x_labelstr, optional

Label for the ‘X’ variable which indexes different models. This string will be the x-label of the resulting box plot.

y_labelstr, optional

Label for the ‘Y’ variable which indexes different models. This string will be the y-label of the resulting box plot.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function (objective), which increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by a model before comparing with the frequencies in dataset. Currently, this functionality is only supported for objective == “logl”.

Creates a box plot showing the overall (aggregate) goodness of fit for one or more model estimates to their respective data sets.

Parameters

xs, yslist

List of X-values and Y-values (converted to strings).

circuits_by_y_then_xlist of lists of PlaquetteGridCircuitStructure objects

Specifies the circuits used at each Y and X value, indexed as circuits_by_y_then_x[iY][iX], where iX and iY are X and Y indices, respectively.

model_by_y_then_xlist of lists of Models

Model corresponding to each X and Y value.

dataset_by_y_then_xlist of lists of DataSets

DataSet corresponding to each X and Y value.

objfn_builderObjectiveFunctionBuilder or {“logl”, “chi2”}, optional

The objective function to use, or one of the given strings to use a defaut log-likelihood or chi^2 function.

x_label, y_labelstr, optional

Labels for the ‘X’ and ‘Y’ variables which index the different gate sets. These strings will be the x- and y-label of the resulting box plot.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

commmpi4py.MPI.Comm, optional

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

wildcardWildcardBudget

A wildcard budget to apply to the objective function (objective), which increases the goodness of fit by adjusting (by an amount measured in TVD) the probabilities produced by a model before comparing with the frequencies in dataset. Currently, this functionality is only supported for objective == “logl”.

class pygsti.report.workspaceplots.DatasetComparisonSummaryPlot(ws, dslabels, dsc_dict, scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

A grid of grayscale boxes comparing data sets pair-wise.

This class creates a plot showing the total 2*deltaLogL values for each pair of DataSet out of some number of total DataSets.

Background: For every pair of data sets, the likelihood is computed for two different models: 1) the model in which a single set of probabilities (one per gate sequence, obtained by the combined outcome frequencies) generates both data sets, and 2) the model in which each data is generated from different sets of probabilities. Twice the ratio of these log-likelihoods can be compared to the value that is expected when model 1) is valid. This plot shows the difference between the expected and actual twice-log-likelihood ratio in units of standard deviations. Zero or negative values indicate the data sets appear to be generated by the same underlying probabilities. Large positive values indicate the data sets appear to be generated by different underlying probabilities.

Parameters

wsWorkspace

The containing (parent) workspace.

dslabelslist

A list of data set labels, specifying the ordering and the number of data sets.

dsc_dictdict

A dictionary of DataComparator objects whose keys are 2-tuples of integers such that the value associated with (i,j) is a DataComparator object that compares the i-th and j-th data sets (as indexed by dslabels.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Creates a plot showing the total 2*deltaLogL values for each pair of DataSets out of some number of total DataSets.

Background: For every pair of data sets, the likelihood is computed for two different models: 1) the model in which a single set of probabilities (one per gate sequence, obtained by the combined outcome frequencies) generates both data sets, and 2) the model in which each data is generated from different sets of probabilities. Twice the ratio of these log-likelihoods can be compared to the value that is expected when model 1) is valid. This plot shows the difference between the expected and actual twice-log-likelihood ratio in units of standard deviations. Zero or negative values indicate the data sets appear to be generated by the same underlying probabilities. Large positive values indicate the data sets appear to be generated by different underlying probabilities.

Parameters

dslabelslist

A list of data set labels, specifying the ordering and the number of data sets.

dsc_dictdict

A dictionary of DataComparator objects whose keys are 2-tuples of integers such that the value associated with (i,j) is a DataComparator object that compares the i-th and j-th data sets (as indexed by dslabels.

class pygsti.report.workspaceplots.DatasetComparisonHistogramPlot(ws, dsc, nbins=50, frequency=True, log=True, display='pvalue', scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

Histogram of p-values comparing two data sets

Parameters

wsWorkspace

The containing (parent) workspace.

dscDataComparator

The data set comparator, which holds and compares the data.

nbinsint, optional

Bins in the histogram.

frequencybool, optional

Whether the frequencies (instead of the counts) are used. TODO: more detail.

logbool, optional

Whether to set a log-scale on the x-axis or not.

display{‘pvalue’, ‘llr’}, optional

What quantity to display (in histogram).

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Create a new WorkspaceTable. Usually not called directly.

Parameters

wsWorkspace

The workspace containing the new object.

fnfunction

A table-creating function.

argsvarious

The arguments to fn.

class pygsti.report.workspaceplots.WildcardSingleScaleBarPlot(ws, budget, scale=1.0, reference_name='Reference Value')

Bases: pygsti.report.workspace.WorkspacePlot

Stacked bar plot showing per-gate reference values and wildcard budgets.

Typically these reference values are a gate metric comparable to wildcard budget such as diamond distance, and the bars show the relative modeled vs. unmodeled error.

Parameters

wsWorkspace

The containing (parent) workspace.

budgetPrimitiveOpsSingleScaleWildcardBudget

Wildcard budget to be plotted.

Create a new WorkspaceTable. Usually not called directly.

Parameters

wsWorkspace

The workspace containing the new object.

fnfunction

A table-creating function.

argsvarious

The arguments to fn.

class pygsti.report.workspaceplots.RandomizedBenchmarkingPlot(ws, rb_r, fitkey=None, decay=True, success_probabilities=True, ylim=None, xlim=None, showpts=True, legend=True, title=None, scale=1.0)

Bases: pygsti.report.workspace.WorkspacePlot

Plot of RB Decay curve

Parameters

wsWorkspace

The containing (parent) workspace.

rb_rRandomizedBenchmarkingResults

The RB results object containing all the relevant RB data.

fitkeydict key, optional

The key of the self.fits dictionary to plot the fit for. If None, will look for a ‘full’ key (the key for a full fit to A + Bp^m if the standard analysis functions are used) and plot this if possible. It otherwise checks that there is only one key in the dict and defaults to this. If there are multiple keys and none of them are ‘full’, fitkey must be specified when decay is True.

decaybool, optional

Whether to plot a fit, or just the data.

success_probabilitiesbool, optional

Whether to plot the success probabilities distribution, as a “box & whisker” plot.

ylimtuple, optional

The y limits for the figure.

xlimtuple, optional

The x limits for the figure.

showptsbool, optional

When success_probabilities == True, whether individual points should be shown along with a “box & whisker”.

legendbool, optional

Whether to show a legend.

titlestr, optional

A title to put on the figure.

scalefloat, optional

Scaling factor to adjust the size of the final figure.

Plot RB decay curve, as a function of sequence length. Optionally includes a fitted exponential decay.

Parameters

rb_rRandomizedBenchmarkingResults

The RB results object containing all the relevant RB data.

fitkeydict key, optional

The key of the self.fits dictionary to plot the fit for. If None, will look for a ‘full’ key (the key for a full fit to A + Bp^m if the standard analysis functions are used) and plot this if possible. It otherwise checks that there is only one key in the dict and defaults to this. If there are multiple keys and none of them are ‘full’, fitkey must be specified when decay is True.

decaybool, optional

Whether to plot a fit, or just the data.

success_probabilitiesbool, optional

Whether to plot the success probabilities distribution, as a “box & whisker” plot.

ylim, xlimtuple, optional

The x and y limits for the figure.

showptsbool, optional

When success_probabilities == True, whether individual points should be shown along with a “box & whisker”.

legendbool, optional

Whether to show a legend.

titlestr, optional

A title to put on the figure.

Returns

None