How to create an LGST-only report

This example shows how you can create a HTML report from just the results of running linear GST (LGST). This can be useful when you want to get a rough estimate of your gates quickly, as LGST is takes substantially less data and computation time compared with long-sequence GST. This example is modeled after Tutorial 0.

In [1]:
#Make print statements compatible with Python 2 and 3
from __future__ import print_function

#Import the pygsti module (always do this) and the standard XYI gate set
import pygsti
from import std1Q_XYI

# 1) get the target GateSet
gs_target = std1Q_XYI.gs_target

# 2) get the building blocks needed to specify which gate sequences are needed
prep_fiducials, meas_fiducials = std1Q_XYI.prepStrs, std1Q_XYI.effectStrs

# 3) generate "fake" data from a depolarized version of gs_target
gs_datagen = gs_target.depolarize(gate_noise=0.1, spam_noise=0.001)
listOfExperiments =
                        prep_fiducials, meas_fiducials,gs_target)

ds =, listOfExperiments, nSamples=1000,
                                            sampleError="binomial", seed=1234)

#Note: from listOfExperiments we can also create an empty dataset file
# which has columns of zeros where actual data should go."example_files/LGSTReportDataTemplate.txt", listOfExperiments,
                              "## Columns = 0 count, 1 count")
# After replacing the zeros with actual data, the data set can be 
# loaded back into pyGSTi using the line below and used in the rest
# of this tutorial. 
#ds ="example_files/LGSTReportDataTemplate.txt")

print("Only %d sequences are required!" % len(listOfExperiments))
Only 92 sequences are required!
In [2]:
#Run LGST and create a report
# You can also eliminate gauge optimization step by setting gaugeOptParams=False
results = pygsti.do_linear_gst(ds, gs_target, prep_fiducials, meas_fiducials), filename="example_files/LGSTonlyReport",
                                    title="LGST-only Example Report", verbosity=2)
--- Gate Sequence Creation ---
   92 sequences created
   Dataset has 92 entries: 92 utilized, 0 requested sequences were missing
--- LGST ---
  Singular values of I_tilde (truncating to first 4 of 6) = 
  Singular values of target I_tilde (truncating to first 4 of 6) = 
  -- Adding Gauge Optimized (go0) --
*** Creating workspace ***
*** Generating switchboard ***
Found standard clifford compilation from std1Q_XYI
*** Generating tables ***
  targetSpamBriefTable                          took 1.16906 seconds
  targetGatesBoxTable                           took 0.378116 seconds
  datasetOverviewTable                          took 0.009703 seconds
  bestGatesetSpamParametersTable                took 0.001446 seconds
  bestGatesetSpamBriefTable                     took 0.391437 seconds
  bestGatesetSpamVsTargetTable                  took 0.298641 seconds
  bestGatesetGaugeOptParamsTable                took 0.00076 seconds
  bestGatesetGatesBoxTable                      took 0.651035 seconds
  bestGatesetChoiEvalTable                      took 0.637294 seconds
  bestGatesetDecompTable                        took 0.475811 seconds
  bestGatesetEvalTable                          took 0.005724 seconds
  bestGermsEvalTable                            took 0.006934 seconds
  bestGatesetVsTargetTable                      took 0.330447 seconds
/Volumes/Research/enielse_research/pyGSTi/packages/pygsti/extras/rb/ UserWarning:

Output may be unreliable because the gateset is not approximately trace-preserving.

  bestGatesVsTargetTable_gv                     took 1.139149 seconds
  bestGatesVsTargetTable_gvgerms                took 0.038396 seconds
  bestGatesVsTargetTable_gi                     took 0.021412 seconds
  bestGatesVsTargetTable_gigerms                took 0.005911 seconds
  bestGatesVsTargetTable_sum                    took 0.865002 seconds
  bestGatesetErrGenBoxTable                     took 1.31918 seconds
  metadataTable                                 took 0.002657 seconds
  stdoutBlock                                   took 0.000723 seconds
  profilerTable                                 took 0.000535 seconds
  softwareEnvTable                              took 0.075571 seconds
  exampleTable                                  took 0.161638 seconds
  singleMetricTable_gv                          took 1.121862 seconds
  singleMetricTable_gi                          took 0.02478 seconds
  fiducialListTable                             took 0.001239 seconds
  prepStrListTable                              took 0.000663 seconds
  effectStrListTable                            took 0.000368 seconds
  colorBoxPlotKeyPlot                           took 0.151012 seconds
  germList2ColTable                             took 0.000362 seconds
  progressTable                                 took 0.087719 seconds
*** Generating plots ***
  gramBarPlot                                   took 0.15781 seconds
  progressBarPlot                               took 0.144284 seconds
  progressBarPlot_sum                           took 0.000357 seconds
  finalFitComparePlot                           took 0.138099 seconds
  bestEstimateColorBoxPlot                      took 0.465903 seconds
  bestEstimateTVDColorBoxPlot                   took 0.356895 seconds
  bestEstimateColorScatterPlot                  took 0.546223 seconds
  bestEstimateColorHistogram                    took 0.978086 seconds
  progressTable_scl                             took 0.000152 seconds
  progressBarPlot_scl                           took 0.000132 seconds
  bestEstimateColorBoxPlot_scl                  took 0.000175 seconds
  bestEstimateColorScatterPlot_scl              took 0.000206 seconds
  bestEstimateColorHistogram_scl                took 0.000174 seconds
  dataScalingColorBoxPlot                       took 0.000165 seconds
*** Merging into template file ***
  Rendering topSwitchboard                      took 0.000218 seconds
  Rendering maxLSwitchboard1                    took 0.000184 seconds
  Rendering targetSpamBriefTable                took 0.025499 seconds
  Rendering targetGatesBoxTable                 took 0.016187 seconds
  Rendering datasetOverviewTable                took 0.001928 seconds
  Rendering bestGatesetSpamParametersTable      took 0.003243 seconds
  Rendering bestGatesetSpamBriefTable           took 0.035978 seconds
  Rendering bestGatesetSpamVsTargetTable        took 0.004375 seconds
  Rendering bestGatesetGaugeOptParamsTable      took 0.002171 seconds
  Rendering bestGatesetGatesBoxTable            took 0.031922 seconds
  Rendering bestGatesetChoiEvalTable            took 0.025492 seconds
  Rendering bestGatesetDecompTable              took 0.026406 seconds
  Rendering bestGatesetEvalTable                took 0.035808 seconds
  Rendering bestGermsEvalTable                  took 0.034988 seconds
  Rendering bestGatesetVsTargetTable            took 0.002644 seconds
  Rendering bestGatesVsTargetTable_gv           took 0.009397 seconds
  Rendering bestGatesVsTargetTable_gvgerms      took 0.006992 seconds
  Rendering bestGatesVsTargetTable_gi           took 0.007429 seconds
  Rendering bestGatesVsTargetTable_gigerms      took 0.004088 seconds
  Rendering bestGatesVsTargetTable_sum          took 0.00798 seconds
  Rendering bestGatesetErrGenBoxTable           took 0.058684 seconds
  Rendering metadataTable                       took 0.009093 seconds
  Rendering stdoutBlock                         took 0.001951 seconds
  Rendering profilerTable                       took 0.002488 seconds
  Rendering softwareEnvTable                    took 0.007481 seconds
  Rendering exampleTable                        took 0.006364 seconds
  Rendering metricSwitchboard_gv                took 7.9e-05 seconds
  Rendering metricSwitchboard_gi                took 7.8e-05 seconds
  Rendering singleMetricTable_gv                took 0.017789 seconds
  Rendering singleMetricTable_gi                took 0.012233 seconds
  Rendering fiducialListTable                   took 0.006326 seconds
  Rendering prepStrListTable                    took 0.004404 seconds
  Rendering effectStrListTable                  took 0.004182 seconds
  Rendering colorBoxPlotKeyPlot                 took 0.007115 seconds
  Rendering germList2ColTable                   took 0.004818 seconds
  Rendering progressTable                       took 0.003876 seconds
  Rendering gramBarPlot                         took 0.00626 seconds
  Rendering progressBarPlot                     took 0.005394 seconds
  Rendering progressBarPlot_sum                 took 0.003729 seconds
  Rendering finalFitComparePlot                 took 0.004651 seconds
  Rendering bestEstimateColorBoxPlot            took 0.009858 seconds
  Rendering bestEstimateTVDColorBoxPlot         took 0.010796 seconds
  Rendering bestEstimateColorScatterPlot        took 0.008902 seconds
  Rendering bestEstimateColorHistogram          took 0.010397 seconds
  Rendering progressTable_scl                   took 0.001036 seconds
  Rendering progressBarPlot_scl                 took 0.001325 seconds
  Rendering bestEstimateColorBoxPlot_scl        took 0.000995 seconds
  Rendering bestEstimateColorScatterPlot_scl    took 0.001867 seconds
  Rendering bestEstimateColorHistogram_scl      took 0.001584 seconds
  Rendering dataScalingColorBoxPlot             took 0.002184 seconds
Output written to example_files/LGSTonlyReport directory
*** Report Generation Complete!  Total time 12.9927s ***
< at 0x10c57f9b0>

Click to open the file example_files/LGSTonlyReport/main.html in your browser to view the report.

In [ ]: