{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting started quickly with Gate Set Tomography" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `pygsti` package provides multiple levels of abstraction over the core Gate Set Tomography (GST) algorithms. This initial tutorial will show you how to work with `pygsti`'s highest level of abstraction to get you started using GST quickly. Subsequent tutorials will delve into the details of `pygsti` objects and algorithms, and how to use them in detail." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The `do_long_sequence_gst` driver function\n", "Let's first look at how to use the `do_long_sequence_gst` which combines all the steps of running typical GST algortithms into a single function. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Make print statements compatible with Python 2 and 3\n", "from __future__ import print_function\n", "\n", "#Set matplotlib backend: the ipython \"inline\" backend cannot pickle\n", "# figures, which is required for generating pyGSTi reports\n", "import matplotlib \n", "matplotlib.use('Agg')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Import the pygsti module (always do this)\n", "import pygsti" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### First, we need to specify what our desired gate set is, referred to as the \"target gateset\".\n", "Gate sets and other `pygsti` objects are constructed using routines within `pygsti.construction`, and so we construct a gateset by calling `pygsti.construction.build_gateset`:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Construct a target gateset\n", "gs_target = pygsti.construction.build_gateset([2], [('Q0',)], ['Gi', 'Gx', 'Gy'],\n", " [\"I(Q0)\", \"X(pi/2,Q0)\", \"Y(pi/2,Q0)\"],\n", " prepLabels=['rho0'], prepExpressions=[\"0\"],\n", " effectLabels=['E0'], effectExpressions=[\"1\"],\n", " spamdefs={'plus': ('rho0', 'E0'),\n", " 'minus': ('rho0', 'remainder')})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The parameters to `build_gateset`, specify:\n", " - The state space is dimension 2 (i.e. the density matrix is 2x2)\n", " \n", " - interpret this 2-dimensional space as that of a single qubit labeled \"Q0\" (label must begin with 'Q')\n", " \n", " - there are three gates: Idle, $\\pi/2$ x-rotation, $\\pi/2$ y-rotation, labeled `Gi`, `Gx`, and `Gy`.\n", " \n", " - there is one state prep operation, labeled `rho0`, which prepares the 0-state (the first basis element of the 2D state space)\n", " \n", " - there is one POVM (~ measurement), labeled `E0` that projects onto the 1-state (the second basis element of the 2D state space)\n", " \n", " - the name of the state-prep then measure our POVM is `plus`\n", " \n", " - the name of the state-prep then measure something other than our POVM is `minus` " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Reading from and writing to files is done mostly via routines in `pygsti.io`. To store this gateset in a file (for reference or to load it somewhere else), you just call `pygsti.io.write_gateset`:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Write it to a file\n", "pygsti.io.write_gateset(gs_target, \"tutorial_files/MyTargetGateset.txt\")\n", "\n", "#To load the gateset back into a python object, do:\n", "# gs_target = pygsti.io.load_gateset(\"tutorial_files/MyTargetGateset.txt\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Next, we need to create fiducial, germ, and max-length lists:\n", "These three lists will specify what experiments GST will use in its estimation procedure, and depend on the target gateset as well as the expected quality of the qubit being measured. They are:\n", "\n", "- fiducial gate strings (``fiducials``): gate sequences that immediately follow state preparation or immediately precede measurement.\n", "\n", "\n", "- germ gate strings (``germs``): gate sequences that are repeated to produce a string that is as close to some \"maximum length\" as possible without exceeding it.\n", "\n", "\n", "- maximum lengths (`maxLengths`): a list of maximum lengths used to specify the increasingly long gate sequences (via more germ repeats) used by each iteration of the GST estimation procedure.\n", "\n", "To make GST most effective, these gate strings lists should be computed. Typically this computation is done by the Sandia GST folks and the gate string lists are sent to you, though there is preliminary support within `pygsti` for computing these string lists directly. Here, we'll assume we have been given the lists. The maximum lengths list typically starts with [0,1] and then contains successive powers of two. The largest maximum length should roughly correspond to the number of gates ones qubit can perform before becoming depolarized beyond ones ability to measure anything other than the maximally mixed state. Since we're constructing gate string lists, the routines used are in `pygsti.construction`:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Create fiducial gate string lists\n", "fiducials = pygsti.construction.gatestring_list( [ (), ('Gx',), ('Gy',), ('Gx','Gx'), ('Gx','Gx','Gx'), ('Gy','Gy','Gy') ])\n", "\n", "#Create germ gate string lists\n", "germs = pygsti.construction.gatestring_list( [('Gx',), ('Gy',), ('Gi',), ('Gx', 'Gy',),\n", " ('Gx', 'Gy', 'Gi',), ('Gx', 'Gi', 'Gy',), ('Gx', 'Gi', 'Gi',), ('Gy', 'Gi', 'Gi',),\n", " ('Gx', 'Gx', 'Gi', 'Gy',), ('Gx', 'Gy', 'Gy', 'Gi',),\n", " ('Gx', 'Gx', 'Gy', 'Gx', 'Gy', 'Gy',)] )\n", "\n", "#Create maximum lengths list\n", "maxLengths = [0,1,2,4,8,16,32]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we want to, we can save these lists in files (but this is not necessary):" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "pygsti.io.write_gatestring_list(\"tutorial_files/MyFiducials.txt\", fiducials, \"My fiducial gate strings\")\n", "pygsti.io.write_gatestring_list(\"tutorial_files/MyGerms.txt\", germs, \"My germ gate strings\")\n", "\n", "import pickle\n", "pickle.dump( maxLengths, open(\"tutorial_files/MyMaxLengths.pkl\", \"wb\"))\n", "\n", "# To load these back into python lists, do:\n", "#fiducials = pygsti.io.load_gatestring_list(\"tutorial_files/MyFiducials.txt\")\n", "#germs = pygsti.io.load_gatestring_list(\"tutorial_files/MyGerms.txt\")\n", "#maxLengths = pickle.load( open(\"tutorial_files/MyMaxLengths.pkl\"))" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "#### Third, we generate (since we can't actually take) data and save a dataset\n", "Before experimental data is obtained, it is useful to create a \"template\" dataset file which specifies which gate sequences are required to run GST. Since we don't actually have an experiment for this example, we'll generate some \"fake\" experimental data from a set of gates that are just depolarized versions of the targets. First we construct the list of experiments used by GST using `make_lsgst_experiment_list`, and use the result to specify which experiments to simulate. The abbreviation \"LSGST\" (lowercase in function names to follow Python naming conventions) stands for \"Long Sequence Gate Set Tomography\", and refers to the more powerful flavor of GST that utilizes long sequences to find gate set estimates. LSGST can be compared to Linear GST, or \"LGST\", which only uses short sequences and as a result provides much less accurate estimates." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Create a list of GST experiments for this gateset, with\n", "#the specified fiducials, germs, and maximum lengths\n", "listOfExperiments = pygsti.construction.make_lsgst_experiment_list(gs_target.gates.keys(),\n", " fiducials, fiducials, germs, maxLengths)\n", "\n", "#Create an empty dataset file, which stores the list of experiments\n", "#plus extra columns where data can be inserted\n", "pygsti.io.write_empty_dataset(\"tutorial_files/MyDataTemplate.txt\", listOfExperiments,\n", " \"## Columns = plus count, count total\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since we don't actually have a experiment to generate real data, let's now create and save a dataset using depolarized target gates and spam operations:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Create a gateset of depolarized gates and SPAM relative to target, and generate fake data using this gateset.\n", "gs_datagen = gs_target.depolarize(gate_noise=0.1, spam_noise=0.001)\n", "ds = pygsti.construction.generate_fake_data(gs_datagen, listOfExperiments, nSamples=1000,\n", " sampleError=\"binomial\", seed=2015)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We could at this point just use the generated dataset directly, but let's save it as though it were a file filled with experimental results." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Save our dataset\n", "pygsti.io.write_dataset(\"tutorial_files/MyDataset.txt\", ds)\n", "\n", "#Note; to load the dataset back again, do:\n", "#ds = pygsti.io.load_dataset(\"tutorial_files/MyDataset.txt\")" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "#### Fourth, we call the Analysis function\n", "Now we're all set to call the driver routine. All of the possible arguments to this function are detailed in the included help (docstring), and so here we just make a few remarks:\n", "- For many of the arguments, you can supply either a filename or a python object (e.g. dataset, target gateset, gate string lists).\n", "\n", "\n", "- `fiducials` is supplied twice since the state preparation fiducials (those sequences following a state prep) need not be the same as the measurement fiducials (those sequences preceding a measurement).\n", "\n", "\n", "- Typically we want to constrain the resulting gates to be trace-preserving. This is accomplished by the call to `set_all_parameterizations(\"TP\")`, which restricts `gs_target` to only describing TP gates (see more on this in later tutorials).\n", "\n", "\n", "- `gaugeOptParams` specifies a dictionary of parameters ultimately to be passed to the `gaugeopt_to_target` function (which provides full documentation). We set the ratio of the state preparation and measurement (SPAM) weighting to the gate weighting when performing a gauge optimization. When this is set as below, the gate parameters are weighted 1000 times more relative to the SPAM parameters. Mathematically this corresponds to a multiplicative factor of 0.001 preceding the sum-of-squared-difference terms corresponding to SPAM elements in the gateset. Typically it is good to weight the gates parameters more heavily since GST amplifies gate parameter errors via long gate sequences but cannot amplify SPAM parameter errors. If unsure, 0.001 is a good value to start with." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading tutorial_files/MyDataset.txt: 100%\n", "Writing cache file (to speed future loads): tutorial_files/MyDataset.txt.cache\n", "--- LGST ---\n", " Singular values of I_tilde (truncating to first 4 of 6) = \n", " 4.24630617076\n", " 1.15648754295\n", " 0.95999512855\n", " 0.941028780281\n", " 0.0452423314618\n", " 0.0262637861406\n", " \n", " Singular values of target I_tilde (truncating to first 4 of 6) = \n", " 4.24264068712\n", " 1.41421356237\n", " 1.41421356237\n", " 1.41421356237\n", " 3.3483200348e-16\n", " 2.72548486209e-16\n", " \n", "--- Iterative MLGST: Iter 1 of 7 92 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 61.3616 (92 data params - 31 model params = expected mean of 61; p-value = 0.462934)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 61.4796\n", " Iteration 1 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 2 of 7 92 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 61.3616 (92 data params - 31 model params = expected mean of 61; p-value = 0.462934)\n", " Completed in 0.0s\n", " 2*Delta(log(L)) = 61.4796\n", " Iteration 2 took 0.0s\n", " \n", "--- Iterative MLGST: Iter 3 of 7 168 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 127.73 (168 data params - 31 model params = expected mean of 137; p-value = 0.702867)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 127.973\n", " Iteration 3 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 4 of 7 441 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 387.654 (441 data params - 31 model params = expected mean of 410; p-value = 0.779828)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 387.414\n", " Iteration 4 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 5 of 7 817 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 778.59 (817 data params - 31 model params = expected mean of 786; p-value = 0.567748)\n", " Completed in 0.2s\n", " 2*Delta(log(L)) = 777.903\n", " Iteration 5 took 0.2s\n", " \n", "--- Iterative MLGST: Iter 6 of 7 1201 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 1204.48 (1201 data params - 31 model params = expected mean of 1170; p-value = 0.235874)\n", " Completed in 0.3s\n", " 2*Delta(log(L)) = 1204.08\n", " Iteration 6 took 0.3s\n", " \n", "--- Iterative MLGST: Iter 7 of 7 1585 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 1585.47 (1585 data params - 31 model params = expected mean of 1554; p-value = 0.283448)\n", " Completed in 0.4s\n", " 2*Delta(log(L)) = 1585.17\n", " Iteration 7 took 0.4s\n", " \n", " Switching to ML objective (last iteration)\n", " --- MLGST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Maximum log(L) = 792.537 below upper bound of -2.65052e+06\n", " 2*Delta(log(L)) = 1585.07 (1585 data params - 31 model params = expected mean of 1554; p-value = 0.28582)\n", " Completed in 0.3s\n", " 2*Delta(log(L)) = 1585.07\n", " Final MLGST took 0.3s\n", " \n", "Iterative MLGST Total Time: 1.5s\n" ] } ], "source": [ "gs_target.set_all_parameterizations(\"TP\")\n", "results = pygsti.do_long_sequence_gst(\"tutorial_files/MyDataset.txt\", gs_target, \n", " fiducials, fiducials, germs, maxLengths,\n", " gaugeOptParams={'itemWeights': {'spam': 1e-3, 'gates': 1.0}})" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "rho0 = 0.7071 0.0005 -0.0043 0.7049\n", "\n", "\n", "E0 = 0.7073 -0.0008 -0.0052 -0.7065\n", "\n", "\n", "Gi = \n", " 1.0000 0 0 0\n", " -0.0006 0.9009 -0.0040 0.0023\n", " -0.0004 0.0010 0.8982 -0.0007\n", " -0.0002 -0.0023 0.0002 0.8948\n", "\n", "\n", "Gx = \n", " 1.0000 0 0 0\n", " -0.0004 0.8986 -0.0012 -0.0013\n", " -0.0003 0.0020 -0.0039 -0.9021\n", " -0.0003 -0.0019 0.9021 0.0032\n", "\n", "\n", "Gy = \n", " 1.0000 0 0 0\n", " -0.0002 0.0015 -0.0049 0.9022\n", " 0.0003 -0.0016 0.8976 -0.0056\n", " 0.0004 -0.9022 0.0023 0.0014\n", "\n", "\n", "\n" ] } ], "source": [ "import pickle\n", "s = pickle.dumps(results)\n", "r2 = pickle.loads(s)\n", "print(r2.gatesets['final estimate'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The analysis routine returns a `pygsti.report.Results` object which encapsulates intermediate and final GST estimates, as well as quantities derived from these \"raw\" estimates. (The object also caches derived quantities so that repeated queries for the same quanties do not require recalculation.) Finally, a `Results` object can generate reports and presentations containing many of the raw and derived GST results. We give examples of these uses below. " ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "rho0 = 0.7071 0.0005 -0.0043 0.7049\n", "\n", "\n", "E0 = 0.7073 -0.0008 -0.0052 -0.7065\n", "\n", "\n", "Gi = \n", " 1.0000 0 0 0\n", " -0.0006 0.9009 -0.0040 0.0023\n", " -0.0004 0.0010 0.8982 -0.0007\n", " -0.0002 -0.0023 0.0002 0.8948\n", "\n", "\n", "Gx = \n", " 1.0000 0 0 0\n", " -0.0004 0.8986 -0.0012 -0.0013\n", " -0.0003 0.0020 -0.0039 -0.9021\n", " -0.0003 -0.0019 0.9021 0.0032\n", "\n", "\n", "Gy = \n", " 1.0000 0 0 0\n", " -0.0002 0.0015 -0.0049 0.9022\n", " 0.0003 -0.0016 0.8976 -0.0056\n", " 0.0004 -0.9022 0.0023 0.0014\n", "\n", "\n", "\n" ] } ], "source": [ "# Access to raw GST best gateset estimate\n", "print(results.gatesets['final estimate'])" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " \n", "--- Hessian Projector Optimization for gate CIs (L-BFGS-B) ---\n", " 9s 0.0278965544\n", " 13s 0.0276337987\n", " 18s 0.0276079370\n", " 22s 0.0275908338\n", " 27s 0.0275853884\n", " 32s 0.0275844490\n", " The resulting min sqrt(sum(gateCIs**2)): 0.0275844\n", "*** Generating tables ***\n", " Iter 01 of 19 : Generating table: targetSpamTable (w/95% CIs) [0.0s]\n", " Iter 02 of 19 : Generating table: targetGatesTable (w/95% CIs) [0.0s]\n", " Iter 03 of 19 : Generating table: datasetOverviewTable (w/95% CIs) [0.0s]\n", " Iter 04 of 19 : Generating table: bestGatesetSpamTable (w/95% CIs) [0.0s]\n", " Iter 05 of 19 : Generating table: bestGatesetSpamParametersTable (w/95% CIs) [0.0s]\n", " Iter 06 of 19 : Generating table: bestGatesetGaugeOptParamsTable (w/95% CIs) [0.0s]\n", " Iter 07 of 19 : Generating table: bestGatesetGatesTable (w/95% CIs) [0.0s]\n", " Iter 08 of 19 : Generating table: bestGatesetChoiTable (w/95% CIs) [0.2s]\n", " Iter 09 of 19 : Generating table: bestGatesetDecompTable (w/95% CIs) [0.2s]\n", " Iter 10 of 19 : Generating table: bestGatesetRotnAxisTable (w/95% CIs) [0.3s]\n", " Iter 11 of 19 : Generating table: bestGatesetVsTargetTable (w/95% CIs) [1.2s]\n", " Iter 12 of 19 : Generating table: bestGatesetErrorGenTable (w/95% CIs) [0.0s]\n", " Iter 13 of 19 : Generating table: metadataTable (w/95% CIs) Generating table: metadataTable [0.0s]\n", " Iter 14 of 19 : Generating table: softwareEnvTable (w/95% CIs) Generating table: softwareEnvTable [0.2s]\n", " Iter 15 of 19 : Generating table: fiducialListTable (w/95% CIs) [0.0s]\n", " Iter 16 of 19 : Generating table: prepStrListTable (w/95% CIs) [0.0s]\n", " Iter 17 of 19 : Generating table: effectStrListTable (w/95% CIs) [0.0s]\n", " Iter 18 of 19 : Generating table: germListTable (w/95% CIs) [0.0s]\n", " Iter 19 of 19 : Generating table: progressTable (w/95% CIs) [0.2s]\n", "*** Generating plots ***\n", "LogL plots (2): \n", " Iter 1 of 3 : Generating figure: colorBoxPlotKeyPlot (w/95% CIs) Generating figure: colorBoxPlotKeyPlot [0.8s]\n", " Iter 2 of 3 : Generating figure: bestEstimateColorBoxPlot (w/95% CIs) Generating figure: bestEstimateColorBoxPlot [9.6s]\n", " Iter 3 of 3 : Generating figure: invertedBestEstimateColorBoxPlot (w/95% CIs) Generating figure: invertedBestEstimateColorBoxPlot [9.2s]\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/easy_full.pdf successfully generated.\n", "Final output PDF tutorial_files/easy_full.pdf successfully generated. Cleaning up .aux and .log files.\n" ] } ], "source": [ "#create a full GST report (most detailed and pedagogical; best for those getting familiar with GST)\n", "results.create_full_report_pdf(confidenceLevel=95, filename=\"tutorial_files/easy_full.pdf\", verbosity=2)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "*** Generating tables ***\n", " Retrieving cached table: bestGatesetSpamTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetSpamParametersTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetGatesTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetDecompTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetRotnAxisTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetVsTargetTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetErrorGenTable (w/95% CIs)\n", " Retrieving cached table: progressTable (w/95% CIs)\n", "*** Generating plots ***\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/easy_brief.pdf successfully generated.\n", "Final output PDF tutorial_files/easy_brief.pdf successfully generated. Cleaning up .aux and .log files.\n" ] } ], "source": [ "#create a brief GST report (just highlights of full report but fast to generate; best for folks familiar with GST)\n", "results.create_brief_report_pdf(confidenceLevel=95, filename=\"tutorial_files/easy_brief.pdf\", verbosity=2)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "*** Generating tables ***\n", " Retrieving cached table: targetSpamTable (w/95% CIs)\n", " Retrieving cached table: targetGatesTable (w/95% CIs)\n", " Retrieving cached table: datasetOverviewTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetSpamTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetSpamParametersTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetGatesTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetChoiTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetDecompTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetRotnAxisTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetVsTargetTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetErrorGenTable (w/95% CIs)\n", " Retrieving cached table: fiducialListTable (w/95% CIs)\n", " Retrieving cached table: prepStrListTable (w/95% CIs)\n", " Retrieving cached table: effectStrListTable (w/95% CIs)\n", " Retrieving cached table: germListTable (w/95% CIs)\n", " Retrieving cached table: progressTable (w/95% CIs)\n", "*** Generating plots ***\n", " -- LogL plots (1): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot (w/95% CIs)\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/easy_slides.pdf successfully generated.\n", "Final output PDF tutorial_files/easy_slides.pdf successfully generated. Cleaning up .aux and .log files.\n" ] } ], "source": [ "#create GST slides (tables and figures of full report in latex-generated slides; best for folks familiar with GST)\n", "results.create_presentation_pdf(confidenceLevel=95, filename=\"tutorial_files/easy_slides.pdf\", verbosity=2)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "*** Generating tables ***\n", " Iter 01 of 16 : Retrieving cached table: targetSpamTable (w/95% CIs)\n", " Iter 02 of 16 : Retrieving cached table: targetGatesTable (w/95% CIs)\n", " Iter 03 of 16 : Retrieving cached table: datasetOverviewTable (w/95% CIs)\n", " Iter 04 of 16 : Retrieving cached table: bestGatesetSpamTable (w/95% CIs)\n", " Iter 05 of 16 : Retrieving cached table: bestGatesetSpamParametersTable (w/95% CIs)\n", " Iter 06 of 16 : Retrieving cached table: bestGatesetGatesTable (w/95% CIs)\n", " Iter 07 of 16 : Retrieving cached table: bestGatesetChoiTable (w/95% CIs)\n", " Iter 08 of 16 : Retrieving cached table: bestGatesetDecompTable (w/95% CIs)\n", " Iter 09 of 16 : Retrieving cached table: bestGatesetRotnAxisTable (w/95% CIs)\n", " Iter 10 of 16 : Retrieving cached table: bestGatesetVsTargetTable (w/95% CIs)\n", " Iter 11 of 16 : Retrieving cached table: bestGatesetErrorGenTable (w/95% CIs)\n", " Iter 12 of 16 : Retrieving cached table: fiducialListTable (w/95% CIs)\n", " Iter 13 of 16 : Retrieving cached table: prepStrListTable (w/95% CIs)\n", " Iter 14 of 16 : Retrieving cached table: effectStrListTable (w/95% CIs)\n", " Iter 15 of 16 : Retrieving cached table: germListTable (w/95% CIs)\n", " Iter 16 of 16 : Retrieving cached table: progressTable (w/95% CIs)\n", "*** Generating plots ***\n", " -- LogL plots (1): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot (w/95% CIs)\n", "\n", "*** Assembling PPT file ***\n", "Latexing progressTable table...\n", "Latexing bestGatesetVsTargetTable table...\n", "Latexing bestGatesetErrorGenTable table...\n", "Latexing bestGatesetDecompTable table...\n", "Latexing bestGatesetRotnAxisTable table...\n", "Latexing bestGatesetGatesTable table...\n", "Latexing bestGatesetSpamTable table...\n", "Latexing bestGatesetSpamParametersTable table...\n", "Latexing bestGatesetChoiTable table...\n", "Latexing targetSpamTable table...\n", "Latexing targetGatesTable table...\n", "Latexing fiducialListTable table...\n", "Latexing germListTable table...\n", "Latexing datasetOverviewTable table...\n", "Final output PPT tutorial_files/easy_slides.pptx successfully generated.\n" ] } ], "source": [ "#create GST slides (tables and figures of full report in Powerpoint slides; best for folks familiar with GST)\n", "#Requires python-pptx and ImageMagick to be installed\n", "results.create_presentation_ppt(confidenceLevel=95, filename=\"tutorial_files/easy_slides.pptx\", verbosity=2)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "If all has gone well, the above lines have produced the four primary types of reports `pygsti` is capable of generating:\n", "- A \"full\" report, [tutorial_files/easy_full.pdf](tutorial_files/easy_full.pdf). This is the most detailed and pedagogical of the reports, and is best for those getting familiar with GST.\n", "\n", "\n", "- A \"brief\" report, [tutorial_files/easy_brief.pdf](tutorial_files/easy_brief.pdf). This Contains just the highlights of the full report but much faster to generate, and is best for folks familiar with GST.\n", "\n", "\n", "- PDF slides, [tutorial_files/easy_slides.pdf](tutorial_files/easy_slides.pdf). These slides contain tables and figures of the full report in LaTeX-generated (via `beamer`) slides, and is best for folks familiar with GST who want to show other people their great results.\n", "\n", "\n", "- PPT slides, [tutorial_files/easy_slides.pptx](tutorial_files/easy_slides.pptx). These slides contain the same information as PDF slides, but in MS Powerpoint format. These slides won't look as nice as the PDF ones, but can be used for merciless copying and pasting into your other Powerpoint presentations... :)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Speeding things up by using Standard constructions\n", "A significant component of running GST as show above is constructing things: the target gateset, the fiducial, germ, and maximum-length lists, etc. We've found that many people who use GST have one of only a few different target gatesets, and for these commonly used target gatesets we've created modules that perform most of the constructions for you. If you gateset isn't one of these standard ones then you'll have to follow the above approach for now, but please let us know and we'll try to add a module for your gateset in the future." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The standard construction modules are located under `pygsti.construction` (surprise, surprise) and are prefixed with \"`std`\". In the example above, our gateset (comprised of single qubit $I$, X($\\pi/2$), and Y($\\pi/2$) gates) is one of the commonly used gatesets, and relevant constructions are importable via:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Import the \"stardard 1-qubit quantities for a gateset with X(pi/2), Y(pi/2), and idle gates\"\n", "from pygsti.construction import std1Q_XYI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We follow the same order of constructing things as above, but it's much easier since almost everything has been constructed already:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": true }, "outputs": [], "source": [ "gs_target = std1Q_XYI.gs_target\n", "fiducials = std1Q_XYI.fiducials\n", "germs = std1Q_XYI.germs\n", "maxLengths = [0,1,2,4,8,16,32] #still need to define this manually" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We generate a fake dataset as before:" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [], "source": [ "gs_datagen = gs_target.depolarize(gate_noise=0.1, spam_noise=0.001)\n", "listOfExperiments = pygsti.construction.make_lsgst_experiment_list(gs_target.gates.keys(), fiducials, fiducials, germs, maxLengths)\n", "ds = pygsti.construction.generate_fake_data(gs_datagen, listOfExperiments, nSamples=1000000,\n", " sampleError=\"binomial\", seed=1234)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And run the analysis function (this time using the dataset object directly instead of loading from a file), and then create a report in the specified file." ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- LGST ---\n", " Singular values of I_tilde (truncating to first 4 of 6) = \n", " 4.24409810599\n", " 1.16704609919\n", " 0.946915237\n", " 0.943164947695\n", " 0.00230163583615\n", " 0.000699324004315\n", " \n", " Singular values of target I_tilde (truncating to first 4 of 6) = \n", " 4.24264068712\n", " 1.41421356237\n", " 1.41421356237\n", " 1.41421356237\n", " 3.3483200348e-16\n", " 2.72548486209e-16\n", " \n", "--- Iterative MLGST: Iter 1 of 7 92 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 65.4588 (92 data params - 31 model params = expected mean of 61; p-value = 0.32481)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 65.4654\n", " Iteration 1 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 2 of 7 92 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 65.4588 (92 data params - 31 model params = expected mean of 61; p-value = 0.32481)\n", " Completed in 0.0s\n", " 2*Delta(log(L)) = 65.4654\n", " Iteration 2 took 0.0s\n", " \n", "--- Iterative MLGST: Iter 3 of 7 168 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 136.541 (168 data params - 31 model params = expected mean of 137; p-value = 0.495)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 136.546\n", " Iteration 3 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 4 of 7 441 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 409.627 (441 data params - 31 model params = expected mean of 410; p-value = 0.495914)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 409.632\n", " Iteration 4 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 5 of 7 817 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 753.34 (817 data params - 31 model params = expected mean of 786; p-value = 0.793481)\n", " Completed in 0.2s\n", " 2*Delta(log(L)) = 753.354\n", " Iteration 5 took 0.2s\n", " \n", "--- Iterative MLGST: Iter 6 of 7 1201 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 1165.78 (1201 data params - 31 model params = expected mean of 1170; p-value = 0.52932)\n", " Completed in 0.3s\n", " 2*Delta(log(L)) = 1165.8\n", " Iteration 6 took 0.3s\n", " \n", "--- Iterative MLGST: Iter 7 of 7 1585 gate strings ---: \n", " --- Minimum Chi^2 GST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Sum of Chi^2 = 1572.66 (1585 data params - 31 model params = expected mean of 1554; p-value = 0.364955)\n", " Completed in 0.3s\n", " 2*Delta(log(L)) = 1572.68\n", " Iteration 7 took 0.4s\n", " \n", " Switching to ML objective (last iteration)\n", " --- MLGST ---\n", " Created evaluation tree with 1 subtrees. Will divide 1 procs into 1 (subtree-processing)\n", " groups of ~1 procs each, to distribute over 43 params (taken as 1 param groups of ~43 params).\n", " Maximum log(L) = 786.341 below upper bound of -2.65149e+09\n", " 2*Delta(log(L)) = 1572.68 (1585 data params - 31 model params = expected mean of 1554; p-value = 0.364782)\n", " Completed in 0.2s\n", " 2*Delta(log(L)) = 1572.68\n", " Final MLGST took 0.2s\n", " \n", "Iterative MLGST Total Time: 1.3s\n", " \n", "--- Hessian Projector Optimization for gate CIs (L-BFGS-B) ---\n", " 9s 0.0008805701\n", " 13s 0.0008720898\n", " 18s 0.0008712748\n", " The resulting min sqrt(sum(gateCIs**2)): 0.000871275\n", "*** Generating tables ***\n", " Iter 01 of 19 : Generating table: targetSpamTable (w/95% CIs) [0.0s]\n", " Iter 02 of 19 : Generating table: targetGatesTable (w/95% CIs) [0.0s]\n", " Iter 03 of 19 : Generating table: datasetOverviewTable (w/95% CIs) [0.0s]\n", " Iter 04 of 19 : Generating table: bestGatesetSpamTable (w/95% CIs) [0.0s]\n", " Iter 05 of 19 : Generating table: bestGatesetSpamParametersTable (w/95% CIs) [0.0s]\n", " Iter 06 of 19 : Generating table: bestGatesetGaugeOptParamsTable (w/95% CIs) [0.0s]\n", " Iter 07 of 19 : Generating table: bestGatesetGatesTable (w/95% CIs) [0.0s]\n", " Iter 08 of 19 : Generating table: bestGatesetChoiTable (w/95% CIs) [0.2s]\n", " Iter 09 of 19 : Generating table: bestGatesetDecompTable (w/95% CIs) [0.2s]\n", " Iter 10 of 19 : Generating table: bestGatesetRotnAxisTable (w/95% CIs) [0.3s]\n", " Iter 11 of 19 : Generating table: bestGatesetVsTargetTable (w/95% CIs) [1.1s]\n", " Iter 12 of 19 : Generating table: bestGatesetErrorGenTable (w/95% CIs) [0.0s]\n", " Iter 13 of 19 : Generating table: metadataTable (w/95% CIs) Generating table: metadataTable [0.0s]\n", " Iter 14 of 19 : Generating table: softwareEnvTable (w/95% CIs) Generating table: softwareEnvTable [0.0s]\n", " Iter 15 of 19 : Generating table: fiducialListTable (w/95% CIs) [0.0s]\n", " Iter 16 of 19 : Generating table: prepStrListTable (w/95% CIs) [0.0s]\n", " Iter 17 of 19 : Generating table: effectStrListTable (w/95% CIs) [0.0s]\n", " Iter 18 of 19 : Generating table: germListTable (w/95% CIs) [0.0s]\n", " Iter 19 of 19 : Generating table: progressTable (w/95% CIs) [0.2s]\n", "*** Generating plots ***\n", "LogL plots (2): \n", " Iter 1 of 3 : Generating figure: colorBoxPlotKeyPlot (w/95% CIs) Generating figure: colorBoxPlotKeyPlot [0.7s]\n", " Iter 2 of 3 : Generating figure: bestEstimateColorBoxPlot (w/95% CIs) Generating figure: bestEstimateColorBoxPlot [9.9s]\n", " Iter 3 of 3 : Generating figure: invertedBestEstimateColorBoxPlot (w/95% CIs) Generating figure: invertedBestEstimateColorBoxPlot [9.2s]\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/MyEvenEasierReport.pdf successfully generated.\n", "Final output PDF tutorial_files/MyEvenEasierReport.pdf successfully generated. Cleaning up .aux and .log files.\n" ] } ], "source": [ "gs_target.set_all_parameterizations(\"TP\")\n", "results = pygsti.do_long_sequence_gst(ds, gs_target, fiducials, fiducials, germs, maxLengths)\n", "results.create_full_report_pdf(confidenceLevel=95,filename=\"tutorial_files/MyEvenEasierReport.pdf\",verbosity=2)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "Now open [tutorial_files/MyEvenEasierReport.pdf](tutorial_files/MyEvenEasierReport.pdf) to see the results. You've just run GST (again)!" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "----------------------------------------------------------\n", "---------------- pyGSTi Results Object -------------------\n", "----------------------------------------------------------\n", "\n", "I can create reports for you directly, via my create_XXX\n", "functions, or you can query me for result data via members:\n", "\n", " .dataset -- the DataSet used to generate these results\n", "\n", " .gatesets -- a dictionary of GateSet objects w/keys:\n", " ---------------------------------------------------------\n", " target\n", " final estimate\n", " iteration estimates pre gauge opt\n", " seed\n", " iteration estimates\n", "\n", " .gatestring_lists -- a dict of GateString lists w/keys:\n", " ---------------------------------------------------------\n", " effect fiducials\n", " final\n", " iteration delta\n", " iteration\n", " all\n", " germs\n", " prep fiducials\n", "\n", " .tables -- a dict of ReportTable objects w/keys:\n", " ---------------------------------------------------------\n", " blankTable\n", " targetSpamTable\n", " targetSpamBriefTable\n", " targetGatesTable\n", " datasetOverviewTable\n", " fiducialListTable\n", " prepStrListTable\n", " effectStrListTable\n", " germListTable\n", " germList2ColTable\n", " bestGatesetSpamTable\n", " bestGatesetSpamBriefTable\n", " bestGatesetSpamParametersTable\n", " bestGatesetGatesTable\n", " bestGatesetChoiTable\n", " bestGatesetDecompTable\n", " bestGatesetRotnAxisTable\n", " bestGatesetEvalTable\n", " bestGatesetClosestUnitaryTable\n", " bestGatesetVsTargetTable\n", " gaugeOptGatesetsVsTargetTable\n", " gaugeOptCPTPGatesetChoiTable\n", " bestGatesetSpamVsTargetTable\n", " bestGatesetErrorGenTable\n", " bestGatesetVsTargetAnglesTable\n", " bestGatesetGaugeOptParamsTable\n", " chi2ProgressTable\n", " logLProgressTable\n", " progressTable\n", " byGermTable\n", " logLErrgenProjectionTable\n", " targetGatesBoxTable\n", " bestGatesetGatesBoxTable\n", " bestGatesetErrGenBoxTable\n", " bestGatesetErrGenProjectionTargetMetricsTable\n", " bestGatesetErrGenProjectionSelfMetricsTable\n", " bestGatesetRelEvalTable\n", " bestGatesetChoiEvalTable\n", " hamiltonianProjectorTable\n", " stochasticProjectorTable\n", " metadataTable\n", " softwareEnvTable\n", "\n", " .figures -- a dict of ReportFigure objects w/keys:\n", " ---------------------------------------------------------\n", " colorBoxPlotKeyPlot\n", " bestEstimateColorBoxPlot\n", " invertedBestEstimateColorBoxPlot\n", " bestEstimateSummedColorBoxPlot\n", " estimateForLIndex0ColorBoxPlot\n", " estimateForLIndex1ColorBoxPlot\n", " estimateForLIndex2ColorBoxPlot\n", " estimateForLIndex3ColorBoxPlot\n", " estimateForLIndex4ColorBoxPlot\n", " estimateForLIndex5ColorBoxPlot\n", " estimateForLIndex6ColorBoxPlot\n", " blankBoxPlot\n", " blankSummedBoxPlot\n", " directLGSTColorBoxPlot\n", " directLongSeqGSTColorBoxPlot\n", " directLGSTDeviationColorBoxPlot\n", " directLongSeqGSTDeviationColorBoxPlot\n", " smallEigvalErrRateColorBoxPlot\n", " whackGxMoleBoxes\n", " whackGyMoleBoxes\n", " whackGiMoleBoxes\n", " whackGxMoleBoxesSummed\n", " whackGyMoleBoxesSummed\n", " whackGiMoleBoxesSummed\n", " bestGateErrGenBoxesGi\n", " bestGateErrGenBoxesGx\n", " bestGateErrGenBoxesGy\n", " targetGateBoxesGi\n", " targetGateBoxesGx\n", " targetGateBoxesGy\n", " bestEstimatePolarGiEvalPlot\n", " bestEstimatePolarGxEvalPlot\n", " bestEstimatePolarGyEvalPlot\n", "\n", " .parameters -- a dict of simulation parameters:\n", " ---------------------------------------------------------\n", " check\n", " cptpPenaltyFactor\n", " useFreqWeightedChiSq\n", " starting point\n", " maxIterations\n", " defaultDirectory\n", " radius\n", " minProbClipForWeighting\n", " profile\n", " objective\n", " truncScheme\n", " minProbClip\n", " fiducial pairs\n", " gaugeOptParams\n", " depolarizeStart\n", " profiler\n", " defaultBasename\n", " memLimit\n", " linlogPercentile\n", " nestedGateStringLists\n", " contractStartToCPTP\n", " tolerance\n", " hessianProjection\n", " max length list\n", " distributeMethod\n", " L,germ tuple base string dict\n", " weights\n", " probClipInterval\n", "\n", " .options -- a container of display options:\n", " ---------------------------------------------------------\n", " .long_tables -- long latex tables? False\n", " .table_class -- HTML table class = pygstiTbl\n", " .precision -- precision = 4\n", " .polar_precision -- precision for polar exponent = 3\n", " .sci_precision -- precision for scientific notn = 0\n", " .errgen_type -- type of error generator = logTiG\n", " .template_path -- pyGSTi templates path = 'None'\n", " .latex_cmd -- latex compiling command = 'pdflatex'\n", " .latex_postcmd -- latex compiling command postfix = '-halt-on-error /dev/null'\n", "\n", "\n", "NOTE: passing 'tips=True' to create_full_report_pdf or\n", " create_brief_report_pdf will add markup to the resulting\n", " PDF indicating how tables and figures in the PDF correspond\n", " to the values of .tables[ ] and .figures[ ] listed above.\n", "\n" ] } ], "source": [ "# Printing a Results object gives you information about how to extract information from it\n", "print(results)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 0 }