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.
#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 pygsti.construction 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 = pygsti.construction.list_lgst_gatestrings(
prep_fiducials, meas_fiducials,gs_target)
ds = pygsti.construction.generate_fake_data(gs_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!
#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)
pygsti.report.create_standard_report(results, 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) = 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 *** targetSpamBriefTable took 1.235729 seconds targetGatesBoxTable took 0.369447 seconds datasetOverviewTable took 0.009562 seconds bestGatesetSpamParametersTable took 0.000647 seconds bestGatesetSpamBriefTable took 0.478263 seconds bestGatesetSpamVsTargetTable took 0.28063 seconds bestGatesetGaugeOptParamsTable took 0.000576 seconds bestGatesetGatesBoxTable took 0.968307 seconds bestGatesetChoiEvalTable took 0.956952 seconds bestGatesetDecompTable took 0.477914 seconds bestGatesetEvalTable took 0.006816 seconds bestGermsEvalTable took 0.008426 seconds bestGatesetVsTargetTable took 0.411192 seconds
/Users/enielse/research/pyGSTi/packages/pygsti/extras/rb/theory.py:200: UserWarning: Output may be unreliable because the gateset is not approximately trace-preserving.
bestGatesVsTargetTable_gv took 0.545724 seconds bestGatesVsTargetTable_gvgerms took 0.037678 seconds bestGatesVsTargetTable_gi took 0.021132 seconds bestGatesVsTargetTable_gigerms took 0.005475 seconds bestGatesVsTargetTable_sum took 0.521537 seconds bestGatesetErrGenBoxTable took 2.61593 seconds metadataTable took 0.001756 seconds stdoutBlock took 0.000628 seconds profilerTable took 0.000634 seconds softwareEnvTable took 0.083706 seconds exampleTable took 0.191933 seconds singleMetricTable_gv took 0.921384 seconds singleMetricTable_gi took 0.0491 seconds fiducialListTable took 0.001246 seconds prepStrListTable took 0.000301 seconds effectStrListTable took 0.000274 seconds colorBoxPlotKeyPlot took 0.173564 seconds germList2ColTable took 0.000331 seconds progressTable took 0.098303 seconds *** Generating plots *** gramBarPlot took 0.204354 seconds progressBarPlot took 0.172358 seconds progressBarPlot_sum took 0.000888 seconds finalFitComparePlot took 0.124989 seconds bestEstimateColorBoxPlot took 0.891272 seconds bestEstimateTVDColorBoxPlot took 0.685392 seconds bestEstimateColorScatterPlot took 0.795307 seconds bestEstimateColorHistogram took 1.353478 seconds progressTable_scl took 0.000137 seconds progressBarPlot_scl took 0.000111 seconds bestEstimateColorBoxPlot_scl took 0.000151 seconds bestEstimateColorScatterPlot_scl took 0.000127 seconds bestEstimateColorHistogram_scl took 0.000129 seconds dataScalingColorBoxPlot took 0.000156 seconds *** Merging into template file *** Rendering topSwitchboard took 0.000182 seconds Rendering maxLSwitchboard1 took 0.000233 seconds Rendering targetSpamBriefTable took 0.015131 seconds Rendering targetGatesBoxTable took 0.014844 seconds Rendering datasetOverviewTable took 0.001006 seconds Rendering bestGatesetSpamParametersTable took 0.003498 seconds Rendering bestGatesetSpamBriefTable took 0.026899 seconds Rendering bestGatesetSpamVsTargetTable took 0.003483 seconds Rendering bestGatesetGaugeOptParamsTable took 0.001728 seconds Rendering bestGatesetGatesBoxTable took 0.020163 seconds Rendering bestGatesetChoiEvalTable took 0.021533 seconds Rendering bestGatesetDecompTable took 0.029696 seconds Rendering bestGatesetEvalTable took 0.039353 seconds Rendering bestGermsEvalTable took 0.027064 seconds Rendering bestGatesetVsTargetTable took 0.001184 seconds Rendering bestGatesVsTargetTable_gv took 0.007884 seconds Rendering bestGatesVsTargetTable_gvgerms took 0.005033 seconds Rendering bestGatesVsTargetTable_gi took 0.005641 seconds Rendering bestGatesVsTargetTable_gigerms took 0.00431 seconds Rendering bestGatesVsTargetTable_sum took 0.006771 seconds Rendering bestGatesetErrGenBoxTable took 0.036544 seconds Rendering metadataTable took 0.007158 seconds Rendering stdoutBlock took 0.000737 seconds Rendering profilerTable took 0.001603 seconds Rendering softwareEnvTable took 0.006575 seconds Rendering exampleTable took 0.006762 seconds Rendering metricSwitchboard_gv took 6.5e-05 seconds Rendering metricSwitchboard_gi took 6.2e-05 seconds Rendering singleMetricTable_gv took 0.018323 seconds Rendering singleMetricTable_gi took 0.008598 seconds Rendering fiducialListTable took 0.004732 seconds Rendering prepStrListTable took 0.002909 seconds Rendering effectStrListTable took 0.00277 seconds Rendering colorBoxPlotKeyPlot took 0.003855 seconds Rendering germList2ColTable took 0.003515 seconds Rendering progressTable took 0.002347 seconds Rendering gramBarPlot took 0.003344 seconds Rendering progressBarPlot took 0.002157 seconds Rendering progressBarPlot_sum took 0.002193 seconds Rendering finalFitComparePlot took 0.003555 seconds Rendering bestEstimateColorBoxPlot took 0.00608 seconds Rendering bestEstimateTVDColorBoxPlot took 0.009856 seconds Rendering bestEstimateColorScatterPlot took 0.005814 seconds Rendering bestEstimateColorHistogram took 0.005763 seconds Rendering progressTable_scl took 0.000789 seconds Rendering progressBarPlot_scl took 0.000805 seconds Rendering bestEstimateColorBoxPlot_scl took 0.000696 seconds Rendering bestEstimateColorScatterPlot_scl took 0.001393 seconds Rendering bestEstimateColorHistogram_scl took 0.001289 seconds Rendering dataScalingColorBoxPlot took 0.001362 seconds Output written to example_files/LGSTonlyReport directory *** Report Generation Complete! Total time 15.5439s ***
<pygsti.report.workspace.Workspace at 0x11030c1d0>
Click to open the file example_files/LGSTonlyReport/main.html in your browser to view the report.