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 model
import pygsti
from pygsti.construction import std1Q_XYI

# 1) get the target Model
target_model = std1Q_XYI.target_model()

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

# 3) generate "fake" data from a depolarized version of target_model
mdl_datagen = target_model.depolarize(op_noise=0.1, spam_noise=0.001)
listOfExperiments = pygsti.construction.list_lgst_circuits(
                        prep_fiducials, meas_fiducials,target_model)

ds = pygsti.construction.generate_fake_data(mdl_datagen, 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. 
pygsti.io.write_empty_dataset("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 = pygsti.io.load_dataset("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, target_model, prep_fiducials, meas_fiducials)

pygsti.report.create_standard_report(results, filename="example_files/LGSTonlyReport",
                                    title="LGST-only Example Report", verbosity=2)
--- Circuit 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) = 
  4.244089943192679
  1.1594632778409208
  0.9651516670737965
  0.9297628363691268
  0.049256811347238104
  0.025150658372136828
  
  Singular values of target I_tilde (truncating to first 4 of 6) = 
  4.242640687119286
  1.414213562373096
  1.4142135623730956
  1.4142135623730954
  2.5038933168948026e-16
  2.023452063009528e-16
  
  -- Adding Gauge Optimized (go0) --
*** Creating workspace ***
*** Generating switchboard ***
Found standard clifford compilation from std1Q_XYI
*** Generating tables ***
/Users/enielse/research/pyGSTi/packages/pygsti/report/factory.py:785: UserWarning:

Idle tomography failed:
Label{layers}

  targetSpamBriefTable                          took 0.439511 seconds
  targetGatesBoxTable                           took 0.105407 seconds
  datasetOverviewTable                          took 0.002656 seconds
  bestGatesetSpamParametersTable                took 0.000306 seconds
  bestGatesetSpamBriefTable                     took 0.11465 seconds
  bestGatesetSpamVsTargetTable                  took 0.054331 seconds
  bestGatesetGaugeOptParamsTable                took 0.000295 seconds
  bestGatesetGatesBoxTable                      took 0.16459 seconds
  bestGatesetChoiEvalTable                      took 0.25505 seconds
  bestGatesetDecompTable                        took 0.121263 seconds
  bestGatesetEvalTable                          took 0.002692 seconds
  bestGermsEvalTable                            took 0.00223 seconds
  bestGatesetVsTargetTable                      took 0.026768 seconds
  bestGatesVsTargetTable_gv                     took 0.154202 seconds
  bestGatesVsTargetTable_gvgerms                took 0.019521 seconds
  bestGatesVsTargetTable_gi                     took 0.006878 seconds
/Users/enielse/research/pyGSTi/packages/pygsti/extras/rb/theory.py:200: UserWarning:

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

  bestGatesVsTargetTable_gigerms                took 0.002548 seconds
  bestGatesVsTargetTable_sum                    took 0.150735 seconds
  bestGatesetErrGenBoxTable                     took 0.49217 seconds
  metadataTable                                 took 0.000681 seconds
  stdoutBlock                                   took 0.000232 seconds
  profilerTable                                 took 0.00023 seconds
  softwareEnvTable                              took 0.025497 seconds
  exampleTable                                  took 0.136048 seconds
  singleMetricTable_gv                          took 0.148717 seconds
  singleMetricTable_gi                          took 0.008322 seconds
  fiducialListTable                             took 0.000492 seconds
  prepStrListTable                              took 0.000114 seconds
  effectStrListTable                            took 0.000117 seconds
  colorBoxPlotKeyPlot                           took 0.039629 seconds
  germList2ColTable                             took 0.000154 seconds
  progressTable                                 took 0.043507 seconds
*** Generating plots ***
  gramBarPlot                                   took 0.062528 seconds
  progressBarPlot                               took 0.031082 seconds
  progressBarPlot_sum                           took 0.00023 seconds
  finalFitComparePlot                           took 0.031786 seconds
  bestEstimateColorBoxPlot                      took 0.251136 seconds
  bestEstimateTVDColorBoxPlot                   took 0.237004 seconds
  bestEstimateColorScatterPlot                  took 0.312536 seconds
  bestEstimateColorHistogram                    took 0.395233 seconds
  progressTable_scl                             took 7.4e-05 seconds
  progressBarPlot_scl                           took 6.1e-05 seconds
  bestEstimateColorBoxPlot_scl                  took 6.2e-05 seconds
  bestEstimateColorScatterPlot_scl              took 7.1e-05 seconds
  bestEstimateColorHistogram_scl                took 5.5e-05 seconds
  dataScalingColorBoxPlot                       took 5e-05 seconds
