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

This example 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 described in the tutorials, but we thought 2Q-GST is an important enough topic to deserve a separate example.

In [1]:
from __future__ import print_function
import pygsti

Step 1: Construct the desired 2-qubit gateset

Since the purpose of this example is to show how to run 2Q-GST, we'll just use a built-in "standard" 2-qubit gate set. (Another example covers how to create a custom 2-qubit gate set.)

In [2]:
from pygsti.construction import std2Q_XYICNOT
gs_target = std2Q_XYICNOT.gs_target.copy() #copying is good practice so we don't inadvertetly mess up std2Q_XYCNOT.gs_target

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 provided by pyGSTi because you're using a "standard" gate set (as we are here), or computed using the "fiducial selection" and "germ selection" algorithms which are a part of pyGSTi and covered in the tutorials. Since 2Q-GST with the 71 germs of the complete set would take a while, we'll also create a couple of small germ sets to demonstrate 2Q-GST more quickly (because we know you have important stuff to do).

In [3]:
prep_fiducials = std2Q_XYICNOT.prepStrs
effect_fiducials = std2Q_XYICNOT.effectStrs
In [4]:
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_XYICNOT.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 - typically powers of 2 up to
# the longest experiment you can glean information from.  Here we just pick 2 so things run quickly.
maxLengths = [1,2] # 4,16,32...

#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("example_files/My2QDataTemplate.txt", listOfExperiments,
                              "## Columns = 00 count, 01 count, 10 count, 11 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 on a single cpu) based on the number of gate sequences used, and running on multiple processors is a good idea (see the MPI example). However, since we chose an incomplete set of only 4 germs and set our maximum max-length to 2, this will run fairly quickly (~10min).

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

  • memoryLimit 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 slightly 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 6 or 8 GB initially and increase it as you see how much memory is actually used using a separate OS performance monitor tool. If you're running on multiple processors, this should be the memory available per processor.
  • 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.
  • advancedOptions is a dictionary that accepts various "advanced" settings that aren't typically needed. While we don't require its use below, the depolarizeStart key of this dictionary may be useful in certain cases: it gives an amount (in [0,1]) to depolarize the (LGST) estimate that is used as the initial guess for long-sequence GST. In practice, we find that, sometime, 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 can remedy 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, i.e. advancedOptions={ 'depolarizeStart' : 0.1 }.
In [7]:
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}},
                                    memLimit=3*(1024)**3, verbosity=3 )
end = time.time()
print("Total time=%f hours" % ((end - start) / 3600.0))
--- Gate Sequence Creation ---
   1317 sequences created
   Dataset has 1317 entries: 1317 utilized, 0 requested sequences were missing
--- LGST ---
  Singular values of I_tilde (truncating to first 16 of 16) = 
  6.743595023533244
  2.3759607376543403
  2.2982626315194534
  1.2234016894214428
  1.2092603631138166
  1.197845596409007
  0.8630521970477671
  0.8250150242519823
  0.5374035064345984
  0.5034187331962282
  0.38984451013936156
  0.3295915366884566
  0.3260352451471631
  0.25392875853124547
  0.21973006881050175
  0.1740975572752712
  
  Singular values of target I_tilde (truncating to first 16 of 16) = 
  6.868027641505519
  3.2025374468732157
  3.2025374468732126
  1.769236932225032
  1.7692369322250316
  1.7320508075688772
  1.234004858633701
  1.2247448713915885
  0.7071067811865479
  0.7071067811865478
  0.5000000000000001
  0.49371439251332727
  0.49371439251332716
  0.3461223449171738
  0.34612234491717375
  0.23964207557230052
  
    Resulting gate set:
    
    rho0 =    0.5000        0        0   0.5000        0        0        0        0        0        0        0        0   0.5000        0        0   0.5000
    
    
    Mdefault = Unconstrained POVM with effect vectors:
    00:
     0.59
    -0.03
     0.01
     0.46
    -0.03
    -0.06
     0.05
    -0.05
     0.04
     0.05
     0.01
     0.04
     0.45
    -0.04
     0.03
     0.50
    
    01:
     0.50
     0.05
    -0.02
    -0.46
    -0.02
       0
     0.04
     0.04
     0.06
    -0.02
     0.03
    -0.06
     0.37
     0.03
       0
    -0.41
    
    10:
     0.50
    -0.04
     0.04
     0.36
     0.03
     0.02
    -0.06
     0.02
    -0.03
    -0.05
    -0.05
    -0.04
    -0.45
     0.03
    -0.04
    -0.40
    
    11:
     0.42
     0.01
    -0.03
    -0.36
     0.02
     0.05
    -0.03
    -0.02
    -0.07
     0.01
       0
     0.06
    -0.37
    -0.02
     0.02
     0.32
    
    
    
    Gii = 
       0.9996   0.0003  -0.0002        0   0.0002  -0.0006  -0.0001   0.0002  -0.0006   0.0007  -0.0003        0        0  -0.0001        0  -0.0003
      -0.0048   0.9257   0.0147   0.0038   0.0225  -0.0062  -0.0108  -0.0394  -0.0295  -0.0317  -0.0185  -0.0020  -0.0118  -0.0373  -0.0238  -0.0132
      -0.0399   0.0249   0.9162  -0.0211   0.0112  -0.0080  -0.0321   0.0154  -0.0495   0.1117   0.0542  -0.0052  -0.0042   0.0482  -0.0041  -0.0023
       0.0014  -0.0224   0.0212   0.9035  -0.0097   0.0360  -0.0386  -0.0037  -0.0032  -0.0398   0.0042   0.0110  -0.0004  -0.0092  -0.0035  -0.0152
      -0.0083   0.0105  -0.0232  -0.0187   0.9061  -0.0023   0.0279  -0.0225  -0.0278   0.0897   0.0487  -0.0157  -0.0354  -0.0091  -0.0474   0.0007
       0.0062   0.0417   0.0210   0.0267  -0.0043   0.8167  -0.0645  -0.0964   0.0286   0.1223   0.1680   0.0363   0.0347  -0.0829   0.0041  -0.0028
       0.0009   0.0241   0.0286  -0.0013  -0.0708  -0.0232   0.6969   0.0190   0.0133   0.1107  -0.0810  -0.0079  -0.0732   0.0708  -0.0228  -0.0057
       0.0046  -0.0431   0.0010   0.0016  -0.0307   0.0741  -0.1133   0.8958   0.0414  -0.0799   0.0916  -0.0764   0.0577  -0.0941  -0.0009  -0.0328
      -0.0004   0.0079  -0.0660   0.0116  -0.0114   0.0572   0.0624   0.0203   0.8947   0.0427  -0.0190   0.0461  -0.0026  -0.0155  -0.0398  -0.0176
      -0.0338   0.0356   0.0099  -0.0156   0.0442   0.0062  -0.0452  -0.0110   0.0222   0.8270   0.1952   0.0239  -0.0482  -0.0227  -0.0144   0.0193
      -0.0404   0.0207  -0.0054  -0.0188   0.0332  -0.0375  -0.0071   0.0385  -0.0354   0.1087   0.9074  -0.0624  -0.0223   0.0534   0.0325  -0.0242
      -0.0341   0.0390   0.0803  -0.0218   0.0921  -0.1228  -0.0003  -0.0001  -0.0275   0.1906   0.1431   0.9022  -0.0456   0.0777  -0.0907   0.0017
      -0.0191  -0.0188  -0.0055  -0.0073   0.0330  -0.0134  -0.0447   0.0046   0.0147  -0.0496   0.0183   0.0112   0.8935   0.0254   0.0217   0.0019
       0.0012  -0.0884  -0.0733  -0.0065  -0.0865   0.0761   0.0732   0.0331  -0.0101   0.0295  -0.1972   0.0287   0.0046   0.9147   0.0343   0.0075
       0.0095   0.0667  -0.0310  -0.0595  -0.0058  -0.1015   0.0661   0.0609   0.0122   0.1237  -0.1213  -0.0094  -0.0464   0.0778   0.7875  -0.0221
      -0.0063   0.0045  -0.0261   0.0056  -0.0215   0.0057  -0.0093  -0.0019   0.0032  -0.0362  -0.0051   0.0006   0.0312  -0.0759   0.0348   0.8809
    
    
    Gix = 
       0.9998        0  -0.0002   0.0002        0  -0.0004        0        0  -0.0002  -0.0003  -0.0002   0.0002        0  -0.0003        0        0
       0.0193   0.8775   0.0193  -0.0193  -0.0190   0.0732  -0.0190   0.0190  -0.0316  -0.0171  -0.0316   0.0316  -0.0141   0.0212  -0.0141   0.0141
      -0.1004   0.1249  -0.1004  -0.8996   0.0313  -0.0927   0.0313  -0.0313  -0.0038   0.0041  -0.0038   0.0038  -0.0074   0.0212  -0.0074   0.0074
      -0.0781   0.0486   0.9219   0.0781  -0.0250   0.0809  -0.0250   0.0250   0.0101  -0.0464   0.0101  -0.0101  -0.0098   0.0024  -0.0098   0.0098
       0.0205  -0.0208   0.0205  -0.0205   0.9093   0.0287  -0.0907   0.0907   0.0538  -0.0249   0.0538  -0.0538  -0.0230  -0.0266  -0.0230   0.0230
      -0.0123   0.0536  -0.0123   0.0123   0.0185   0.8309   0.0185  -0.0185   0.0142   0.0741   0.0142  -0.0142  -0.0344  -0.0425  -0.0344   0.0344
       0.0007  -0.0650   0.0007  -0.0007  -0.1471   0.0788  -0.1471  -0.8529   0.0335   0.0787   0.0335  -0.0335  -0.0160   0.0526  -0.0160   0.0160
       0.0225  -0.0449   0.0225  -0.0225  -0.1325   0.2155   0.8675   0.1325  -0.0057  -0.0588  -0.0057   0.0057   0.0534  -0.0657   0.0534  -0.0534
      -0.0184   0.0257  -0.0184   0.0184   0.0108  -0.0099   0.0108  -0.0108   0.8994   0.0213  -0.1006   0.1006  -0.0156   0.0018  -0.0156   0.0156
       0.0119  -0.0183   0.0119  -0.0119   0.0031   0.0651   0.0031  -0.0031   0.0903   0.7949   0.0903  -0.0903  -0.0265   0.0004  -0.0265   0.0265
       0.0200  -0.0937   0.0200  -0.0200  -0.0415   0.1396  -0.0415   0.0415  -0.1057   0.0572  -0.1057  -0.8943  -0.0041  -0.0212  -0.0041   0.0041
       0.0246  -0.0446   0.0246  -0.0246   0.0305  -0.0112   0.0305  -0.0305  -0.0068   0.0050   0.9932   0.0068  -0.0532   0.0782  -0.0532   0.0532
      -0.0123   0.0061  -0.0123   0.0123  -0.0030  -0.0178  -0.0030   0.0030  -0.0069   0.0085  -0.0069   0.0069   0.9094  -0.0158  -0.0906   0.0906
      -0.0525   0.0395  -0.0525   0.0525  -0.0129  -0.0762  -0.0129   0.0129  -0.0321  -0.0120  -0.0321   0.0321   0.0102   0.8793   0.0102  -0.0102
      -0.0110   0.0218  -0.0110   0.0110  -0.0251  -0.0081  -0.0251   0.0251   0.0350   0.0876   0.0350  -0.0350  -0.1074   0.1215  -0.1074  -0.8926
      -0.0198   0.0010  -0.0198   0.0198   0.0103  -0.0113   0.0103  -0.0103  -0.0442  -0.0595  -0.0442   0.0442  -0.0635   0.0169   0.9365   0.0635
    
    
    Giy = 
       0.9997  -0.0002  -0.0003   0.0003   0.0006        0   0.0005  -0.0006  -0.0003  -0.0002   0.0001   0.0003   0.0001   0.0003  -0.0003  -0.0001
       0.0890  -0.0800   0.0942   0.9110   0.0180  -0.0251   0.0093  -0.0180  -0.0391  -0.0302  -0.0966   0.0391   0.0034  -0.0158   0.0165  -0.0034
      -0.0089  -0.0115   0.9199   0.0089   0.0109   0.0548   0.0036  -0.0109  -0.0293   0.0351   0.0451   0.0293  -0.0114  -0.0103  -0.0241   0.0114
      -0.0946  -0.8946  -0.0848   0.0946  -0.0153   0.0028   0.0144   0.0153  -0.0199  -0.0144  -0.0277   0.0199   0.0027   0.0019   0.0204  -0.0027
       0.0096   0.0166   0.0174  -0.0096   0.8866   0.0896  -0.0173   0.1134   0.0045   0.0023   0.0710  -0.0045   0.0114  -0.0150   0.0110  -0.0114
      -0.0275  -0.0171   0.0091   0.0275   0.1901  -0.1209   0.1408   0.8099  -0.0292  -0.0119  -0.0429   0.0292  -0.0136  -0.0057   0.0216   0.0136
      -0.0168   0.0183   0.0693   0.0168   0.0427   0.0050   0.8340  -0.0427  -0.0374   0.0873  -0.0645   0.0374  -0.0118  -0.0716   0.0158   0.0118
       0.0081  -0.0600  -0.0240  -0.0081  -0.0947  -0.8106  -0.1233   0.0947   0.0352  -0.1141   0.0811  -0.0352   0.0364   0.0174   0.0568  -0.0364
      -0.0182   0.0213  -0.0699   0.0182   0.0066  -0.0603   0.0520  -0.0066   0.8776   0.0559  -0.0304   0.1224   0.0077  -0.0078  -0.0448  -0.0077
       0.0415   0.0364   0.0468  -0.0415  -0.0392  -0.0869  -0.0964   0.0392   0.1947  -0.0919   0.3022   0.8053  -0.0113  -0.0109  -0.0113   0.0113
      -0.0113   0.0182   0.0295   0.0113  -0.0040  -0.0093  -0.1352   0.0040  -0.0532   0.0651   0.8236   0.0532   0.0319  -0.0097   0.0614  -0.0319
      -0.0036  -0.0020  -0.0119   0.0036  -0.0060   0.1400   0.0482   0.0060  -0.0979  -0.8117  -0.0450   0.0979  -0.0350  -0.0132  -0.0687   0.0350
      -0.0025   0.0263   0.0031   0.0025  -0.0118   0.0458  -0.0107   0.0118   0.0238  -0.0153   0.0221  -0.0238   0.9106   0.0858   0.0035   0.0894
      -0.0038  -0.0401  -0.0064   0.0038  -0.0562   0.0524   0.0264   0.0562   0.0057  -0.0270   0.0267  -0.0057   0.0913  -0.1212   0.0976   0.9087
      -0.0041   0.0698  -0.0421   0.0041  -0.0077  -0.1376   0.0688   0.0077   0.0308   0.0928  -0.1033  -0.0308  -0.0257   0.0155   0.8578   0.0257
      -0.0115  -0.0352   0.0063   0.0115   0.0069   0.0171  -0.0124  -0.0069   0.0035  -0.0384  -0.0154  -0.0035  -0.0670  -0.9119  -0.0448   0.0670
    
    
    Gxi = 
       0.9997   0.0001  -0.0002        0   0.0002  -0.0004  -0.0003        0        0  -0.0002        0  -0.0003   0.0005  -0.0004   0.0003  -0.0001
      -0.0007   0.9450   0.0272  -0.0254   0.0029  -0.0376  -0.0537  -0.0131   0.0181  -0.1137   0.0322  -0.0442   0.0110   0.0520   0.0129   0.0151
      -0.0082   0.0222   0.8836  -0.0062   0.0066  -0.0648   0.0614  -0.0161  -0.0189   0.0545  -0.1609   0.0045   0.0200  -0.0147   0.0695  -0.0056
      -0.0056   0.0064   0.0128   0.9200   0.0060   0.0066  -0.0066  -0.0304   0.0066   0.0179   0.0107  -0.0922   0.0204  -0.0093   0.0110   0.0653
      -0.0006  -0.0176  -0.0140  -0.0123   0.9047   0.0493  -0.0492   0.0151  -0.0396  -0.0384  -0.0760   0.0267  -0.0108  -0.0540  -0.0786   0.0237
       0.0256  -0.0051   0.0422  -0.0011  -0.0353   0.9314  -0.0586  -0.0750   0.0377  -0.1391   0.1306  -0.0132   0.0268  -0.0627  -0.0410  -0.0513
      -0.0285  -0.0833  -0.0006  -0.0103   0.0350   0.0123   0.8895  -0.0677  -0.0619   0.0301  -0.0759   0.0231   0.0337  -0.0768   0.0273   0.0050
      -0.0039   0.0036   0.0025  -0.0019   0.0216   0.0715  -0.0075   0.8950   0.0329  -0.0233   0.0884  -0.0387   0.0239   0.0699   0.0155  -0.0181
      -0.0915  -0.0061  -0.0335   0.0060   0.0641   0.0416   0.0323  -0.0174  -0.0805  -0.0271  -0.0214  -0.0050  -0.9001  -0.0117  -0.0054  -0.0145
       0.0323  -0.1148   0.0353  -0.0186  -0.0514   0.1892  -0.0845  -0.0698  -0.0199  -0.1027   0.0732   0.0336  -0.0820  -0.7782  -0.1075   0.0683
      -0.0191  -0.0271  -0.1063  -0.0303   0.0121  -0.0043   0.0746  -0.0477  -0.0406   0.0211  -0.1984  -0.0089   0.0335  -0.0850  -0.9004   0.0159
       0.0005   0.0080  -0.0129  -0.0874   0.0303  -0.0497   0.0448   0.0709  -0.0348  -0.0224  -0.0873  -0.0521  -0.0367  -0.0723  -0.0878  -0.8764
      -0.1002   0.0103   0.0091  -0.0087   0.1154  -0.0489  -0.0462   0.0018   0.9026  -0.0002   0.0029  -0.0115   0.1012   0.0203   0.0276   0.0077
      -0.0155  -0.1251  -0.0482   0.0362  -0.0746   0.1443   0.0575   0.0413  -0.0330   0.9311  -0.1024   0.0536   0.0514   0.1079   0.0527  -0.0721
       0.0183   0.0101  -0.1050   0.0072  -0.0494   0.0320   0.0515   0.0221   0.0111  -0.0558   0.8932   0.0144  -0.0670   0.0087   0.0788   0.0414
       0.0005   0.0001  -0.0130  -0.0919  -0.0081   0.0091  -0.0045   0.0996  -0.0097  -0.0408  -0.0038   0.9183   0.0174   0.0494   0.0275   0.0740
    
    
    Gyi = 
       0.9997   0.0002  -0.0003   0.0001        0   0.0002   0.0002        0  -0.0003   0.0003  -0.0001   0.0002   0.0002  -0.0003        0        0
       0.0104   0.8918  -0.0006   0.0014   0.0060   0.1377   0.0883  -0.0031  -0.0420   0.0399  -0.0895   0.0288   0.0024   0.1049  -0.0441  -0.0142
      -0.0168   0.0065   0.9198  -0.0059  -0.0045  -0.0060   0.0605  -0.0129  -0.0043   0.0087   0.0548  -0.0028   0.0425  -0.0459   0.1452  -0.0198
      -0.0057   0.0001   0.0218   0.9044   0.0047  -0.0316  -0.0041   0.1146   0.0011   0.0070   0.0372   0.0096   0.0061   0.0242  -0.0108   0.0952
       0.1066  -0.0059   0.0048  -0.0009  -0.1240   0.0615   0.0095  -0.0004   0.0997   0.0576   0.0360   0.0369   0.8867   0.0715  -0.0332   0.0076
      -0.0098   0.1806  -0.0120   0.0268   0.0301  -0.1137   0.0105  -0.0125   0.0142   0.1733   0.0009  -0.0184   0.0011   0.8724  -0.0800  -0.0182
       0.0024  -0.0407   0.1075   0.0145   0.0397  -0.0083  -0.0715  -0.0047   0.0360   0.0382   0.0596  -0.0479  -0.0312   0.0307   0.8425   0.0142
      -0.0203   0.0158  -0.0372   0.1199   0.0570  -0.0266   0.0499  -0.0992  -0.0502  -0.0611  -0.0690   0.0545   0.0235   0.0238   0.0182   0.8769
       0.0017   0.0181  -0.0373   0.0104   0.0108  -0.0075   0.0721   0.0258   0.8768   0.0789  -0.0515   0.0341  -0.0153   0.0089  -0.0091   0.0032
       0.0413  -0.0496   0.0313  -0.0387   0.0119  -0.0078   0.0415  -0.0082   0.0607   0.8477   0.1502  -0.0357  -0.0283   0.0468  -0.0540   0.0257
      -0.0372   0.0396  -0.0883  -0.0140   0.0203  -0.0208   0.1195        0  -0.1290   0.2770   0.7109  -0.0394   0.0275  -0.0622  -0.0062   0.0237
       0.0111  -0.0014   0.1165   0.0140   0.0476   0.0283  -0.0163   0.0116   0.0176   0.0271   0.2363   0.8845   0.0038   0.0110  -0.0505  -0.0289
      -0.0951   0.0069   0.0028  -0.0232  -0.9171  -0.0071  -0.0181   0.0055  -0.0759   0.0003   0.0258  -0.0080   0.1075  -0.0313  -0.0223   0.0108
      -0.0275  -0.0650  -0.0145   0.0399   0.0092  -0.9129  -0.0564  -0.0262   0.0322  -0.1391   0.0377   0.1077  -0.0554   0.0542  -0.0219   0.0431
      -0.0024  -0.0127  -0.1113  -0.0176   0.0370  -0.0629  -0.8938   0.0309   0.0906   0.0503  -0.0707  -0.0279  -0.0512   0.0278   0.0370   0.0711
      -0.0146   0.0142   0.0049  -0.0830  -0.0223   0.0933  -0.0665  -0.9298  -0.0502  -0.0645  -0.0332  -0.0832   0.0148  -0.0164  -0.0359   0.0828
    
    
    Gcnot = 
       0.9995   0.0004  -0.0004  -0.0002  -0.0005   0.0003   0.0005        0   0.0002   0.0001  -0.0003   0.0003   0.0002  -0.0004  -0.0004        0
       0.0337   0.9065   0.0294   0.0131  -0.0162   0.0219  -0.0315  -0.0123   0.0717  -0.0476   0.0485  -0.0178  -0.0233  -0.0053   0.0410   0.0012
      -0.0098   0.0044  -0.0326  -0.0022  -0.0573   0.0034  -0.1470  -0.0609   0.0243  -0.0514   0.1217   0.0523  -0.0145   0.0366   0.9041  -0.0210
      -0.1026   0.0966   0.0254   0.0055   0.0132   0.0643  -0.0125  -0.1047   0.0163  -0.0659   0.0084   0.0966   0.0982  -0.0761   0.0271   0.8956
       0.0145   0.0042  -0.0403   0.0073   0.0023   0.8457  -0.0463  -0.0721  -0.0084   0.0587   0.0514  -0.0271  -0.0284  -0.0341   0.0043  -0.0018
       0.0110   0.0601   0.0422   0.0236   0.7039   0.1137  -0.1391   0.0315   0.0604  -0.0110   0.0295   0.0182  -0.0089  -0.0923   0.0056   0.0061
       0.0018  -0.0098   0.0983   0.0022  -0.0107  -0.0769  -0.0675  -0.0017   0.1230  -0.1009   0.1883   0.8479  -0.0220   0.0227   0.0196  -0.0034
      -0.0189  -0.0128   0.0048  -0.0317   0.1103   0.0151   0.0028   0.1148   0.0364  -0.1882  -0.8111  -0.1351   0.0088   0.0291  -0.0148  -0.0127
       0.0190   0.0307  -0.0124  -0.0142  -0.0146  -0.0649  -0.0531   0.0110   0.0465   0.9253   0.0143  -0.0003   0.0021  -0.0255  -0.0544   0.0063
       0.0453   0.0083   0.0777   0.0381  -0.0170   0.0101  -0.1446  -0.1655   0.8040   0.1364   0.0468   0.0727  -0.0394  -0.0333   0.0443  -0.0606
      -0.0124   0.0233   0.0027   0.0323  -0.0684   0.0836  -0.1032  -0.9645   0.1057  -0.0423   0.0729   0.0374  -0.0432  -0.0283  -0.0328  -0.0377
       0.0108   0.0110  -0.0281   0.0086   0.0069   0.0253   0.8744   0.0054   0.0981  -0.0434   0.0548   0.0419  -0.0187   0.0281   0.1188  -0.0099
      -0.0134  -0.0240   0.0010  -0.0887  -0.1285   0.1703  -0.0234  -0.0045   0.0724  -0.0968   0.0048  -0.0340   0.9160  -0.0007   0.0044   0.0837
      -0.0365  -0.0044  -0.0429  -0.0267   0.1225  -0.0652   0.0535   0.1307  -0.1267   0.1578  -0.0302  -0.0492   0.0275   0.8799  -0.0465   0.0144
       0.0077   0.0174   0.8946  -0.0678   0.0149  -0.0054  -0.0483   0.1416  -0.0202   0.1528  -0.1108  -0.0135  -0.0275  -0.0088  -0.0984  -0.0409
       0.0732  -0.0848   0.0023   0.8993   0.0297  -0.0345  -0.0570   0.0309  -0.0613   0.0200  -0.1042  -0.0460  -0.0830   0.0533  -0.0093   0.0040
    
    
    
    
--- Iterative MLGST: Iter 1 of 2  907 gate strings ---: 
  --- Minimum Chi^2 GST ---
  Memory limit = 3.00GB
  Cur, Persist, Gather = 0.12, 0.04, 0.30 GB
    Evaltree generation (default) w/mem limit = 2.54GB
     mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 2.80GB (2.80GB fc)
    Created evaluation tree with 1 subtrees.  Will divide 1 procs into 1 (subtree-processing)
     groups of ~1 procs each, to distribute over 1616 params (taken as 2 param groups of ~808 params).
     Memory estimate = 1.40GB (cache=907, wrtLen1=808, wrtLen2=1616, subsPerProc=1).
    --- Outer Iter 0: norm_f = 5353.31, mu=0, |J|=10846.6
    --- Outer Iter 1: norm_f = 1889.81, mu=2766.39, |J|=10923.8
    --- Outer Iter 2: norm_f = 1574.84, mu=922.13, |J|=10686.3
    --- Outer Iter 3: norm_f = 1472.63, mu=307.377, |J|=10638.1
    --- Outer Iter 4: norm_f = 1429.17, mu=102.459, |J|=10634.4
    --- Outer Iter 5: norm_f = 1413.85, mu=34.153, |J|=10644.7
    --- Outer Iter 6: norm_f = 1410.26, mu=11.3843, |J|=10653.5
    --- Outer Iter 7: norm_f = 1409.73, mu=3.79477, |J|=10656.6
    --- Outer Iter 8: norm_f = 1409.69, mu=1.26492, |J|=10657.4
    --- Outer Iter 9: norm_f = 1409.69, mu=0.421641, |J|=10657.6
    Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06
  Finding num_nongauge_params is too expensive: using total params.
  Sum of Chi^2 = 1409.69 (2721 data params - 1616 model params = expected mean of 1105; p-value = 1.11522e-09)
  Completed in 478.4s
  2*Delta(log(L)) = 1414.05
  Iteration 1 took 479.0s
  
--- Iterative MLGST: Iter 2 of 2  1317 gate strings ---: 
  --- Minimum Chi^2 GST ---
  Memory limit = 3.00GB
  Cur, Persist, Gather = 0.22, 0.06, 0.29 GB
    Evaltree generation (default) w/mem limit = 2.43GB
     mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 4.06GB (4.06GB fc)
    Created evaluation tree with 1 subtrees.  Will divide 1 procs into 1 (subtree-processing)
     groups of ~1 procs each, to distribute over 1616 params (taken as 2 param groups of ~808 params).
     Memory estimate = 2.03GB (cache=1317, wrtLen1=808, wrtLen2=1616, subsPerProc=1).
    --- Outer Iter 0: norm_f = 4313.99, mu=0, |J|=12584.2
    --- Outer Iter 1: norm_f = 3338.97, mu=3409.33, |J|=12505.4
    --- Outer Iter 2: norm_f = 2986.93, mu=1136.44, |J|=12509
    --- Outer Iter 3: norm_f = 2822.63, mu=378.815, |J|=12509.9
    --- Outer Iter 4: norm_f = 2761.56, mu=126.272, |J|=12511.9
    --- Outer Iter 5: norm_f = 2746.35, mu=42.0905, |J|=12513.1
    --- Outer Iter 6: norm_f = 2744.04, mu=14.0302, |J|=12512.7
    --- Outer Iter 7: norm_f = 2743.83, mu=4.67672, |J|=12512.6
    --- Outer Iter 8: norm_f = 2743.82, mu=1.55891, |J|=12512.6
    Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06
  Finding num_nongauge_params is too expensive: using total params.
  Sum of Chi^2 = 2743.82 (3951 data params - 1616 model params = expected mean of 2335; p-value = 6.94799e-09)
  Completed in 394.4s
  2*Delta(log(L)) = 2754.12
  Iteration 2 took 395.5s
  
  Switching to ML objective (last iteration)
  --- MLGST ---
  Memory: limit = 3.00GB(cur, persist, gthr = 0.24, 0.06, 0.29 GB)
    Evaltree generation (default) w/mem limit = 2.40GB
     mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 4.06GB (4.06GB fc)
    Created evaluation tree with 1 subtrees.  Will divide 1 procs into 1 (subtree-processing)
     groups of ~1 procs each, to distribute over 1616 params (taken as 2 param groups of ~808 params).
     Memory estimate = 2.03GB (cache=1317, wrtLen1=808, wrtLen2=1616, subsPerProc=1).
    --- Outer Iter 0: norm_f = 1377.06, mu=0, |J|=8329.12
    --- Outer Iter 1: norm_f = 1375.55, mu=1349.19, |J|=8599.91
    --- Outer Iter 2: norm_f = 1375.53, mu=1.70203e+06, |J|=9321.33
    --- Outer Iter 3: norm_f = 1375.48, mu=1.69568e+06, |J|=8337.01
    --- Outer Iter 4: norm_f = 1375.48, mu=1.36906e+07, |J|=8336.91
    Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06
  Finding num_nongauge_params is too expensive: using total params.
    Maximum log(L) = 1375.48 below upper bound of -2.95533e+06
      2*Delta(log(L)) = 2750.95 (3951 data params - 1616 model params = expected mean of 2335; p-value = 4.00106e-09)
    Completed in 208.6s
  2*Delta(log(L)) = 2750.95
  Final MLGST took 208.6s
  
Iterative MLGST Total Time: 1083.1s
  -- Adding Gauge Optimized (go0) --
--- Re-optimizing logl after robust data scaling ---
  --- MLGST ---
  Memory: limit = 3.00GB(cur, persist, gthr = 0.25, 0.06, 0.29 GB)
    Evaltree generation (default) w/mem limit = 2.40GB
     mem(1 subtrees, 1,1 param-grps, 1 proc-grps) in 0s = 4.06GB (4.06GB fc)
    Created evaluation tree with 1 subtrees.  Will divide 1 procs into 1 (subtree-processing)
     groups of ~1 procs each, to distribute over 1616 params (taken as 2 param groups of ~808 params).
     Memory estimate = 2.03GB (cache=1317, wrtLen1=808, wrtLen2=1616, subsPerProc=1).
    --- Outer Iter 0: norm_f = 1375.48, mu=0, |J|=8336.91
    Least squares message = Both actual and predicted relative reductions in the sum of squares are at most 1e-06
  Finding num_nongauge_params is too expensive: using total params.
    Maximum log(L) = 1375.48 below upper bound of -2.95533e+06
      2*Delta(log(L)) = 2750.95 (3951 data params - 1616 model params = expected mean of 2335; p-value = 4.00106e-09)
    Completed in 41.6s
  -- Adding Gauge Optimized (go0) --
Total time=0.314203 hours

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

The Results object returned from do_long_sequence_gst can be used to generate a "general" HTML report, just as in the 1-qubit case:

In [8]:
pygsti.report.create_standard_report(results, filename="example_files/easy_2q_report",
                                    title="Example 2Q-GST Report", verbosity=2)
*** Creating workspace ***
*** Generating switchboard ***
*** Generating tables ***
  targetSpamBriefTable                          took 0.069756 seconds
  targetGatesBoxTable                           took 0.113729 seconds
  datasetOverviewTable                          took 0.02392 seconds
  bestGatesetSpamParametersTable                took 0.000469 seconds
  bestGatesetSpamBriefTable                     took 0.077722 seconds
  bestGatesetSpamVsTargetTable                  took 1.355508 seconds
  bestGatesetGaugeOptParamsTable                took 0.000297 seconds
  bestGatesetGatesBoxTable                      took 0.111316 seconds
  bestGatesetChoiEvalTable                      took 0.295349 seconds
  bestGatesetDecompTable                        took 6.385372 seconds
  bestGatesetEvalTable                          took 0.014843 seconds
  bestGermsEvalTable                            took 0.009861 seconds
  bestGatesetVsTargetTable                      took 0.469874 seconds
/Users/enielse/research/pyGSTi/packages/pygsti/extras/rb/rbutils.py:382: UserWarning:

Predicted RB decay parameter / error rate may be unreliable:
Gateset is not (approximately) trace-preserving.

  bestGatesVsTargetTable_gv                     took 6.990236 seconds
  bestGatesVsTargetTable_gvgerms                took 0.184236 seconds
  bestGatesVsTargetTable_gi                     took 0.073512 seconds
  bestGatesVsTargetTable_gigerms                took 0.009031 seconds
  bestGatesVsTargetTable_sum                    took 6.856213 seconds
  bestGatesetErrGenBoxTable                     took 0.508674 seconds
  metadataTable                                 took 0.001133 seconds
  stdoutBlock                                   took 0.001183 seconds
  profilerTable                                 took 0.00072 seconds
  softwareEnvTable                              took 0.022966 seconds
  exampleTable                                  took 0.00817 seconds
  singleMetricTable_gv                          took 7.01703 seconds
  singleMetricTable_gi                          took 0.074872 seconds
  fiducialListTable                             took 0.000667 seconds
  prepStrListTable                              took 0.000309 seconds
  effectStrListTable                            took 0.000205 seconds
  colorBoxPlotKeyPlot                           took 0.013986 seconds
  germList2ColTable                             took 0.000202 seconds
  progressTable                                 took 2.681229 seconds
*** Generating plots ***
  gramBarPlot                                   took 0.147281 seconds
  progressBarPlot                               took 2.002607 seconds
  progressBarPlot_sum                           took 0.000216 seconds
  finalFitComparePlot                           took 1.020939 seconds
  bestEstimateColorBoxPlot                      took 4.73809 seconds
  bestEstimateTVDColorBoxPlot                   took 4.683939 seconds
  bestEstimateColorScatterPlot                  took 4.991277 seconds
  bestEstimateColorHistogram                    took 4.712245 seconds
  progressTable_scl                             took 7.8e-05 seconds
  progressBarPlot_scl                           took 5.8e-05 seconds
  bestEstimateColorBoxPlot_scl                  took 8.8e-05 seconds
  bestEstimateColorScatterPlot_scl              took 9.9e-05 seconds
  bestEstimateColorHistogram_scl                took 8.3e-05 seconds
  dataScalingColorBoxPlot                       took 6e-05 seconds
*** Merging into template file ***
  Rendering bestGatesetEvalTable                took 0.05512 seconds
  Rendering targetGatesBoxTable                 took 0.065936 seconds
  Rendering progressBarPlot_scl                 took 0.000477 seconds
  Rendering bestGatesVsTargetTable_gi           took 0.00352 seconds
  Rendering bestEstimateTVDColorBoxPlot         took 0.018732 seconds
  Rendering bestEstimateColorScatterPlot_scl    took 0.000662 seconds
  Rendering softwareEnvTable                    took 0.002411 seconds
  Rendering bestGatesetVsTargetTable            took 0.000854 seconds
  Rendering bestEstimateColorBoxPlot_scl        took 0.000608 seconds
  Rendering datasetOverviewTable                took 0.000553 seconds
  Rendering bestGatesVsTargetTable_sum          took 0.006147 seconds
  Rendering bestGatesetErrGenBoxTable           took 0.158547 seconds
  Rendering stdoutBlock                         took 0.000755 seconds
  Rendering progressTable_scl                   took 0.000507 seconds
  Rendering prepStrListTable                    took 0.002495 seconds
  Rendering profilerTable                       took 0.001271 seconds
  Rendering exampleTable                        took 0.004339 seconds
  Rendering bestGatesetSpamVsTargetTable        took 0.001954 seconds
  Rendering bestGatesVsTargetTable_gv           took 0.005387 seconds
  Rendering metricSwitchboard_gv                took 6.8e-05 seconds
  Rendering singleMetricTable_gv                took 0.007842 seconds
  Rendering metricSwitchboard_gi                took 5.8e-05 seconds
  Rendering targetSpamBriefTable                took 0.033334 seconds
  Rendering progressBarPlot_sum                 took 0.002098 seconds
  Rendering gramBarPlot                         took 0.002117 seconds
  Rendering colorBoxPlotKeyPlot                 took 0.008788 seconds
  Rendering progressBarPlot                     took 0.002165 seconds
  Rendering fiducialListTable                   took 0.003868 seconds
  Rendering finalFitComparePlot                 took 0.002323 seconds
  Rendering bestGatesetGaugeOptParamsTable      took 0.00072 seconds
  Rendering bestEstimateColorBoxPlot            took 0.014267 seconds
  Rendering bestEstimateColorHistogram          took 0.008428 seconds
  Rendering metadataTable                       took 0.003064 seconds
  Rendering bestEstimateColorScatterPlot        took 0.010434 seconds
  Rendering bestGatesetGatesBoxTable            took 0.115008 seconds
  Rendering dataScalingColorBoxPlot             took 0.000474 seconds
  Rendering topSwitchboard                      took 0.000113 seconds
  Rendering bestGatesetSpamParametersTable      took 0.001758 seconds
  Rendering progressTable                       took 0.002041 seconds
  Rendering bestGatesVsTargetTable_gvgerms      took 0.004367 seconds
  Rendering bestGatesVsTargetTable_gigerms      took 0.001651 seconds
  Rendering bestGatesetDecompTable              took 0.045453 seconds
  Rendering germList2ColTable                   took 0.001492 seconds
  Rendering bestGatesetSpamBriefTable           took 0.066916 seconds
  Rendering maxLSwitchboard1                    took 0.000102 seconds
  Rendering bestGatesetChoiEvalTable            took 0.067528 seconds
  Rendering bestGermsEvalTable                  took 0.043135 seconds
  Rendering effectStrListTable                  took 0.002114 seconds
  Rendering bestEstimateColorHistogram_scl      took 0.000524 seconds
  Rendering singleMetricTable_gi                took 0.005022 seconds
Output written to example_files/easy_2q_report directory
*** Report Generation Complete!  Total time 57.187s ***
Out[8]:
<pygsti.report.workspace.Workspace at 0x10cea2f28>

Now open example_files/easy_2q_report/main.html to see the results. You've run 2-qubit GST!

You can save the Results object for later by just pickling it:

In [9]:
import pickle
with open("example_files/easy_2q_results.pkl","wb") as pklfile:
        pickle.dump(results, pklfile)
In [ ]: