#!/usr/bin/env python # coding: utf-8 # # 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)) # 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) # Click to open the file [example_files/LGSTonlyReport/main.html](example_files/LGSTonlyReport/main.html) in your browser to view the report. # In[ ]: