An example of how to run GST on a 2-qubit system

This tutorial gives an overview of the typical steps used to perform an end-to-end (i.e. experimental-data-to-report) Gate Set Tomography analysis on a 2-qubit system. The steps are very similar to the single-qubit case; the main differences are:

  • the use of more general syntax when constructing 2-qubit gate sets
  • the increased number of fiducial and germ gate sequences
  • the increased run time required to compute GST estimates
  • a different report style
In [1]:
import pygsti

Step 1: Construct the desired 2-qubit gateset

There are several ways to do this, as outlined by the comments in the cell below.

In [2]:
# via build_gateset:
#   [4] = a 4-dimensional Hilbert (state) space
#   [('Q0','Q1')] = interpret this 4-d space as that of two qubits 'Q0', and 'Q1' (note these labels *must* begin with 'Q'!)
#   "Gix" = gate label; can be anything that begins with 'G' and is followed by lowercase letters
#   "X(pi/2,Q1)" = pi/2 single-qubit x-rotation gate on the qubit labeled Q1
#   "CX(pi,Q0,Q1)" = controlled pi x-rotation using qubits Q0 (control) and Q1 (target) 
#   "rho0" = prep label; can be anything that begins with "rho"
#   "E1" = effect label; can be anything that begins with "E"
#   "2" = a prep or effect expression indicating a projection/preparation of the 3rd (b/c 0-based) computational basis element
#   'dnup': ('rho0','E2') = designate the SPAM label "dnup" to mean preparation using "rho0" (a prep label) and measuring the outcome "E2" (an effect label)
#   "pp" = create all of these gate & SPAM operators in the Pauli-product basis.
gs_target = pygsti.construction.build_gateset( 
            [4], [('Q0','Q1')],['Gix','Giy','Gxi','Gyi','Gcnot'], 
            [ "X(pi/2,Q1)", "Y(pi/2,Q1)", "X(pi/2,Q0)", "Y(pi/2,Q0)", "CX(pi,Q0,Q1)" ],
            prepLabels=['rho0'], prepExpressions=["0"],
            effectLabels=['E0','E1','E2'], effectExpressions=["0","1","2"], 
            spamdefs={'upup': ('rho0','E0'), 'updn': ('rho0','E1'),
                      'dnup': ('rho0','E2'), 'dndn': ('rho0','remainder') }, basis="pp")

# Note that you can also explicity add identity operations, e.g. "I(Q0)" to get the same gate set,
#  and that this same syntax could be used for non-entangling 2-qubit gates, e.g. "X(pi/2,Q0):X(pi/2,Q1)".
gs_targetB = pygsti.construction.build_gateset( 
            [4], [('Q0','Q1')],['Gix','Giy','Gxi','Gyi','Gcnot'], 
            [ "I(Q0):X(pi/2,Q1)", "I(Q0):Y(pi/2,Q1)", "X(pi/2,Q0):I(Q1)", "Y(pi/2,Q0):I(Q1)", "CX(pi,Q0,Q1)" ],
            prepLabels=['rho0'], prepExpressions=["0"], 
            effectLabels=['E0','E1','E2'], effectExpressions=["0","1","2"], 
            spamdefs={'upup': ('rho0','E0'), 'updn': ('rho0','E1'),
                      'dnup': ('rho0','E2'), 'dndn': ('rho0','remainder') }, basis="pp")

# If you're lucky and your gateset is one of pyGSTi's "standard" gate sets, you can just import it.
from pygsti.construction import std2Q_XYCNOT
gs_targetC = std2Q_XYCNOT.gs_target

#check that these are all the same
assert(abs(gs_target.frobeniusdist(gs_targetB)) < 1e-6)
assert(abs(gs_target.frobeniusdist(gs_targetC)) < 1e-6)

Step 2: Obtain lists of fiducial and germ gate sequences

These are the building blocks of the gate sequences performed in the experiment. Typically, these lists are either given to you by the folks at Sandia National Labs (email pygsti@sandia.gov), provided by pyGSTi because you're using a "standard" gate set, or computed using "fiducial selection" and "germ selection" algorithms (which are a part of pyGSTi, but not covered in this tutorial).

In [3]:
#If you know the fiducial strings you can create a list manually.  Note
# that in general there can be different "preparation" and "measurement"
# (or "effect") fiducials.
prep_fiducials = pygsti.construction.gatestring_list( \
[ (), ('Gix',), ('Giy',), ('Gix','Gix'), 
('Gxi',), ('Gxi','Gix'), ('Gxi','Giy'), ('Gxi','Gix','Gix'), 
('Gyi',), ('Gyi','Gix'), ('Gyi','Giy'), ('Gyi','Gix','Gix'), 
('Gxi','Gxi'), ('Gxi','Gxi','Gix'), ('Gxi','Gxi','Giy'), ('Gxi','Gxi','Gix','Gix') ] )

effect_fiducials = pygsti.construction.gatestring_list( \
[ (), ('Gix',), ('Giy',), ('Gxi',), ('Gyi',),
('Gix','Gxi'), ('Gxi','Giy'), ('Gyi','Gix'),
('Gyi','Giy'), ('Gxi','Gxi') ] )

#Or, if you're lucky, you can just import them
prep_fiducialsB = std2Q_XYCNOT.prepStrs
effect_fiducialsB = std2Q_XYCNOT.effectStrs

#check that these are the same
assert(prep_fiducials == prep_fiducialsB)
assert(effect_fiducials == effect_fiducialsB)

#Use fiducial sequences to create a "spam specifiers" object, telling
# GST which preparation and measurement fiducials to follow and precede which
# state preparation and effect operators, respectively.
specs = pygsti.construction.build_spam_specs(
    prepStrs=prep_fiducials,
    effectStrs=effect_fiducials,
    prep_labels=gs_target.get_prep_labels(),
    effect_labels=gs_target.get_effect_labels() )

#Alternatively, if you're lucky, you can grab the specs directly:
specsB = std2Q_XYCNOT.specs
assert(specs[0] == specsB[0])
In [4]:
#germ lists can be specified in the same way.  In this case, there are
# 71 germs required to do honest GST.  Since this would crowd this tutorial
# notebook, we create some smaller lists of germs manually and import the
# full 71-germ list from std2Q_XYCNOT
germs4 = pygsti.construction.gatestring_list(
    [ ('Gix',), ('Giy',), ('Gxi',), ('Gyi',) ] )

germs11 = pygsti.construction.gatestring_list(
    [ ('Gix',), ('Giy',), ('Gxi',), ('Gyi',), ('Gcnot',), ('Gxi','Gyi'), ('Gix','Giy'),
      ('Gix','Gcnot'), ('Gxi','Gcnot'), ('Giy','Gcnot'), ('Gyi','Gcnot') ] )

germs71 = std2Q_XYCNOT.germs

Step 3: Data generation

Now that fiducial and germ strings have been found, we can generate the list of experiments needed to run GST, just like in the 1-qubit case. As an additional input we'll need a list of lengths indicating the maximum length strings to use on each successive GST iteration.

In [5]:
#A list of maximum lengths for each GST iteration
maxLengths = [1,2,4]

#Create a list of GST experiments for this gateset, with
#the specified fiducials, germs, and maximum lengths.  We use
#"germs4" here so that the tutorial runs quickly; really, you'd
#want to use germs71!
listOfExperiments = pygsti.construction.make_lsgst_experiment_list(gs_target.gates.keys(), prep_fiducials,
                                                                   effect_fiducials, germs4, maxLengths)

#Create an empty dataset file, which stores the list of experiments
# and zerod-out columns where data should be inserted.  Note the use of the SPAM
# labels in the "Columns" header line.
pygsti.io.write_empty_dataset("tutorial_files/My2QDataTemplate.txt", listOfExperiments,
                              "## Columns = upup count, updn count, dnup count, dndn count")
In [6]:
#Generate some "fake" (simulated) data based on a depolarized version of the target gateset
gs_datagen = gs_target.depolarize(gate_noise=0.1, spam_noise=0.001)
ds = pygsti.construction.generate_fake_data(gs_datagen, listOfExperiments, nSamples=1000,
                                            sampleError="multinomial", seed=2016)

#if you have a dataset file with real data in it, load it using something like:
#ds = pygsti.io.load_dataset("mydir/My2QDataset.txt")

Step 4: Run GST using do_long_sequence_gst

Just like for 1-qubit GST, we call the driver routine do_long_sequence_gst to compute the GST estimates. Usually for two qubits this could take a long time (hours) based on the number of gate sequences used. However, since we chose an incomplete set of only 4 germs and set our maximum max-length to 4, this will run fairly quickly (~20min).

Some notes about the options/arguments to do_long_sequence_gst that are particularly relevant to 2-qubit GST:

  • mxBasis indicates which basis the target gateset matrices are in -- this should be the same as that used to create the gateset. Here 'pp' denotes the Pauli-product basis.
  • advancedOptions expects a dictionary of with option names as the keys. Relevant options are:
    • memoryLimitInBytes gives an estimate of how much memory is available to use on your system (in bytes). This is currently not a hard limit, and pyGSTi may require 50-100% more memory than this "limit". So you'll need to be conservative in the value you place here: if your machine has 10GB of RAM, set this to 3 or 5 GB initially and increase it as you see how much memory is actually used using a separate OS performance monitor tool.
    • depolarizeLGST gives an amount (in [0,1]) to depolarize the initial LGST estimate that is used as the initial guess for long-sequence GST. In practice, we find that in the larger 2-qubit Hilbert space, the LGST estimate may be so poor as to adversely affect the subsequent long-sequence GST (e.g. very slow convergence). Depolarizing the LGST estimate remedies this. If you're unsure what to put here, either don't specify depolarizeLGST at all (the same as using 0.0), or just use 0.1.
    • verbosity tells the routine how much detail to print to stdout. If you don't mind waiting a while without getting any output, you can leave this at its default value (2). If you can't standing wondering whether GST is still running or has locked up, set this to 3.
In [7]:
import time
start = time.time()
results = pygsti.do_long_sequence_gst(ds, gs_target, prep_fiducials, effect_fiducials, germs4,
                                       maxLengths, gaugeOptRatio=0.1,
                                       advancedOptions={ 'memoryLimitInBytes' : 3*(1024)**3,
                                                         'depolarizeLGST' : 0.1,
                                                         'verbosity' : 3} )
end = time.time()
print "Total time=%f hours" % ((end - start)/3600.0)

#If you wanted to, you could pickle the results for later analysis:
#pickle.dump(results, open("MySavedResults.pkl", "w"))
LGST: Singular values of I_tilde (truncating to first 16 of 16) = 
[ 6.43752847  2.13984198  2.10172622  1.26244223  1.20551035  1.03646394
  0.84525607  0.80289546  0.53731306  0.51858772  0.3602247   0.34371294
  0.32000311  0.21656255  0.20857989  0.17889827]

--- LGST ---

--- Gauge Optimization to TP (L-BFGS-B) ---
    9s           0.0000029910
   10s           0.0000029320
   10s           0.0000029152
   11s           0.0000029119
The resulting TP penalty is: 2.91191e-06
The gauge matrix found (B^-1) is:
[[  1.00002822e+00   8.39858500e-05   1.57419351e-05  -1.19777920e-04
    1.11635776e-04  -1.23539072e-04   1.55511014e-05   1.60194489e-04
    7.10550394e-05  -7.48321849e-05   1.51163644e-05  -7.44678475e-06
   -1.47453707e-04   1.20325507e-04   4.50074480e-05   5.06034200e-05]
 [  9.57099317e-08   9.99999891e-01   3.38597359e-08  -3.33879578e-08
   -1.20002564e-07   8.68053526e-08  -4.87320470e-08   1.06466050e-07
    5.82125274e-08  -1.23279168e-07  -2.30488576e-08  -4.99390795e-08
    6.37590181e-09  -1.70250024e-09   3.85781928e-08  -2.63039550e-08]
 [ -1.15954038e-07   3.40968125e-08   9.99999886e-01   5.60386072e-08
    1.75338235e-07  -6.05421109e-08   1.60770014e-07  -8.32288560e-08
   -5.59783787e-08  -8.46655340e-08  -8.55066818e-08   6.14220469e-08
    4.16334591e-08  -1.33552443e-08   9.25059311e-08  -2.84811484e-08]
 [  5.30762317e-08  -2.55120591e-08   5.86324169e-08   9.99999940e-01
   -8.72020801e-08   5.48248943e-08  -1.24927330e-07   5.84452449e-08
    2.31331476e-08   1.85611424e-08   6.02073500e-08  -3.80871765e-08
   -1.58868120e-08  -7.78051935e-09  -4.21297202e-08  -1.80981295e-08]
 [  2.24974244e-07  -1.23079246e-07   1.74092273e-07  -9.46780679e-08
    9.99999669e-01   1.09788466e-07  -2.61275186e-07   1.92026636e-07
    1.09918741e-07   1.81611291e-08   8.88348708e-08  -1.16547563e-07
   -3.84043140e-08   1.27416517e-08  -9.40887003e-08   1.22757129e-08]
 [ -8.19648861e-08   9.48236286e-08  -5.77669813e-08   5.68033401e-08
    1.16739460e-07   9.99999771e-01   6.44337895e-08  -6.95462728e-08
   -6.68246562e-08   7.99054977e-09  -4.72844780e-08   5.24959284e-08
    4.76577934e-08  -5.47939801e-09   1.57644666e-08  -2.13655663e-08]
 [  1.32496206e-07  -4.97334177e-08   1.60390884e-07  -1.25827206e-07
   -2.61901594e-07   6.37329675e-08   9.99999631e-01   1.43151453e-07
    2.36079566e-08   8.85507695e-08   1.33625048e-07  -8.97300164e-08
   -1.07270235e-08  -3.04798899e-08  -1.30568369e-07  -3.88010163e-08]
 [ -1.42864606e-07   9.56406275e-08  -8.68652824e-08   5.91301055e-08
    1.81324157e-07  -6.59000505e-08   1.41724304e-07   9.99999837e-01
   -6.91441516e-08   8.30384372e-08   9.63017387e-09   6.11775356e-08
    1.87768967e-08  -1.88856015e-08   2.86472269e-09   3.52135731e-08]
 [ -9.95528764e-08   5.43359991e-08  -5.73393951e-08   2.09582838e-08
    1.07067584e-07  -6.81194738e-08   2.34486159e-08  -6.56950158e-08
    9.99999917e-01   1.34094945e-08  -2.20307664e-08   4.34461268e-08
    3.75641527e-08  -2.51169494e-08   1.67742737e-08  -3.71469154e-08]
 [  1.38905119e-08  -1.16711451e-07  -8.25050476e-08   1.59305824e-08
    2.55599206e-08   3.46241804e-09   8.97273295e-08   8.60906518e-08
    1.66230714e-08   9.99999675e-01  -1.64715314e-07  -1.60419603e-10
    7.28000514e-08  -2.06213845e-08   1.83043816e-07  -1.00247390e-07]
 [ -3.73807529e-08  -2.52745098e-08  -8.61908971e-08   6.24644517e-08
    8.58004713e-08  -4.43326792e-08   1.33051622e-07   6.67563243e-09
   -2.37933778e-08  -1.63536446e-07   9.99999839e-01   4.55700538e-08
    4.16986251e-08   7.38695141e-09   1.25015175e-07  -3.95174775e-08]
 [  8.08316678e-08  -4.98558828e-08   6.14134984e-08  -3.83978072e-08
   -1.16385192e-07   5.21376190e-08  -8.96869723e-08   6.17063006e-08
    4.36038630e-08  -4.85188507e-10   4.56713777e-08   9.99999949e-01
   -1.27826919e-08  -2.84311139e-09  -3.19485048e-08  -4.77104388e-10]
 [  3.94569766e-08   1.18595428e-08   4.36894622e-08  -8.45370030e-09
   -3.60706196e-08   5.39199919e-08  -1.10509873e-08   7.91704459e-09
    3.54211127e-08   8.09728531e-08   3.79727527e-08  -1.25042519e-08
    9.99999943e-01   3.28528078e-08  -4.81974882e-08   4.07443257e-08]
 [ -2.62468968e-08  -8.14364539e-09  -1.56203917e-08  -1.09385775e-08
    7.78636889e-09  -7.06368755e-09  -3.08404170e-08  -1.38455559e-08
   -2.53792451e-08  -2.55286383e-08   1.01832175e-08  -3.14778344e-09
    3.67858533e-08   9.99999962e-01   1.10908289e-08  -2.53014329e-08]
 [  4.55023290e-08   3.55660903e-08   9.15062553e-08  -4.17888200e-08
   -9.71116816e-08   1.69285311e-08  -1.30979639e-07   2.63354100e-09
    1.57478414e-08   1.82341209e-07   1.25782532e-07  -3.20897556e-08
   -4.50810030e-08   9.56636383e-09   9.99999870e-01   5.14374636e-08]
 [ -2.34361981e-08  -3.22552208e-08  -3.01549612e-08  -1.13179896e-08
    4.09751604e-09  -1.28762843e-08  -4.03250186e-08   2.60443792e-08
   -4.20858312e-08  -9.62602428e-08  -3.98623492e-08  -6.46475012e-10
    5.10314278e-08  -3.33087848e-08   4.90161255e-08   9.99999925e-01]]

The gauge-corrected gates are:
rho0 =    0.5001        0        0   0.5000        0        0        0        0        0        0        0        0   0.5000        0        0   0.5000


E0 =    0.5810  -0.0380   0.0670   0.4619  -0.0469  -0.0101   0.0010  -0.0659   0.0740  -0.0710   0.1000   0.0650   0.4529  -0.0479   0.0710   0.4980

E1 =    0.5170   0.0460  -0.0610  -0.4531  -0.0659   0.0169   0.0300   0.0701   0.0660   0.0090  -0.0380  -0.0420   0.3559   0.0511  -0.0620  -0.4180

E2 =    0.4915  -0.0255   0.0695   0.3494   0.0476  -0.0496  -0.0565   0.0676  -0.0715   0.0915   0.0125  -0.0895  -0.4426   0.0166  -0.0745  -0.3965


Gix = 
   0.9997   0.0003  -0.0001   0.0002   0.0004  -0.0004   0.0003  -0.0002  -0.0002   0.0001  -0.0002   0.0002        0        0        0        0
  -0.0096   0.9236  -0.0096   0.0096   0.0057   0.0136   0.0057  -0.0057  -0.0019   0.0402  -0.0019   0.0019   0.0073  -0.0118   0.0073  -0.0073
  -0.0847   0.1121  -0.0847  -0.9153  -0.0279   0.0152  -0.0279   0.0279   0.0396  -0.0455   0.0396  -0.0396   0.0156  -0.0296   0.0156  -0.0156
  -0.0905   0.0663   0.9095   0.0905   0.0086   0.0717   0.0086  -0.0086  -0.0088  -0.0141  -0.0088   0.0088  -0.0167   0.0207  -0.0167   0.0167
   0.0073  -0.0376   0.0073  -0.0073   0.8880   0.0633  -0.1120   0.1120   0.0328  -0.0573   0.0328  -0.0328   0.0010  -0.0249   0.0010  -0.0010
  -0.0069  -0.0144  -0.0069   0.0069   0.0349   0.8330   0.0349  -0.0349   0.0045   0.0465   0.0045  -0.0045  -0.0241   0.0221  -0.0241   0.0241
   0.0134  -0.0366   0.0134  -0.0134  -0.1173   0.2052  -0.1174  -0.8826   0.0832  -0.1196   0.0832  -0.0832   0.0252  -0.0304   0.0252  -0.0252
  -0.0339   0.0608  -0.0339   0.0339   0.0309  -0.0237   1.0309  -0.0309   0.0229   0.0485   0.0229  -0.0229  -0.0020   0.0846  -0.0020   0.0020
   0.0031  -0.0023   0.0031  -0.0031   0.0042   0.0215   0.0042  -0.0042   0.9040  -0.0273  -0.0960   0.0960   0.0114  -0.0179   0.0114  -0.0114
  -0.0128   0.0221  -0.0128   0.0128  -0.0776   0.0353  -0.0776   0.0776  -0.0379   0.8649  -0.0379   0.0379  -0.0221   0.0283  -0.0221   0.0221
  -0.0199  -0.0019  -0.0199   0.0199   0.0058   0.1160   0.0058  -0.0058  -0.1566   0.0590  -0.1566  -0.8434   0.0248  -0.0308   0.0248  -0.0248
   0.0152  -0.0539   0.0152  -0.0152  -0.0082   0.0242  -0.0082   0.0082  -0.0518   0.0841   0.9482   0.0518   0.0077  -0.0076   0.0077  -0.0077
  -0.0236  -0.0055  -0.0236   0.0236   0.0011  -0.0043   0.0011  -0.0011  -0.0484   0.0685  -0.0484   0.0484   0.9038  -0.0013  -0.0962   0.0962
   0.0157  -0.0017   0.0157  -0.0157   0.0015  -0.1531   0.0015  -0.0015  -0.0558   0.1375  -0.0558   0.0558   0.0136   0.8740   0.0136  -0.0136
  -0.0317   0.0003  -0.0317   0.0317   0.0497   0.0281   0.0497  -0.0497  -0.0479   0.1197  -0.0479   0.0479  -0.1037   0.1154  -0.1037  -0.8963
   0.0038   0.0325   0.0038  -0.0038   0.0092  -0.0939   0.0092  -0.0092  -0.0087   0.0261  -0.0087   0.0087  -0.0718   0.1017   0.9282   0.0718


Giy = 
   0.9998        0  -0.0002        0   0.0004   0.0002   0.0004  -0.0001        0  -0.0002  -0.0002   0.0001        0        0   0.0002        0
   0.0905  -0.1291   0.0635   0.9095   0.0130   0.0729   0.0366  -0.0130  -0.0198   0.0394  -0.0254   0.0198  -0.0129   0.0141   0.0027   0.0129
   0.0136  -0.0046   0.9403  -0.0136   0.0099  -0.0152  -0.0301  -0.0099   0.0098  -0.0290   0.1028  -0.0098   0.0078   0.0105   0.0433  -0.0078
  -0.0793  -0.9316  -0.1088   0.0793  -0.0276   0.0613  -0.0202   0.0276   0.0101  -0.0190  -0.0384  -0.0101  -0.0117   0.0182   0.0071   0.0117
   0.0182   0.0263   0.0069  -0.0182   0.9106   0.0413   0.0157   0.0894   0.0169   0.0179   0.0266  -0.0169   0.0056  -0.0411   0.0361  -0.0056
   0.0011  -0.0583  -0.0503  -0.0011   0.1213  -0.1151   0.2036   0.8787  -0.0289   0.0800  -0.2570   0.0289  -0.0477   0.0368  -0.0489   0.0477
   0.0472  -0.0097   0.1059  -0.0472  -0.0444  -0.0318   0.7954   0.0444   0.0181   0.1481  -0.0141  -0.0181   0.0143   0.0407  -0.0267  -0.0143
  -0.0384  -0.0092  -0.0423   0.0384  -0.0880  -0.9282  -0.0077   0.0880   0.0298   0.0534  -0.0321  -0.0298  -0.0008   0.0326   0.0004   0.0008
  -0.0328   0.0297   0.0009   0.0328   0.0024  -0.0027  -0.0592  -0.0024   0.8954   0.1361   0.0460   0.1046   0.0189  -0.0261   0.0369  -0.0189
   0.0051  -0.0569   0.0516  -0.0051  -0.0665   0.0376  -0.0971   0.0665   0.1467  -0.2685   0.2310   0.8533  -0.0207  -0.0097  -0.0274   0.0207
  -0.0275   0.0287  -0.0969   0.0276   0.0443  -0.0563   0.0911  -0.0444  -0.0186  -0.0176   0.6869   0.0186   0.0210  -0.0128   0.0300  -0.0210
   0.0032   0.0132   0.0118  -0.0032   0.0218   0.0566  -0.0804  -0.0218  -0.1102  -0.8269  -0.1283   0.1102   0.0123  -0.0366   0.0775  -0.0123
  -0.0061  -0.0163   0.0075   0.0061  -0.0044  -0.0067  -0.0503   0.0044  -0.0083  -0.0396  -0.0119   0.0083   0.8917   0.0910  -0.0126   0.1083
  -0.0073   0.0458  -0.0014   0.0073   0.0121  -0.0827  -0.0405  -0.0121  -0.0439   0.0446  -0.0998   0.0439   0.1244  -0.1036   0.0858   0.8756
  -0.0004  -0.0584  -0.0241   0.0004        0  -0.0396   0.0496        0  -0.0367   0.0247  -0.1258   0.0367  -0.0087  -0.0709   0.8316   0.0087
  -0.0234   0.0363  -0.0054   0.0234  -0.0201  -0.0389   0.0050   0.0201  -0.0422   0.0367  -0.0213   0.0422  -0.0735  -0.9080  -0.1131   0.0735


Gxi = 
   0.9998        0  -0.0002        0   0.0003  -0.0002   0.0004  -0.0002        0  -0.0003        0        0        0        0   0.0002        0
   0.0047   0.8900  -0.0175   0.0079  -0.0191   0.0727  -0.0288  -0.0336   0.0097  -0.1638   0.0527   0.0029  -0.0202   0.0909   0.0141   0.0076
   0.0003   0.0139   0.8864   0.0352   0.0431  -0.0996   0.0687  -0.0543   0.0226   0.0869  -0.1024   0.0129   0.0103   0.0086   0.0400  -0.0458
  -0.0023  -0.0213  -0.0295   0.9072  -0.0030   0.0554   0.0412   0.0099  -0.0124  -0.0012  -0.0026  -0.0827   0.0178   0.0001   0.0290   0.0772
   0.0161  -0.0236   0.0098  -0.0228   0.9069   0.0134   0.0458  -0.0024  -0.0163   0.0184   0.0250   0.0096  -0.0032   0.0479  -0.0139   0.0098
  -0.0407   0.0396  -0.0698   0.0412   0.0752   0.8277   0.0931  -0.0189  -0.0311   0.0459  -0.0645   0.0316  -0.0034  -0.0272   0.0913   0.0029
   0.0099  -0.0485   0.0486   0.0093  -0.0513   0.1281   0.7737  -0.0244  -0.0079   0.0570   0.0384   0.0272  -0.0521  -0.0220  -0.0949   0.0329
  -0.0748   0.0869  -0.0967   0.0410   0.0696  -0.0917   0.1698   0.9294  -0.0241   0.0680  -0.0752  -0.0097   0.0076  -0.0494   0.0490   0.0263
  -0.1161   0.0140  -0.0308   0.0088   0.0508   0.0578  -0.0369  -0.0770  -0.0857  -0.0004  -0.0284  -0.0215  -0.9031   0.0196  -0.0299   0.0103
   0.0391  -0.1246   0.0342   0.0623  -0.0758   0.1302  -0.0379  -0.0784   0.0504  -0.1748  -0.0104   0.0511  -0.0081  -0.7991   0.0160  -0.0934
  -0.0306   0.0558  -0.1444  -0.0077   0.0035  -0.0831   0.1200  -0.0200  -0.0024  -0.0004  -0.0085  -0.0358   0.0356   0.0061  -0.7437   0.0027
  -0.0166   0.0298  -0.0269  -0.0925   0.0375  -0.0138   0.0740   0.0048  -0.0580   0.0067  -0.0712  -0.0511   0.0076  -0.0202   0.0429  -0.8985
  -0.1049  -0.0287   0.0027  -0.0031   0.1204  -0.0214  -0.0186   0.0303   0.8818   0.0300  -0.0314   0.0102   0.1005   0.0238   0.0236   0.0075
  -0.0347  -0.0828  -0.0385  -0.0785   0.0874  -0.0388   0.1013   0.1295  -0.0091   0.9498  -0.0711  -0.1041   0.0486   0.0351   0.0231   0.0647
   0.0238  -0.0534  -0.0747   0.0083  -0.0382   0.0712   0.0883   0.0123  -0.0178  -0.0374   0.9377   0.0499  -0.0317  -0.0769   0.1331  -0.0004
  -0.0116   0.0422  -0.0038  -0.0870  -0.0022  -0.0110   0.0171   0.1202   0.0137  -0.0587  -0.0274   0.8876   0.0048  -0.0475  -0.0290   0.0939


Gyi = 
   0.9999        0        0        0        0  -0.0001  -0.0002   0.0002  -0.0002  -0.0004  -0.0002        0   0.0001        0   0.0002  -0.0003
  -0.0045   0.9592  -0.0417   0.0082   0.0269   0.0345   0.0025   0.0165   0.0024   0.0700  -0.0040   0.0169   0.0383   0.0681   0.0392  -0.0419
   0.0265  -0.0612   0.9153   0.0050  -0.0451  -0.0112   0.0614   0.0653   0.0083  -0.0745   0.0431   0.0132   0.0023  -0.0437   0.0508  -0.0338
  -0.0188   0.0105  -0.0318   0.9196   0.0499  -0.0727   0.0297   0.0633  -0.0199   0.0381  -0.0379   0.0142   0.0157   0.0329   0.0375   0.0835
   0.0944  -0.0096  -0.0065  -0.0078  -0.0830  -0.0987  -0.0049  -0.0337   0.0657  -0.0730  -0.0577  -0.0163   0.9070   0.0125   0.0297   0.0065
  -0.0489   0.1514  -0.0854   0.0255   0.0932  -0.1829   0.1620  -0.0181  -0.0304   0.1502  -0.1137   0.0130   0.0169   0.9211   0.0419   0.0065
  -0.0303   0.0277   0.1267   0.0120   0.0041  -0.0537  -0.0564  -0.0089   0.0113   0.0562   0.1981  -0.0314   0.0277   0.0169   0.8783  -0.0094
  -0.0649   0.0518  -0.0567   0.1108  -0.0123   0.1464   0.0093  -0.0863   0.0363   0.0715   0.0466   0.0613   0.0403  -0.0323   0.0775   0.9138
  -0.0137   0.0417   0.0103   0.0183   0.0106   0.0495   0.0492  -0.0232   0.8959  -0.0105   0.0439   0.0092  -0.0054   0.0307   0.0110   0.0008
   0.0757  -0.0114   0.0616   0.0581  -0.1002   0.1057  -0.0459  -0.0074   0.0787   0.7633   0.0277   0.0913  -0.0977   0.1478  -0.1416  -0.0362
   0.0238  -0.0623   0.0129   0.0051  -0.0427   0.1298  -0.1416   0.0569  -0.0080  -0.0156   0.7881   0.0087   0.0047  -0.0204   0.0212  -0.0336
   0.0450  -0.0097   0.0659  -0.0140  -0.0454  -0.0466  -0.1087  -0.0041   0.0572   0.0335   0.1136   0.9146   0.0090   0.0210  -0.0190  -0.0401
  -0.1093   0.0042  -0.0377  -0.0073  -0.8962  -0.0586   0.0436  -0.0378  -0.1176   0.0087  -0.0896   0.0085   0.1028   0.0146   0.0028   0.0139
  -0.0282  -0.1129  -0.0535  -0.0187   0.0035  -0.8299   0.1027  -0.0027  -0.0829  -0.0206  -0.1480  -0.0652  -0.0244   0.0456  -0.0450   0.0714
  -0.0149   0.0491  -0.0946   0.0148   0.0081   0.0365  -0.8601  -0.0857   0.0692   0.0950  -0.0219  -0.0093   0.0028  -0.0435   0.1704  -0.0027
  -0.0101   0.0252   0.0010  -0.0971  -0.0199   0.0608   0.0047  -0.8601   0.0139  -0.0005   0.0020  -0.1379   0.0024  -0.0227  -0.0197   0.1049


Gcnot = 
   0.9998   0.0002        0  -0.0001   0.0002        0  -0.0002  -0.0002  -0.0001   0.0003   0.0003        0        0        0  -0.0002        0
  -0.0101   0.9337   0.0171  -0.0238   0.0002  -0.0161  -0.0007  -0.0296  -0.0150   0.0252  -0.0060   0.0295  -0.0278   0.0427  -0.0480   0.0035
   0.0171  -0.0372   0.0503  -0.0246  -0.0458   0.0751  -0.1735   0.0317  -0.0157   0.0208   0.1745  -0.0830   0.0185  -0.0130   0.9192   0.0319
  -0.0980   0.0898   0.0129   0.0058  -0.0116  -0.0057  -0.0395  -0.1539   0.0535   0.0092   0.0128   0.1485   0.0709  -0.0876  -0.0376   0.9061
   0.0065   0.0109   0.0104   0.0068   0.0283   0.0034  -0.0850  -0.0490   0.0090   0.9338  -0.0363   0.0003  -0.0248   0.0575  -0.0240  -0.0119
   0.0091   0.0086  -0.0052  -0.0129  -0.1390   0.0382  -0.0408  -0.0382   0.9097   0.0077   0.0429   0.1283  -0.0254  -0.0124  -0.0245   0.0077
  -0.0482   0.0479  -0.0873   0.0198  -0.0175  -0.0773  -0.0334  -0.8585   0.0386   0.0023  -0.1245  -0.0806   0.0174  -0.0357   0.0808  -0.0242
  -0.0043   0.0162   0.0470  -0.0427  -0.0683   0.0227   0.8300   0.0740   0.0758  -0.1093  -0.0430   0.0264   0.0349   0.0038   0.0129  -0.0109
  -0.0183   0.0625  -0.0087  -0.0112  -0.0289  -0.9237  -0.0019   0.0021  -0.0252   0.0807  -0.1811  -0.0234   0.0299  -0.0576   0.0039   0.0197
   0.0049   0.0170  -0.0197  -0.0208  -0.8493  -0.0150  -0.0962   0.0458   0.0372  -0.0463   0.1115   0.0104   0.0531  -0.0798   0.1156   0.0760
  -0.0120   0.0464   0.0568   0.0126  -0.0466   0.0821  -0.0117  -0.0137  -0.0384   0.0752   0.0382  -0.7338  -0.0128  -0.0086  -0.0450   0.0034
   0.0007   0.0143   0.0181   0.0470  -0.1100   0.0713  -0.0854   0.0328  -0.0322   0.0347   0.9257   0.0794  -0.0140  -0.0251   0.0281   0.0185
  -0.0318   0.0045  -0.0053  -0.0546  -0.0929   0.0807   0.0104   0.0307   0.1217   0.0967   0.0020   0.0893   0.9129  -0.0007  -0.0036   0.0761
  -0.0266  -0.0250  -0.0885  -0.0124   0.0939  -0.0560   0.1213   0.0835   0.0554  -0.0201  -0.0811  -0.0449  -0.0132   0.9309  -0.0334  -0.0039
  -0.0230   0.0204   0.8297   0.0443  -0.0731   0.0076  -0.0323  -0.1205   0.0210  -0.0987  -0.0290   0.0159   0.0254  -0.0725  -0.0057   0.0089
   0.0966  -0.0901  -0.0234   0.8849  -0.0333  -0.0480   0.1533   0.0394  -0.0254  -0.0274  -0.1438   0.0208  -0.0864   0.1124   0.0119  -0.0165




--- Iterative MLGST: Beginning iter 1 of 3 : 666 gate strings ---

--- Minimum Chi^2 GST ---
Memory estimates: (4 spam labels,666 gate strings, 1263 gateset params, 16 gate dim)
Peristent: 0.0251528 GB 
Intermediate: 1.60566 GB 
Limit: 3 GB
28861.3: p in (0.000951297,0.996945),  weights in (31.6712,1025.28),  gs in (-0.825202,0.873666), maxLen = 7, nClipped=0
28861.3: p in (0.000951297,0.996945),  weights in (31.6712,1025.28),  gs in (-0.825202,0.873666), maxLen = 7, nClipped=0
28861.3: p in (0.000951297,0.996945),  weights in (31.6712,1025.28),  gs in (-0.825202,0.873666), maxLen = 7, nClipped=0
1.32908e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-578.981,527.413), maxLen = 7, nClipped=2664
1.24539e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-57.9337,52.8221), maxLen = 7, nClipped=2664
1.0055e+18: p in (-145757,137378),  weights in (31.6244,3162.28),  gs in (-5.86512,5.54628), maxLen = 7, nClipped=2655
755700: p in (-0.0319906,0.992101),  weights in (31.7484,3162.28),  gs in (-1.42235,1.36452), maxLen = 7, nClipped=9
15737.9: p in (-0.00187681,1.0009),  weights in (31.6244,3162.28),  gs in (-0.848526,0.895988), maxLen = 7, nClipped=2
3044.49: p in (-0.000462267,1.00011),  weights in (31.6244,3162.28),  gs in (-0.897282,0.938826), maxLen = 7, nClipped=2
1101.61: p in (0.000375036,0.998276),  weights in (31.6501,1632.91),  gs in (-0.932097,0.953545), maxLen = 7, nClipped=0
2775.12: p in (-0.00376492,0.999225),  weights in (31.635,3162.28),  gs in (-1.05549,1.01607), maxLen = 7, nClipped=2
1036.16: p in (0.000703814,0.997577),  weights in (31.6612,1191.99),  gs in (-0.9385,0.956302), maxLen = 7, nClipped=0
1031.62: p in (0.000989783,0.996885),  weights in (31.6721,1005.15),  gs in (-0.953545,1.00667), maxLen = 7, nClipped=0
1068.63: p in (0.00107062,0.996694),  weights in (31.6752,966.458),  gs in (-1.01181,1.03151), maxLen = 7, nClipped=0
1029.78: p in (0.00106071,0.996675),  weights in (31.6755,970.961),  gs in (-0.959929,1.0099), maxLen = 7, nClipped=0
1029.82: p in (0.00104157,0.996653),  weights in (31.6758,979.84),  gs in (-0.964455,1.01763), maxLen = 7, nClipped=0
1029.76: p in (0.00105947,0.996638),  weights in (31.6761,971.528),  gs in (-0.961223,1.01176), maxLen = 7, nClipped=0
1029.76: p in (0.00105721,0.996632),  weights in (31.6762,972.567),  gs in (-0.961333,1.00557), maxLen = 7, nClipped=0
1029.76: p in (0.00106047,0.996631),  weights in (31.6762,971.069),  gs in (-0.961269,1.01046), maxLen = 7, nClipped=0
1029.76: p in (0.00106059,0.99663),  weights in (31.6762,971.014),  gs in (-0.961747,1.01037), maxLen = 7, nClipped=0
1029.76: p in (0.00106059,0.99663),  weights in (31.6762,971.014),  gs in (-0.961747,1.01037), maxLen = 7, nClipped=0
  Sum of Chi^2 = 1029.76 (1998 data params - 1023 model params = expected mean of 975; p-value = 0.108871)
    2*Delta(log(L)) = 1031.6

--- Iterative MLGST: Beginning iter 2 of 3 : 1041 gate strings ---

--- Minimum Chi^2 GST ---
Memory estimates: (4 spam labels,1041 gate strings, 1263 gateset params, 16 gate dim)
Peristent: 0.0393154 GB 
Intermediate: 2.50974 GB 
Limit: 3 GB
3868.67: p in (0.00106059,0.99663),  weights in (31.6762,971.014),  gs in (-0.961747,1.01037), maxLen = 8, nClipped=0
3868.67: p in (0.00106059,0.99663),  weights in (31.6762,971.014),  gs in (-0.961747,1.01037), maxLen = 8, nClipped=0
3868.67: p in (0.00106059,0.99663),  weights in (31.6762,971.014),  gs in (-0.961747,1.01037), maxLen = 8, nClipped=0
2.09317e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-482.821,529.093), maxLen = 8, nClipped=4164
1.983e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-48.2442,52.8539), maxLen = 8, nClipped=4164
1.98886e+16: p in (-14492.3,23042.7),  weights in (31.6244,3162.28),  gs in (-4.78646,5.23007), maxLen = 8, nClipped=4130
14246.7: p in (-0.00289212,0.996332),  weights in (31.6809,3162.28),  gs in (-1.02231,1.15982), maxLen = 8, nClipped=1
2471.37: p in (0.00101164,0.996763),  weights in (31.6741,994.231),  gs in (-0.954342,0.994824), maxLen = 8, nClipped=0
2177.06: p in (0.00120096,0.996249),  weights in (31.6822,912.507),  gs in (-0.972775,0.958881), maxLen = 8, nClipped=0
2672.99: p in (-0.000231468,0.996694),  weights in (31.6752,3162.28),  gs in (-1.04897,0.992802), maxLen = 8, nClipped=1
2157.54: p in (0.00120422,0.995963),  weights in (31.6868,911.272),  gs in (-0.979694,0.960486), maxLen = 8, nClipped=0
2158.07: p in (0.0012273,0.995797),  weights in (31.6894,902.661),  gs in (-0.964203,0.959713), maxLen = 8, nClipped=0
2157.3: p in (0.00120935,0.99578),  weights in (31.6897,909.336),  gs in (-0.976654,0.960488), maxLen = 8, nClipped=0
2157.32: p in (0.00119948,0.995695),  weights in (31.6911,913.07),  gs in (-0.968298,0.958575), maxLen = 8, nClipped=0
2157.28: p in (0.00120715,0.99569),  weights in (31.6912,910.165),  gs in (-0.974894,0.960096), maxLen = 8, nClipped=0
2157.28: p in (0.00120678,0.995648),  weights in (31.6918,910.304),  gs in (-0.976964,0.960305), maxLen = 8, nClipped=0
2157.28: p in (0.00120715,0.99569),  weights in (31.6912,910.165),  gs in (-0.974894,0.960096), maxLen = 8, nClipped=0
  Sum of Chi^2 = 2157.28 (3123 data params - 1023 model params = expected mean of 2100; p-value = 0.187744)
    2*Delta(log(L)) = 2163.58

--- Iterative MLGST: Beginning iter 3 of 3 : 1582 gate strings ---

--- Minimum Chi^2 GST ---
Memory estimates: (4 spam labels,1582 gate strings, 1263 gateset params, 16 gate dim)
Peristent: 0.0597474 GB 
Intermediate: 3.81404 GB 
Limit: 3 GB
Maximum eval sub-tree size = 1244
Memory limit and/or MPI has imposed a division of the evaluation tree:
Size of original tree = 1582
Size of original gatestring_list = 1582
Tree is split into 2 sub-trees
Sub-tree lengths =  [1242, 433]  (Sum = 1675)
>> sub-tree 0: 
Size of evalTree = 1242
Size of gatestring_list = 1242
Max in use at once = (smallest tree size for mem) = 1242
>> sub-tree 1: 
Size of evalTree = 433
Size of gatestring_list = 340
Max in use at once = (smallest tree size for mem) = 341
4580.63: p in (0.00120715,0.99569),  weights in (31.6912,910.165),  gs in (-0.974894,0.960096), maxLen = 10, nClipped=0
4580.63: p in (0.00120715,0.99569),  weights in (31.6912,910.165),  gs in (-0.974894,0.960096), maxLen = 10, nClipped=0
4580.63: p in (0.00120715,0.99569),  weights in (31.6912,910.165),  gs in (-0.974894,0.960096), maxLen = 10, nClipped=0
3.16155e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-536.519,392.614), maxLen = 10, nClipped=6328
2.97799e+22: p in (-1e+06,1e+06),  weights in (31.6244,3162.28),  gs in (-53.681,39.3079), maxLen = 10, nClipped=6328
8.9276e+18: p in (-399627,575710),  weights in (31.6244,3162.28),  gs in (-5.3972,4.35141), maxLen = 10, nClipped=6285
20207.2: p in (0.00131702,0.9938),  weights in (31.7213,871.372),  gs in (-1.13362,1.26681), maxLen = 10, nClipped=0
3795.61: p in (0.00120813,0.995879),  weights in (31.6881,909.795),  gs in (-0.975194,0.963297), maxLen = 10, nClipped=0
3789.87: p in (0.00115156,0.995449),  weights in (31.695,931.873),  gs in (-0.979597,0.957151), maxLen = 10, nClipped=0
3766.28: p in (0.00133187,0.995169),  weights in (31.6994,866.5),  gs in (-0.967818,0.955476), maxLen = 10, nClipped=0
3790.36: p in (0.00125192,0.995228),  weights in (31.6985,893.742),  gs in (-0.974918,0.974374), maxLen = 10, nClipped=0
3765.31: p in (0.00140506,0.995109),  weights in (31.7004,843.632),  gs in (-0.968218,0.955654), maxLen = 10, nClipped=0
3765.33: p in (0.0014075,0.995093),  weights in (31.7007,842.899),  gs in (-0.965199,0.954485), maxLen = 10, nClipped=0
3765.31: p in (0.00140337,0.995091),  weights in (31.7007,844.14),  gs in (-0.967142,0.955345), maxLen = 10, nClipped=0
3765.31: p in (0.00140419,0.995083),  weights in (31.7008,843.892),  gs in (-0.966037,0.955355), maxLen = 10, nClipped=0
3765.31: p in (0.00140337,0.995091),  weights in (31.7007,844.14),  gs in (-0.967142,0.955345), maxLen = 10, nClipped=0
  Sum of Chi^2 = 3765.31 (4746 data params - 1023 model params = expected mean of 3723; p-value = 0.309897)
    2*Delta(log(L)) = 3774.19
--- Last Iteration: switching to ML objective ---

--- MLGST ---
Memory estimates: (4 spam labels,1582 gate strings, 1263 gateset params, 16 gate dim)
Peristent: 0.0596413 GB 
Intermediate: 3.81404 GB 
Limit: 3 GB
Maximum eval sub-tree size = 1244
Memory limit and/or MPI has imposed a division of the evaluation tree:
Size of original tree = 1582
Size of original gatestring_list = 1582
Tree is split into 2 sub-trees
Sub-tree lengths =  [1242, 433]  (Sum = 1675)
>> sub-tree 0: 
Size of evalTree = 1242
Size of gatestring_list = 1242
Max in use at once = (smallest tree size for mem) = 1242
>> sub-tree 1: 
Size of evalTree = 433
Size of gatestring_list = 340
Max in use at once = (smallest tree size for mem) = 341
Least squares msg =  Both actual and predicted relative reductions in the sum of squares
  are at most 0.000001 ; flag = 1
  Maximum log(L) = 1885.77 below upper bound of -3.59017e+06
    2*Delta(log(L)) = 3771.55 (4746 data params - 1023 model params = expected mean of 3723; p-value = 0.285059)
    2*Delta(log(L)) = 3771.55
Total time=0.780860 hours

Step 5: Create report(s) using the returned Results object

The Results object returned from do_long_sequence_gst is able to generate several different types of reports. Most of these are designed to display single-qubit results (for historical reasons). The "general"-type report was designed with 2-qubit data presentation in mind, so creating reports with create_general_report will be the most useful.

In [8]:
results.gatesets['final estimate'].set_basis("pp", [4])
print results.gatesets['final estimate'].get_basis_name()
print results.gatesets['final estimate'].get_basis_dimension()
pp
[4]
In [9]:
results.create_general_report_pdf(filename="tutorial_files/easy_2q_general.pdf",verbosity=2)
*** Generating tables ***
Generating table: targetSpamBriefTable
Generating table: bestGatesetSpamBriefTable
Generating table: bestGatesetSpamParametersTable
Generating table: bestGatesetVsTargetTable
Generating table: bestGatesetSpamVsTargetTable
Generating table: bestGatesetGaugeOptParamsTable
Generating table: bestGatesetChoiEvalTable
Generating table: datasetOverviewTable
Generating table: bestGatesetEvalTable
Generating table: bestGatesetRelEvalTable
Generating table: targetGatesBoxTable
Generating table: bestGatesetErrGenBoxTable
Generating table: fiducialListTable
Generating table: prepStrListTable
Generating table: effectStrListTable
Generating table: germList2ColTable
Generating table: progressTable
*** Generating plots ***
 -- LogL plots (4):  1  Generating figure: colorBoxPlotKeyPlot
2  Generating figure: bestEstimateSummedColorBoxPlot
3  Generating special: bestEstimateColorBoxPlotPages

*** Merging into template file ***
Latex file(s) successfully generated.  Attempting to compile with pdflatex...
Initial output PDF tutorial_files/easy_2q_general.pdf successfully generated.
Final output PDF tutorial_files/easy_2q_general.pdf successfully generated. Cleaning up .aux and .log files.

Now open tutorial_files/easy_2q_general.pdf to see the results. You've run 2-qubit GST!

In [ ]: