pygsti.report.whack_a_chi2_mole_boxplot

pygsti.report.whack_a_chi2_mole_boxplot(gatestringToWhack, allGatestringsUsedInChi2Opt, xvals, yvals, xy_gatestring_dict, dataset, gateset, strs, xlabel='', ylabel='', m=None, M=None, scale=1.0, prec='compact', title='Whack a Chi^2 Mole', sumUp=False, boxLabels=True, histogram=False, histBins=50, minProbClipForWeighting=0.0001, save_to=None, ticSize=20, whackWith=10.0, invert=False, fidPairs=None)
Create a box plot indicating how the chi^2 would change if the chi^2 of one
base gate string blocks were forced to be smaller (“whacked”).
Creates a color box plot which displays the change in chi^2 caused by
changing the gate set parameters such that the chi^2 of gatestringToWhack’s (x,y) block decreases by whackWith. This changes the gate set along the direction of parameter space given by the gradient of chi^2 restricted to only those gatestrings in gatestringToWhack’s block, and the the displayed difference in chi^2 values are based on the linear interpolation of the full gradient of chi^2 after this change.
Parameters:
  • gatestringToWhack (GateString or tuple) – The base gate sequence for which chi^2 will be decreased.
  • allGatestringsUsedInChi2Opt (list of GateStrings or tuples) – List of all the gate strings used to form the total chi^2 that is being decreased.
  • yvals (xvals,) – List of x and y values. Elements can be any hashable quantity, and will be converted into x and y tic labels. Tuples of strings are converted specially for nice latex rendering of gate strings.
  • xy_gatestring_dict (dict) – Dictionary with keys == (x_value,y_value) tuples and values == gate strings, where a gate string can either be a GateString object or a tuple of gate labels. Provides the mapping between x,y pairs and gate strings. None values are allowed, and indicate that there is not data for that x,y pair and nothing should be plotted.
  • dataset (DataSet) – The data used to specify frequencies and counts
  • gateset (GateSet) – The gate set used for computing probabilities
  • strs (2-tuple) – A (prepStrs,effectStrs) tuple usually generated by calling get_spam_strs(...)
  • ylabel (xlabel,) – X and Y axis labels
  • M (m,) – Min and max values of the color scale.
  • scale (float, optional) – Scaling factor to adjust the size of the final figure.
  • prec (int, 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
  • title (string, optional) – Plot title (latex can be used)
  • sumUp (bool, 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.
  • boxLabels (bool, optional) – Whether box labels are displayed. It takes much longer to generate the figure when this is set to True.
  • histogram (bool, optional) – Whether a histogram of the matrix element values or summed matrix values (depending on sumUp) should also be computed and displayed.
  • histBins (int, optional) – The number of bins to use in the histogram.
  • minProbClipForWeighting (float, optional) – defines the clipping interval for the statistical weight used within the chi^2 function (see chi2fn).
  • save_to (str, optional) – save figure to this filename (usually ending in .pdf)
  • ticSize (int, optional) – size of tic marks
  • whackWith (float, optional) – the total amount to decrease chi^2 by. This number just sets the overall scale of the numbers displayed, since the extrapolation is linear.
  • invert (bool, optional) – If True, invert the nesting order of the nested color box plot (applicable only when sumUp == False). Use inner_x_labels and inner_y_labels to label the x and y axes.
Returns:

rptFig – The encapsulated matplotlib figure that was generated. Extra figure info is a dict with keys:

nUsedXs : int

The number of used X-values, proportional to the overall final figure width

nUsedYs : int

The number of used Y-values, proportional to the overall final figure height

Return type:

ReportFigure