*** Merging into template file ***
  Rendering topSwitchboard                      took 0.000175 seconds
  Rendering maxLSwitchboard1                    took 8.8e-05 seconds
  Rendering targetSpamBriefTable                took 0.143707 seconds
  Rendering targetGatesBoxTable                 took 0.053667 seconds
  Rendering datasetOverviewTable                took 0.001131 seconds
  Rendering bestGatesetSpamParametersTable      took 0.001393 seconds
  Rendering bestGatesetSpamBriefTable           took 0.120301 seconds
  Rendering bestGatesetSpamVsTargetTable        took 0.00193 seconds
  Rendering bestGatesetGaugeOptParamsTable      took 0.001109 seconds
  Rendering bestGatesetGatesBoxTable            took 0.106561 seconds
  Rendering bestGatesetChoiEvalTable            took 0.104323 seconds
  Rendering bestGatesetDecompTable              took 0.065894 seconds
  Rendering bestGatesetEvalTable                took 0.012923 seconds
  Rendering bestGermsEvalTable                  took 0.012595 seconds
  Rendering bestGatesetVsTargetTable            took 0.001274 seconds
  Rendering bestGatesVsTargetTable_gv           took 0.002533 seconds
  Rendering bestGatesVsTargetTable_gvgerms      took 0.001634 seconds
  Rendering bestGatesVsTargetTable_gi           took 0.002631 seconds
  Rendering bestGatesVsTargetTable_gigerms      took 0.001513 seconds
  Rendering bestGatesVsTargetTable_sum          took 0.002331 seconds
  Rendering bestGatesetErrGenBoxTable           took 0.234166 seconds
  Rendering metadataTable                       took 0.002701 seconds
  Rendering stdoutBlock                         took 0.001029 seconds
  Rendering profilerTable                       took 0.001149 seconds
  Rendering softwareEnvTable                    took 0.002281 seconds
  Rendering exampleTable                        took 0.023044 seconds
  Rendering metricSwitchboard_gv                took 4.2e-05 seconds
  Rendering metricSwitchboard_gi                took 3.2e-05 seconds
  Rendering singleMetricTable_gv                took 0.00629 seconds
  Rendering singleMetricTable_gi                took 0.004054 seconds
  Rendering fiducialListTable                   took 0.002669 seconds
  Rendering prepStrListTable                    took 0.001891 seconds
  Rendering effectStrListTable                  took 0.001914 seconds
  Rendering colorBoxPlotKeyPlot                 took 0.026063 seconds
  Rendering germList2ColTable                   took 0.002152 seconds
  Rendering progressTable                       took 0.001472 seconds
  Rendering gramBarPlot                         took 0.026079 seconds
  Rendering progressBarPlot                     took 0.019741 seconds
  Rendering progressBarPlot_sum                 took 0.02079 seconds
  Rendering finalFitComparePlot                 took 0.018475 seconds
  Rendering bestEstimateColorBoxPlot            took 0.018792 seconds
  Rendering bestEstimateTVDColorBoxPlot         took 0.020015 seconds
  Rendering bestEstimateColorScatterPlot        took 0.021861 seconds
  Rendering bestEstimateColorHistogram          took 0.025072 seconds
  Rendering progressTable_scl                   took 0.000975 seconds
  Rendering progressBarPlot_scl                 took 0.000883 seconds
  Rendering bestEstimateColorBoxPlot_scl        took 0.000881 seconds
  Rendering bestEstimateColorScatterPlot_scl    took 0.000816 seconds
  Rendering bestEstimateColorHistogram_scl      took 0.000689 seconds
  Rendering dataScalingColorBoxPlot             took 0.000534 seconds
Output written to example_files/LGSTonlyReport directory
*** Report Generation Complete!  Total time 5.17539s ***
Out[2]:
<pygsti.report.workspace.Workspace at 0x109141c50>

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

In [ ]: