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:
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
import pygsti
There are several ways to do this, as outlined by the comments in the cell below.
# 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)
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).
#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',),
('Gix','Gix'), ('Gxi',),
('Gyi',), ('Gxi','Gxi'),
('Gxi','Gix'), ('Gxi','Giy'),
('Gyi','Gix'), ('Gyi','Giy')] )
#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])
#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
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.
#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")
#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")
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.import time
start = time.time()
results = pygsti.do_long_sequence_gst(ds, gs_target, prep_fiducials, effect_fiducials, germs4,
maxLengths, gaugeOptParams={'itemWeights': {'spam':0.1,'gates': 1.0}},
advancedOptions={ 'depolarizeStart' : 0.1 }, memLimit=3*(1024)**3,
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.74625587553 2.36755240819 2.30036599152 1.22184538384 1.20722017591 1.19776681861 0.867590284791 0.830116478803 0.54307091389 0.518700363651 0.368358238728 0.352882207485 0.31333776423 0.235272440391 0.208596789999 0.175280398892 Singular values of target I_tilde (truncating to first 16 of 16) = 6.86802764151 3.20253744687 3.20253744687 1.76923693223 1.76923693223 1.73205080757 1.23400485863 1.22474487139 0.707106781187 0.707106781187 0.5 0.493714392513 0.493714392513 0.346122344917 0.346122344917 0.239642075572 Resulting gate set: rho0 = 0.5000 0 0 0.5000 0 0 0 0 0 0 0 0 0.5000 0 0 0.5000 E0 = 0.5935 -0.0305 0.0225 0.4515 -0.0585 -0.0125 0.0465 -0.0425 0.0515 -0.0305 0.0005 0.0315 0.4475 -0.0405 0.0225 0.5015 E1 = 0.4910 0.0520 -0.0260 -0.4380 -0.0140 -0.0290 0.0210 0.0070 0.0450 -0.0220 0.0500 -0.0340 0.3560 0.0490 -0.0230 -0.4090 E2 = 0.5015 -0.0355 0.0635 0.3445 0.0445 0.0335 -0.0655 0.0735 -0.0475 0.0735 0.0145 -0.0685 -0.4365 0.0105 -0.0525 -0.4055 Gix = 0.9999 0 0 0 0.0001 -0.0003 0.0001 -0.0001 -0.0001 0 -0.0001 0.0001 0 -0.0004 0 0 0.0058 0.8896 0.0058 -0.0058 -0.0169 0.0303 -0.0169 0.0169 -0.0167 -0.0770 -0.0167 0.0167 -0.0173 0.0186 -0.0173 0.0173 -0.0755 0.0481 -0.0755 -0.9245 -0.0327 0.0257 -0.0327 0.0327 0.0224 -0.0459 0.0224 -0.0224 -0.0136 0.0787 -0.0136 0.0136 -0.0887 0.0805 0.9113 0.0887 -0.0294 0.0386 -0.0294 0.0294 -0.0178 -0.0212 -0.0178 0.0178 0.0051 0.0118 0.0051 -0.0051 -0.0095 -0.0110 -0.0095 0.0095 0.9173 -0.0488 -0.0827 0.0827 -0.0470 0.0226 -0.0470 0.0470 -0.0119 0.0210 -0.0119 0.0119 0.0114 0.0166 0.0114 -0.0114 0.0228 0.8177 0.0228 -0.0228 0.0241 -0.0108 0.0241 -0.0241 0.0243 -0.0289 0.0243 -0.0243 -0.0108 0.0377 -0.0108 0.0108 -0.1108 0.0609 -0.1108 -0.8892 0.0100 -0.0259 0.0100 -0.0100 0.0258 -0.0564 0.0258 -0.0258 0.0514 -0.1208 0.0514 -0.0514 -0.1590 0.3497 0.8410 0.1590 0.0263 -0.1390 0.0263 -0.0263 -0.0040 0.0219 -0.0040 0.0040 -0.0250 0.0290 -0.0250 0.0250 0.0791 -0.0931 0.0791 -0.0791 0.8707 0.0276 -0.1293 0.1293 -0.0269 0.0553 -0.0269 0.0269 0.0511 0.0071 0.0511 -0.0511 -0.0174 -0.0678 -0.0174 0.0174 0.1099 0.7414 0.1099 -0.1099 -0.0077 -0.0020 -0.0077 0.0077 -0.0073 0.0436 -0.0073 0.0073 0.0913 -0.1449 0.0913 -0.0913 -0.1232 0.1467 -0.1232 -0.8768 0.0090 0.0269 0.0090 -0.0090 0.0589 -0.0146 0.0589 -0.0589 -0.0825 -0.0375 -0.0825 0.0825 -0.0523 0.0865 0.9477 0.0523 0.0107 -0.0323 0.0107 -0.0107 -0.0100 -0.0127 -0.0100 0.0100 -0.0200 0.0349 -0.0200 0.0200 0 0.0135 0 0 0.9162 -0.0184 -0.0838 0.0838 0.0049 -0.0190 0.0049 -0.0049 -0.0489 0.1163 -0.0489 0.0489 -0.0432 0.0438 -0.0432 0.0432 0.0307 0.8645 0.0307 -0.0307 -0.0227 0.0837 -0.0227 0.0227 0.0216 -0.0104 0.0216 -0.0216 -0.0845 0.1318 -0.0845 0.0845 -0.1339 0.1303 -0.1339 -0.8661 -0.0002 -0.0323 -0.0002 0.0002 0.0299 0.0362 0.0299 -0.0299 0.0168 -0.0620 0.0168 -0.0168 -0.0826 0.0627 0.9174 0.0826 Giy = 0.9997 0 -0.0001 0.0003 0.0003 0 0 -0.0003 0 -0.0002 0 0 0.0001 0 0.0003 -0.0001 0.1079 -0.1184 0.1178 0.8921 -0.0195 0.0393 -0.0200 0.0195 0.0125 -0.0398 0.0238 -0.0125 -0.0077 -0.0045 -0.0270 0.0077 0.0104 0.0211 0.9450 -0.0104 0.0476 -0.0753 0.0217 -0.0476 0.0228 0.0120 0.0820 -0.0228 -0.0261 -0.0101 -0.0168 0.0261 -0.0867 -0.9114 -0.0820 0.0867 -0.0300 0.0029 -0.0846 0.0300 -0.0214 -0.0335 -0.0250 0.0214 0.0029 0.0169 0.0104 -0.0029 -0.0086 0.0183 -0.0486 0.0086 0.9134 0.0779 0.0594 0.0866 -0.0199 -0.0178 -0.0849 0.0199 -0.0029 -0.0024 -0.0372 0.0029 -0.0107 -0.0277 0.0079 0.0107 0.1282 -0.0316 0.1565 0.8718 -0.0086 -0.0892 0.1367 0.0086 0.0408 -0.0508 0.1100 -0.0408 -0.0108 -0.0783 0.0279 0.0108 -0.0166 -0.0330 0.7967 0.0166 0.0331 -0.0234 0.0728 -0.0331 0.0359 0.0339 0.0697 -0.0359 0.0339 -0.0176 0.0315 -0.0339 -0.1455 -0.8257 -0.1969 0.1455 0.0653 -0.0673 0.0346 -0.0653 -0.0246 -0.0236 -0.0266 0.0246 -0.0040 0.0224 0.0022 0.0040 0.0020 -0.0303 0.0126 -0.0020 0.8991 0.0926 0.0260 0.1009 -0.0232 0.0328 -0.0196 0.0232 -0.0284 -0.0290 0.0084 0.0284 0.0356 0.1531 -0.0118 -0.0356 0.1492 -0.1800 0.2741 0.8508 -0.0064 0.0707 0.0177 0.0064 -0.0240 -0.0515 -0.0329 0.0240 0.0811 0.1040 0.1852 -0.0811 -0.0528 -0.0620 0.7694 0.0528 0.0105 0.0587 0.0342 -0.0105 -0.0063 0.0082 0.0016 0.0063 0.0325 0.0557 0.0066 -0.0325 -0.0361 -0.8702 -0.0316 0.0361 0.0095 -0.0124 0.0088 -0.0095 -0.0052 0.0036 -0.0181 0.0052 -0.0081 -0.0409 0.0018 0.0081 0.0239 0.0100 -0.0103 -0.0239 0.9087 0.1102 -0.0041 0.0913 -0.0086 -0.0099 -0.0234 0.0086 -0.0281 0.0327 0.0860 0.0281 -0.0668 0.0638 -0.0112 0.0668 0.0900 -0.0754 0.1389 0.9100 -0.0063 0.0318 0.0062 0.0063 -0.0285 -0.0296 -0.1132 0.0285 -0.0074 -0.0271 -0.0287 0.0074 -0.0311 0.0366 0.8491 0.0311 0.0101 -0.0072 0.0369 -0.0101 -0.0175 0.0911 -0.0168 0.0175 -0.0128 0.0190 0.0277 0.0128 -0.0972 -0.9245 -0.0619 0.0972 Gxi = 0.9999 0.0001 0 0 0.0002 -0.0004 0 0.0001 0 -0.0002 0.0003 -0.0002 0 0.0001 0.0003 0 -0.0129 0.9166 -0.0026 0.0267 -0.0048 0.0170 -0.0307 -0.0451 0.0057 -0.0491 0.0607 0.0080 0.0120 0.1348 0.0461 -0.0258 -0.0039 -0.0214 0.9292 0.0072 0.0136 -0.0060 0.0024 -0.0394 -0.0097 0.0302 -0.1424 0.0130 0.0093 0.0041 0.0170 -0.0125 0.0033 0.0141 -0.0129 0.9185 -0.0174 -0.0018 0.0058 -0.0409 0.0292 -0.0226 0.0354 -0.1074 0.0091 -0.0018 -0.0022 0.0691 0.0174 -0.0745 0.0049 -0.0330 0.8881 0.0769 0.0338 0.0165 0.0012 0.0055 -0.0683 -0.0168 0.0280 0.0142 0.0382 -0.0125 -0.0266 0.0026 0.0182 0.0305 0.0139 0.8593 0.0468 -0.1107 0.0035 0.0190 -0.0358 0.0004 0.0300 -0.0007 -0.0286 -0.0339 -0.0401 0.0654 -0.0197 -0.0137 0.0178 -0.0273 0.8502 0.0472 -0.0092 0.0131 0.1321 -0.0446 0.0182 0.0375 -0.0469 0.0356 -0.0076 0.0004 0.0150 -0.0351 -0.0350 0.0175 -0.0616 0.9018 -0.0516 0.1234 -0.0149 0.0088 0.0180 0.1255 0.0643 0.0248 -0.1081 0.0148 -0.0481 -0.0100 0.1436 -0.0752 0.0846 0.0341 -0.1243 0.0732 -0.0426 0.0062 -0.8787 -0.0067 0.0283 -0.0033 0.0204 -0.1154 0.0158 0.0564 0.0179 0.0611 0.0451 -0.1069 0.0495 -0.1937 -0.0300 0.0273 -0.0617 -0.8487 -0.1523 -0.0151 -0.0155 0.0450 -0.0778 0.0479 0.0793 -0.1144 0.1679 -0.0997 0.0126 -0.0098 -0.0369 0.0197 0.0410 -0.0941 -0.8469 -0.0734 0.0089 -0.0190 0.0696 -0.0677 -0.0217 -0.0082 -0.0574 0.0616 0.0348 -0.1914 0.0620 -0.0935 -0.0600 -0.0279 0.0061 -0.8813 -0.0892 -0.0264 0.0156 0.0024 0.0496 0.0323 -0.0752 -0.0066 0.9162 -0.0327 0.0067 -0.0031 0.0933 -0.0102 0.0197 -0.0065 -0.0200 -0.0765 -0.0675 -0.0373 -0.0424 0.1665 0.1255 0.0398 -0.0657 0.9219 -0.2025 0.0085 0.0466 0.0262 0.0260 0.0107 0.0002 0.0189 -0.1130 -0.0658 -0.0716 0.1080 -0.0813 0.1310 0.0020 -0.0854 0.9190 -0.0676 0.0259 -0.0104 0.1206 0.0397 0.0030 -0.0287 -0.0101 -0.1025 -0.0158 0.0946 0.0298 0.0668 -0.0330 0.0450 -0.0630 0.9335 0.0096 0.0054 -0.0346 0.0900 Gyi = 0.9998 0.0002 -0.0001 0 0 0.0002 -0.0002 0.0003 0 0 0 0 0.0002 -0.0005 0 0 0.0135 0.8861 -0.0035 0.0092 0.0099 0.0616 0.0059 0.0113 -0.0052 -0.0099 -0.0256 -0.0151 -0.0010 0.0918 -0.0376 -0.0217 -0.0053 0.0016 0.9032 0.0252 0.0340 -0.0834 0.2117 0.0059 -0.0064 -0.0093 0.0254 0.0348 -0.0063 0.0035 0.0384 -0.0136 -0.0029 -0.0188 -0.0169 0.9077 0.0448 -0.0564 0.0487 0.1138 -0.0115 -0.0069 -0.0340 0.0185 -0.0040 -0.0017 -0.0218 0.0992 0.0980 -0.0138 -0.0296 -0.0030 -0.1066 -0.0106 0.0262 -0.0169 0.0948 -0.0308 -0.0569 0.0323 0.9127 -0.0130 0.0103 -0.0076 0.0081 0.0790 -0.0012 0.0016 -0.0267 -0.0212 0.0253 0.0858 -0.0252 0.0989 0.0554 -0.0556 0.0609 0.8308 0.0196 -0.0706 -0.0622 0.0941 0.0751 0.0109 0.0177 -0.0317 -0.1453 -0.0249 -0.0375 0.0289 0.1197 -0.0393 0.0074 -0.0588 0.8194 0.0439 0.0287 -0.0099 0.0698 0.0677 0.0266 -0.0596 -0.0688 -0.0480 -0.0154 -0.1180 -0.0434 0.1162 -0.0204 0.0862 -0.0685 0.9240 -0.0223 0.0121 -0.0189 -0.0115 0.0367 -0.0594 0.0409 0.0072 0.8535 0.0650 -0.0045 0.0154 0.0214 0.0295 0.0319 0.0124 -0.0024 -0.0017 0.0319 0.0431 -0.0278 -0.0306 0.0649 -0.0476 0.1056 0.7662 0.2494 0.0467 0.0224 -0.0002 -0.0505 -0.0631 -0.0056 -0.0304 0.0079 0.0120 -0.0714 0.0902 -0.0721 0.0004 0.0586 -0.0161 0.9141 0.0599 0.0844 -0.1505 0.1292 -0.0908 0.0296 -0.0011 0.0478 -0.0103 -0.0332 0.0409 -0.0485 0.0639 0.0562 -0.0099 0.0556 0.8271 0.0020 -0.0473 -0.0163 -0.0212 -0.0960 -0.0248 -0.0133 -0.0069 -0.9157 0.0032 -0.0089 -0.0119 -0.0883 -0.0139 -0.0568 0.0159 0.1007 -0.0268 0.0107 0.0022 0.0007 -0.0806 0.0258 0.0143 -0.0155 -0.8215 -0.0317 -0.0692 -0.0884 -0.0286 0.0210 -0.0310 -0.0156 0.1191 0.0589 0.0006 -0.0520 0.0980 -0.1308 -0.0356 0.0380 -0.0729 -0.8974 -0.0423 -0.0696 0.0376 -0.0989 -0.1107 0.0444 -0.0640 0.1195 0.0433 -0.0047 0.0097 0.0139 -0.0954 -0.0198 0.0561 -0.0357 -0.9065 -0.0140 0.0076 -0.0098 -0.0605 0.0051 0.0461 -0.0279 0.0950 Gcnot = 0.9997 0.0003 0 0 0.0001 0 -0.0003 -0.0003 -0.0005 0.0006 0 0.0001 0 -0.0002 0 0 0.0272 0.8407 -0.0035 -0.0040 0.0196 0.0457 -0.0430 0.0311 0.0236 -0.0396 0.0503 0.0166 -0.0440 0.0796 -0.0339 0.0330 -0.0222 0.0463 -0.0372 -0.0013 0.0017 -0.0565 -0.1225 0.0159 -0.0742 0.0818 0.0579 -0.0672 -0.0073 0.0229 0.9600 0.0050 -0.0750 0.0362 0.0056 -0.0138 -0.0241 0.0734 0.0212 -0.0536 0.0334 -0.0919 0.0074 0.1028 0.1043 -0.0581 0.0268 0.9205 -0.0011 0.0011 -0.0146 -0.0006 -0.0070 0.0222 -0.0995 -0.0215 0.0147 0.8666 -0.0273 -0.0145 0.0020 0.0307 0.0134 0.0042 0.0057 0.0232 0.0886 -0.0275 -0.0236 0.0625 -0.0900 -0.0181 0.8446 0.1100 0.0439 -0.0151 0.0238 -0.0175 0.0258 0.0561 -0.0090 0.0015 0.1077 -0.0279 -0.1521 0.1764 -0.2136 -0.8410 -0.0006 -0.0004 -0.0202 -0.0347 0.0181 -0.0326 -0.0216 0.0120 -0.0143 -0.0743 -0.0041 0.0014 0.1748 0.0172 0.9580 0.1992 0.1255 -0.0847 -0.0250 0.0467 -0.0006 -0.0044 -0.0054 -0.0412 -0.0141 -0.0185 -0.0296 0.0352 -0.0110 -0.8326 -0.0015 -0.0766 -0.0203 0.0506 -0.1095 0.0564 -0.0244 0.0230 -0.0366 -0.0223 -0.0385 0.0713 -0.0369 -0.0389 -0.7941 -0.1179 0.0219 -0.0337 -0.0804 0.1186 -0.0020 -0.2122 0.0488 0.0023 0.1302 0.0312 -0.0336 0.0217 0.0210 -0.0201 -0.1480 0.1269 -0.0809 -0.1628 -0.2255 0.1910 -0.0145 -0.8962 0.0480 -0.0322 0.0565 -0.0014 -0.0449 0.1425 -0.0547 0.0284 -0.0681 -0.1231 0.0379 -0.0638 -0.1284 0.0343 0.8883 0.1005 0.0598 -0.1320 0.0905 0.0194 -0.0261 0.0218 -0.0185 -0.0891 -0.0746 0.0666 0.0578 0.0090 0.0845 0.0974 0.0190 0.0068 0.9169 0.0095 -0.0029 0.0983 -0.0243 0.0783 -0.0482 0.0434 0.0600 -0.0172 0.1237 -0.0285 0.1372 0.1114 -0.0209 0.0741 0.0290 0.8050 0.0461 -0.0008 -0.0327 0.0438 0.8690 0.0435 0.0408 -0.0102 0.1307 -0.0749 0.0372 -0.0527 0.0270 0.2041 -0.0497 0.0201 -0.0597 -0.0220 0.1139 -0.1277 0.0496 0.9152 0.0250 0.0302 0.0497 0.0416 0.0353 -0.0209 -0.1048 -0.0409 -0.0916 0.0886 0.0536 -0.0224 --- Iterative MLGST: Iter 1 of 3 731 gate strings ---: --- Minimum Chi^2 GST --- Memory limit = 3.00GB Cur, Persist, Gather = 0.08, 0.03, 0.30 GB Evaltree generation (deriv) w/mem limit = 2.59GB bulk_evaltree: created initial tree (731 strs) in 0s bulk_evaltree: split tree (1 subtrees) in 0s mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 1.88GB (2.44GB fc) Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing) groups of ~1 procs each, to distribute over 1344 params (taken as 1 param groups of ~1344 params). Memory estimate = 1.88GB (cache=731, wrtLen1=1344, wrtLen2=1344, subsPerProc=1). --- Outer Iter 0: norm_f = 33556.2, mu=0 --- Outer Iter 1: norm_f = 29434.4, mu=2.71019e+06 --- Outer Iter 2: norm_f = 23890.6, mu=903398 --- Outer Iter 3: norm_f = 15121.2, mu=301133 --- Outer Iter 4: norm_f = 10753.2, mu=298071 --- Outer Iter 5: norm_f = 5619.92, mu=99357.1 --- Outer Iter 6: norm_f = 3857.78, mu=33119 --- Outer Iter 7: norm_f = 2682.93, mu=11039.7 --- Outer Iter 8: norm_f = 1948.42, mu=3679.89 --- Outer Iter 9: norm_f = 1508.6, mu=1226.63 --- Outer Iter 10: norm_f = 1285.5, mu=408.877 --- Outer Iter 11: norm_f = 1198.53, mu=136.292 --- Outer Iter 12: norm_f = 1170.41, mu=45.4308 --- Outer Iter 13: norm_f = 1162.73, mu=15.1436 --- Outer Iter 14: norm_f = 1161.2, mu=5.04786 --- Outer Iter 15: norm_f = 1161.01, mu=1.68262 --- Outer Iter 16: norm_f = 1161, mu=0.560874 Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06 Sum of Chi^2 = 1161 (2193 data params - 1088 model params = expected mean of 1105; p-value = 0.117869) Completed in 333.8s 2*Delta(log(L)) = 1164.13 Iteration 1 took 333.9s --- Iterative MLGST: Iter 2 of 3 1141 gate strings ---: --- Minimum Chi^2 GST --- Memory limit = 3.00GB Cur, Persist, Gather = 0.18, 0.05, 0.30 GB Evaltree generation (deriv) w/mem limit = 2.48GB bulk_evaltree: created initial tree (1141 strs) in 0s bulk_evaltree: split tree (1 subtrees) in 0s mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 2.93GB (3.81GB fc) Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing) groups of ~1 procs each, to distribute over 1344 params (taken as 2 param groups of ~672 params). Memory estimate = 1.47GB (cache=1141, wrtLen1=672, wrtLen2=1344, subsPerProc=1). --- Outer Iter 0: norm_f = 4206.07, mu=0 --- Outer Iter 1: norm_f = 3022.08, mu=3055.24 --- Outer Iter 2: norm_f = 2660.21, mu=1018.41 --- Outer Iter 3: norm_f = 2495.9, mu=339.471 --- Outer Iter 4: norm_f = 2441.14, mu=113.157 --- Outer Iter 5: norm_f = 2429.94, mu=37.719 --- Outer Iter 6: norm_f = 2428.66, mu=12.573 --- Outer Iter 7: norm_f = 2428.59, mu=4.191 --- Outer Iter 8: norm_f = 2428.58, mu=1.397 Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06 Sum of Chi^2 = 2428.58 (3423 data params - 1088 model params = expected mean of 2335; p-value = 0.0867155) Completed in 249.5s 2*Delta(log(L)) = 2435.48 Iteration 2 took 249.5s --- Iterative MLGST: Iter 3 of 3 1735 gate strings ---: --- Minimum Chi^2 GST --- Memory limit = 3.00GB Cur, Persist, Gather = 0.17, 0.07, 0.29 GB Evaltree generation (deriv) w/mem limit = 2.46GB bulk_evaltree: created initial tree (1735 strs) in 0s bulk_evaltree: split tree (1 subtrees) in 0s mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 4.45GB (5.79GB fc) Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing) groups of ~1 procs each, to distribute over 1344 params (taken as 2 param groups of ~672 params). Memory estimate = 2.23GB (cache=1735, wrtLen1=672, wrtLen2=1344, subsPerProc=1). --- Outer Iter 0: norm_f = 4928.18, mu=0 --- Outer Iter 1: norm_f = 4410.95, mu=4061.19 --- Outer Iter 2: norm_f = 4286.18, mu=1353.73 --- Outer Iter 3: norm_f = 4240.36, mu=451.243 --- Outer Iter 4: norm_f = 4227.18, mu=150.414 --- Outer Iter 5: norm_f = 4224.58, mu=50.1381 --- Outer Iter 6: norm_f = 4224.26, mu=16.7127 --- Outer Iter 7: norm_f = 4224.24, mu=5.5709 Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06 Sum of Chi^2 = 4224.24 (5205 data params - 1088 model params = expected mean of 4117; p-value = 0.119196) Completed in 334.7s 2*Delta(log(L)) = 4237.15 Iteration 3 took 334.8s Switching to ML objective (last iteration) --- MLGST --- Memory: limit = 3.00GB(cur, persist, gthr = 0.22, 0.07, 0.29 GB) Evaltree generation (deriv) w/mem limit = 2.42GB bulk_evaltree: created initial tree (1735 strs) in 0s bulk_evaltree: split tree (1 subtrees) in 0s mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 4.45GB (5.79GB fc) Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing) groups of ~1 procs each, to distribute over 1344 params (taken as 2 param groups of ~672 params). Memory estimate = 2.23GB (cache=1735, wrtLen1=672, wrtLen2=1344, subsPerProc=1). --- Outer Iter 0: norm_f = 2118.57, mu=0 --- Outer Iter 1: norm_f = 2116.31, mu=2030.82 --- Outer Iter 2: norm_f = 2116.06, mu=1180.49 Least squares message = Relative change in |x| is at most 1e-06 Maximum log(L) = 2116.06 below upper bound of -3.9351e+06 2*Delta(log(L)) = 4232.12 (5205 data params - 1088 model params = expected mean of 4117; p-value = 0.103056) Completed in 126.4s 2*Delta(log(L)) = 4232.12 Final MLGST took 126.4s Iterative MLGST Total Time: 1044.6s Total time=0.297838 hours
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.
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]
results.create_general_report_pdf(filename="tutorial_files/easy_2q_general.pdf",verbosity=2)
*** Generating tables *** (0.0s elapsed) Generating table: targetSpamBriefTable [0.0s] Generating table: bestGatesetSpamBriefTable [0.0s] Generating table: bestGatesetSpamParametersTable [0.0s] Generating table: bestGatesetVsTargetTable [6.7s] Generating table: bestGatesetSpamVsTargetTable [0.0s] Generating table: bestGatesetGaugeOptParamsTable [0.0s] Generating table: bestGatesetChoiEvalTable [4.9s] Generating table: datasetOverviewTable [0.1s] Generating table: bestGatesetEvalTable [1.3s] Generating table: bestGatesetRelEvalTable [1.1s] Generating table: targetGatesBoxTable [6.7s] Generating table: bestGatesetGatesBoxTable [13.3s] Generating table: bestGatesetErrGenBoxTable [11.2s] Generating table: fiducialListTable [0.0s] Generating table: prepStrListTable [0.0s] Generating table: effectStrListTable [0.0s] Generating table: germList2ColTable [0.0s] Generating table: progressTable [13.4s] *** Generating plots *** (78.7s elapsed) -- LogL plots: Iter 1 of 3 : Generating figure: colorBoxPlotKeyPlot [1.8s] Iter 2 of 3 : Generating figure: bestEstimateSummedColorBoxPlot [0.6s] Iter 3 of 3 : Generating special: bestEstimateColorBoxPlotPages [9.7s] *** Merging into template file *** (96.1s elapsed) 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. Report generation complete! [total time 98s]
Now open tutorial_files/easy_2q_general.pdf to see the results. You've run 2-qubit GST!
import pickle
with open("tutorial_files/easy_2q_results.pkl","wb") as pklfile:
pickle.dump(results, pklfile)