{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "As noted in Tutorial 00, `pygsti` can provide many reports or presentation slides.\n", "\n", "In this tutorial, we look at how to customize some of the output of `pygsti`'s report generating module." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib\n", "matplotlib.use('Agg')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "#Import the GST module -- you probably want this at the beginning of every notebook\n", "import pygsti\n", "import json" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Creating reports is a method of the `pygsti.report.Results` object. Below, we create such an object, and then initialize it with the appropriate fiducials, germs, maximum lengths, etc.\n", "\n", "It's important to note that the `pygsti.report.Results` object requires an argument to indicate which objective function you wish to score the estimate using. It's recommended that, if you ran MC2GST, you use the `\"chi2\"` argument, while if you ran MLGST, you use `\"logL\"`. Otherwise, you will score your estimate based on an objective function you weren't optimizing over, so your scores may be rather weird!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Creating reports is a method of the `pygsti.report.Results` object. Below, we create such an object, and then initialize it with the appropriate fiducials, germs, maximum lengths, etc.\n", "\n", "It's important to note that the `pygsti.report.Results` object requires an argument to indicate which objective function you wish to score the estimate using. It's recommended that, if you ran MC2GST, you use the `\"chi2\"` argument, while if you ran MLGST, you use `\"logL\"`. Otherwise, you will score your estimate based on an objective function you weren't optimizing over, so your scores may be rather weird!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we'll make smaller reports that don't contain any confidence intervals for the estimates,\n", "nor any appendices.\n", "\n", "NOTE: In order for you to create PowerPoint files, you'll have to have `python-pptx` installed on your system." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Loading tutorial_files/Example_Dataset.txt: 100%\n", "Writing cache file (to speed future loads): tutorial_files/Example_Dataset.txt.cache\n", "--- LGST ---\n", "--- Iterative MLGST: Iter 01 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 40.9238 (92 data params - 40 model params = expected mean of 52; p-value = 0.866034)\n", " Completed in 0.3s\n", " 2*Delta(log(L)) = 41.1104\n", " Iteration 1 took 0.3s\n", " \n", "--- Iterative MLGST: Iter 02 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 40.9238 (92 data params - 40 model params = expected mean of 52; p-value = 0.866034)\n", " Completed in 0.1s\n", " 2*Delta(log(L)) = 41.1104\n", " Iteration 2 took 0.1s\n", " \n", "--- Iterative MLGST: Iter 03 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 124.56 (168 data params - 40 model params = expected mean of 128; p-value = 0.569533)\n", " Completed in 0.5s\n", " 2*Delta(log(L)) = 124.957\n", " Iteration 3 took 0.5s\n", " \n", "--- Iterative MLGST: Iter 04 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 424.144 (441 data params - 40 model params = expected mean of 401; p-value = 0.204559)\n", " Completed in 0.9s\n", " 2*Delta(log(L)) = 425.013\n", " Iteration 4 took 1.0s\n", " \n", "--- Iterative MLGST: Iter 05 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 772.131 (817 data params - 40 model params = expected mean of 777; p-value = 0.542548)\n", " Completed in 1.4s\n", " 2*Delta(log(L)) = 773.805\n", " Iteration 5 took 1.5s\n", " \n", "--- Iterative MLGST: Iter 06 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 1154.53 (1201 data params - 40 model params = expected mean of 1161; p-value = 0.548039)\n", " Completed in 1.6s\n", " 2*Delta(log(L)) = 1156.61\n", " Iteration 6 took 1.7s\n", " \n", "--- Iterative MLGST: Iter 07 of 10 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 1601.67 (1585 data params - 40 model params = expected mean of 1545; p-value = 0.154051)\n", " Completed in 2.2s\n", " 2*Delta(log(L)) = 1604.17\n", " Iteration 7 took 2.4s\n", " \n", "--- Iterative MLGST: Iter 08 of 10 1969 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 2034.53 (1969 data params - 40 model params = expected mean of 1929; p-value = 0.046511)\n", " Completed in 2.8s\n", " 2*Delta(log(L)) = 2037.54\n", " Iteration 8 took 3.0s\n", " \n", "--- Iterative MLGST: Iter 09 of 10 2353 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 2426.32 (2353 data params - 40 model params = expected mean of 2313; p-value = 0.0495274)\n", " Completed in 4.3s\n", " 2*Delta(log(L)) = 2429.74\n", " Iteration 9 took 4.7s\n", " \n", "--- Iterative MLGST: Iter 10 of 10 2737 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 56 params (taken as 1 param groups of ~56 params).\n", " Sum of Chi^2 = 2797.88 (2737 data params - 40 model params = expected mean of 2697; p-value = 0.085984)\n", " Completed in 7.1s\n", " 2*Delta(log(L)) = 2801.7\n", " Iteration 10 took 7.9s\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 56 params (taken as 1 param groups of ~56 params).\n", " Maximum log(L) = 1400.46 below upper bound of -4.60013e+06\n", " 2*Delta(log(L)) = 2800.93 (2737 data params - 40 model params = expected mean of 2697; p-value = 0.0798162)\n", " Completed in 7.1s\n", " 2*Delta(log(L)) = 2800.93\n", " Final MLGST took 7.1s\n", " \n", "Iterative MLGST Total Time: 30.1s\n" ] } ], "source": [ "# Follow Algorithm tutorial to generate LSGST gatesets\n", "gs_target = pygsti.io.load_gateset(\"tutorial_files/Example_Gateset.txt\")\n", "gs_target.set_basis(\"gm\",2)\n", "ds = pygsti.io.load_dataset(\"tutorial_files/Example_Dataset.txt\", cache=True)\n", "fiducialList = pygsti.io.load_gatestring_list(\"tutorial_files/Example_FiducialList.txt\")\n", "\n", "#Run LGST to get an initial estimate for the gates in gs_target based on the data in ds\n", "specs = pygsti.construction.build_spam_specs(fiducialGateStrings=fiducialList)\n", "gs_lgst = pygsti.do_lgst(ds, specs, targetGateset=gs_target, svdTruncateTo=4, verbosity=1)\n", "\n", "#Gauge optimize the result to match the target gateset\n", "gs_lgst_after_gauge_opt = pygsti.gaugeopt_to_target(gs_lgst, gs_target)\n", "\n", "#Contract the result to CPTP\n", "gs_clgst = pygsti.contract(gs_lgst_after_gauge_opt, \"CPTP\")\n", "\n", "#Get lists of gate strings for successive iterations of MC2GST to use\n", "specs = pygsti.construction.build_spam_specs(fiducialGateStrings=fiducialList)\n", "germList = pygsti.io.load_gatestring_list(\"tutorial_files/Example_GermsList.txt\")\n", "maxLengthList = json.load(open(\"tutorial_files/Example_maxLengths.json\",\"r\"))\n", "lsgstListOfLists = [ pygsti.io.load_gatestring_list(\"tutorial_files/Example_LSGSTlist%d.txt\" % l) for l in maxLengthList]\n", " \n", "gs_lsgst_list = pygsti.do_iterative_mlgst(ds, gs_clgst, lsgstListOfLists, verbosity=2,\n", " minProbClip=1e-6, probClipInterval=(-1e6,1e6),\n", " returnAll=True )\n", "\n", "go_gatesets = [ pygsti.gaugeopt_to_target(gs, gs_target,itemWeights={'gates': 1, 'spam': 0.001})\n", " for gs in gs_lsgst_list]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "res = pygsti.report.Results()\n", "res.init_Ls_and_germs(\"logl\", gs_target, ds, gs_clgst, maxLengthList, germList,\n", " go_gatesets, lsgstListOfLists, fiducialList, fiducialList, \n", " pygsti.construction.repeat_with_max_length, False)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "*** Generating tables ***\n", " Iter 01 of 19 : Generating table: targetSpamTable [0.0s]\n", " Iter 02 of 19 : Generating table: targetGatesTable [0.0s]\n", " Iter 03 of 19 : Generating table: datasetOverviewTable [0.1s]\n", " Iter 04 of 19 : Generating table: bestGatesetSpamTable [0.0s]\n", " Iter 05 of 19 : Generating table: bestGatesetSpamParametersTable [0.0s]\n", " Iter 06 of 19 : Generating table: bestGatesetGaugeOptParamsTable [0.0s]\n", " Iter 07 of 19 : Generating table: bestGatesetGatesTable [0.0s]\n", " Iter 08 of 19 : Generating table: bestGatesetChoiTable [0.0s]\n", " Iter 09 of 19 : Generating table: bestGatesetDecompTable [0.0s]\n", " Iter 10 of 19 : Generating table: bestGatesetRotnAxisTable [0.0s]\n", " Iter 11 of 19 : Generating table: bestGatesetVsTargetTable [0.4s]\n", " Iter 12 of 19 : Generating table: bestGatesetErrorGenTable [0.0s]\n", " Iter 13 of 19 : Generating table: metadataTable [0.0s]\n", " Iter 14 of 19 : Generating table: softwareEnvTable [0.3s]\n", " Iter 15 of 19 : Generating table: fiducialListTable [0.0s]\n", " Iter 16 of 19 : Generating table: prepStrListTable [0.0s]\n", " Iter 17 of 19 : Generating table: effectStrListTable [0.0s]\n", " Iter 18 of 19 : Generating table: germListTable [0.0s]\n", " Iter 19 of 19 : Generating table: progressTable [2.2s]\n", "*** Generating plots ***\n", "LogL plots (2): \n", " Iter 1 of 3 : Generating figure: colorBoxPlotKeyPlot [2.1s]\n", " Iter 2 of 3 : Generating figure: bestEstimateColorBoxPlot [38.5s]\n", " Iter 3 of 3 : Generating figure: invertedBestEstimateColorBoxPlot [35.6s]\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/Example_reportB.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_reportB.pdf successfully generated. Cleaning up .aux and .log files.\n", "*** Generating tables ***\n", " Retrieving cached table: bestGatesetSpamTable\n", " Retrieving cached table: bestGatesetSpamParametersTable\n", " Retrieving cached table: bestGatesetGatesTable\n", " Retrieving cached table: bestGatesetDecompTable\n", " Retrieving cached table: bestGatesetRotnAxisTable\n", " Retrieving cached table: bestGatesetVsTargetTable\n", " Retrieving cached table: bestGatesetErrorGenTable\n", " Retrieving cached table: progressTable\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/Example_briefB.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_briefB.pdf successfully generated. Cleaning up .aux and .log files.\n", "*** Generating tables ***\n", " Retrieving cached table: targetSpamTable\n", " Retrieving cached table: targetGatesTable\n", " Retrieving cached table: datasetOverviewTable\n", " Retrieving cached table: bestGatesetSpamTable\n", " Retrieving cached table: bestGatesetSpamParametersTable\n", " Retrieving cached table: bestGatesetGatesTable\n", " Retrieving cached table: bestGatesetChoiTable\n", " Retrieving cached table: bestGatesetDecompTable\n", " Retrieving cached table: bestGatesetRotnAxisTable\n", " Retrieving cached table: bestGatesetVsTargetTable\n", " Retrieving cached table: bestGatesetErrorGenTable\n", " Retrieving cached table: fiducialListTable\n", " Retrieving cached table: prepStrListTable\n", " Retrieving cached table: effectStrListTable\n", " Retrieving cached table: germListTable\n", " Retrieving cached table: progressTable\n", "*** Generating plots ***\n", " -- LogL plots (1): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "*** Generating tables ***\n", " Iter 01 of 16 : Retrieving cached table: targetSpamTable\n", " Iter 02 of 16 : Retrieving cached table: targetGatesTable\n", " Iter 03 of 16 : Retrieving cached table: datasetOverviewTable\n", " Iter 04 of 16 : Retrieving cached table: bestGatesetSpamTable\n", " Iter 05 of 16 : Retrieving cached table: bestGatesetSpamParametersTable\n", " Iter 06 of 16 : Retrieving cached table: bestGatesetGatesTable\n", " Iter 07 of 16 : Retrieving cached table: bestGatesetChoiTable\n", " Iter 08 of 16 : Retrieving cached table: bestGatesetDecompTable\n", " Iter 09 of 16 : Retrieving cached table: bestGatesetRotnAxisTable\n", " Iter 10 of 16 : Retrieving cached table: bestGatesetVsTargetTable\n", " Iter 11 of 16 : Retrieving cached table: bestGatesetErrorGenTable\n", " Iter 12 of 16 : Retrieving cached table: fiducialListTable\n", " Iter 13 of 16 : Retrieving cached table: prepStrListTable\n", " Iter 14 of 16 : Retrieving cached table: effectStrListTable\n", " Iter 15 of 16 : Retrieving cached table: germListTable\n", " Iter 16 of 16 : Retrieving cached table: progressTable\n", "*** Generating plots ***\n", " -- LogL plots (1): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "ERROR: pdflatex returned code 1 Check Example_slidesB.log to see details.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\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" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "ERROR: b'system returned with code 256\\n'\n", "\n", "ERROR: pdflatex returned code 1 trying to render standalone datasetOverviewTable. Check datasetOverviewTable.log to see details.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Final output PPT tutorial_files/Example_slidesB.pptx successfully generated.\n", "*** Generating tables *** (0.0s elapsed)\n", " Generating table: targetSpamBriefTable [0.0s]\n", " Generating table: bestGatesetSpamBriefTable [0.0s]\n", " Retrieving cached table: bestGatesetSpamParametersTable\n", " Retrieving cached table: bestGatesetVsTargetTable\n", " Generating table: bestGatesetSpamVsTargetTable [0.0s]\n", " Retrieving cached table: bestGatesetGaugeOptParamsTable\n", " Generating table: bestGatesetChoiEvalTable [3.5s]\n", " Retrieving cached table: datasetOverviewTable\n", " Generating table: bestGatesetEvalTable [1.2s]\n", " Generating table: bestGatesetRelEvalTable [1.1s]\n", " Generating table: targetGatesBoxTable [2.4s]\n", " Generating table: bestGatesetGatesBoxTable [4.8s]\n", " Generating table: bestGatesetErrGenBoxTable [6.5s]\n", " Retrieving cached table: metadataTable\n", " Retrieving cached table: softwareEnvTable\n", " Retrieving cached table: fiducialListTable\n", " Retrieving cached table: prepStrListTable\n", " Retrieving cached table: effectStrListTable\n", " Generating table: germList2ColTable [0.0s]\n", " Retrieving cached table: progressTable\n", "*** Generating plots *** (29.8s elapsed)\n", " -- LogL plots: Iter 1 of 3 : Retrieving cached figure: colorBoxPlotKeyPlot\n", " Iter 2 of 3 : Generating figure: bestEstimateSummedColorBoxPlot [3.6s]\n", " Iter 3 of 3 : Generating special: bestEstimateColorBoxPlotPages [25.6s]\n", "\n", "*** Merging into template file *** (71.5s elapsed)\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/Example_generalB.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_generalB.pdf successfully generated. Cleaning up .aux and .log files.\n", "Report generation complete! [total time 78s]\n" ] } ], "source": [ "#Make smaller reports (no confidence intervals or appendicies)\n", "res.create_full_report_pdf(filename=\"tutorial_files/Example_reportB.pdf\", verbosity=2, confidenceLevel=None,\n", " debugAidsAppendix=False, gaugeOptAppendix=False,\n", " pixelPlotAppendix=False, whackamoleAppendix=False)\n", "\n", "res.create_brief_report_pdf(filename=\"tutorial_files/Example_briefB.pdf\", verbosity=2, confidenceLevel=None)\n", "\n", "res.create_presentation_pdf(filename=\"tutorial_files/Example_slidesB.pdf\", verbosity=2, confidenceLevel=None,\n", " debugAidsAppendix=False, pixelPlotAppendix=False, whackamoleAppendix=False)\n", "\n", "res.create_presentation_ppt(filename=\"tutorial_files/Example_slidesB.ppt\", verbosity=2, confidenceLevel=None,\n", " debugAidsAppendix=False, pixelPlotAppendix=False, whackamoleAppendix=False)\n", "\n", "res.create_general_report_pdf(filename=\"tutorial_files/Example_generalB.pdf\", verbosity=2, confidenceLevel=None)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " \n", "--- Hessian Projector Optimization for gate CIs (L-BFGS-B) ---\n", " 29s 0.0263698971\n", " 57s 0.0260672654\n", " 71s 0.0257208064\n", " 85s 0.0255807596\n", " 98s 0.0254232097\n", " 113s 0.0253751581\n", " 124s 0.0253332390\n", " 133s 0.0253177722\n", " 143s 0.0253115074\n", " 153s 0.0253083183\n", " 162s 0.0253060050\n", " 171s 0.0253042819\n", " 181s 0.0253029233\n", " 191s 0.0253010474\n", " 199s 0.0252997419\n", " 207s 0.0252988645\n", " The resulting min sqrt(sum(gateCIs**2)): 0.0252989\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.3s]\n", " Iter 09 of 19 : Generating table: bestGatesetDecompTable (w/95% CIs) [0.3s]\n", " Iter 10 of 19 : Generating table: bestGatesetRotnAxisTable (w/95% CIs) [0.4s]\n", " Iter 11 of 19 : Generating table: bestGatesetVsTargetTable (w/95% CIs) [1.7s]\n", " Iter 12 of 19 : Generating table: bestGatesetErrorGenTable (w/95% CIs) [0.0s]\n", " Iter 13 of 19 : Generating table: metadataTable (w/95% CIs) Retrieving cached table: metadataTable\n", " Iter 14 of 19 : Generating table: softwareEnvTable (w/95% CIs) Retrieving cached table: softwareEnvTable\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.9s]\n", " Generating special: gaugeOptAppendixTables (w/95% CIs) Generating special: gaugeOptAppendixTables Generating special: gaugeOptAppendixGatesets (w/95% CIs) Generating special: gaugeOptAppendixGatesets Performing gauge transforms for appendix...\n", " [0.0s]\n", " [42.0s]\n", "*** Generating plots ***\n", "LogL plots (10): \n", " Iter 1 of 3 : Generating figure: colorBoxPlotKeyPlot (w/95% CIs) Retrieving cached figure: colorBoxPlotKeyPlot\n", " Iter 2 of 3 : Generating figure: bestEstimateColorBoxPlot (w/95% CIs) Retrieving cached figure: bestEstimateColorBoxPlot\n", " Iter 3 of 3 : Generating figure: invertedBestEstimateColorBoxPlot (w/95% CIs) Retrieving cached figure: invertedBestEstimateColorBoxPlot\n", " Iter 2 of 9 : Generating figure: estimateForLIndex1ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex1ColorBoxPlot[1.0s]\n", " Iter 3 of 9 : Generating figure: estimateForLIndex2ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex2ColorBoxPlot[1.7s]\n", " Iter 4 of 9 : Generating figure: estimateForLIndex3ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex3ColorBoxPlot[4.5s]\n", " Iter 5 of 9 : Generating figure: estimateForLIndex4ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex4ColorBoxPlot[6.4s]\n", " Iter 6 of 9 : Generating figure: estimateForLIndex5ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex5ColorBoxPlot[8.1s]\n", " Iter 7 of 9 : Generating figure: estimateForLIndex6ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex6ColorBoxPlot[10.0s]\n", " Iter 8 of 9 : Generating figure: estimateForLIndex7ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex7ColorBoxPlot[11.7s]\n", " Iter 9 of 9 : Generating figure: estimateForLIndex8ColorBoxPlot (w/95% CIs)Generating figure: estimateForLIndex8ColorBoxPlot[13.7s]\n", "\n", " -- Direct-X plots (2):\n", " Iter 1 of 2 : Generating figure: directLongSeqGSTColorBoxPlot (w/95% CIs) Generating figure: directLongSeqGSTColorBoxPlot Generating special: DirectLongSeqGatesets (w/95% CIs) Generating special: DirectLongSeqGatesets [16.3s]\n", " [20.0s]\n", " Iter 2 of 2 : Generating figure: directLongSeqGSTDeviationColorBoxPlot (w/95% CIs) Generating figure: directLongSeqGSTDeviationColorBoxPlot Retrieving cached special: DirectLongSeqGatesets (w/95% CIs)\n", " [2.0s]\n", "\n", " -- Error rate plots...\n", " Generating figure: smallEigvalErrRateColorBoxPlot (w/95% CIs) Generating figure: smallEigvalErrRateColorBoxPlot Retrieving cached special: DirectLongSeqGatesets (w/95% CIs)\n", " [1.7s]\n", " -- Whack-a-mole plots (6): Iter 1 of 3 : Generating figure: whackGxMoleBoxes (w/95% CIs) Generating figure: whackGxMoleBoxes [37.2s]\n", " Iter 2 of 3 : Generating figure: whackGyMoleBoxes (w/95% CIs) Generating figure: whackGyMoleBoxes" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib-1.5.3-py3.5-macosx-10.6-intel.egg/matplotlib/pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n", " max_open_warning, RuntimeWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " [35.5s]\n", " Iter 3 of 3 : Generating figure: whackGiMoleBoxes (w/95% CIs) Generating figure: whackGiMoleBoxes [35.6s]\n", " Iter 1 of 3 : Generating figure: whackGxMoleBoxesSummed (w/95% CIs) Generating figure: whackGxMoleBoxesSummed [22.4s]\n", " Iter 2 of 3 : Generating figure: whackGyMoleBoxesSummed (w/95% CIs) Generating figure: whackGyMoleBoxesSummed [22.3s]\n", " Iter 3 of 3 : Generating figure: whackGiMoleBoxesSummed (w/95% CIs) Generating figure: whackGiMoleBoxesSummed [22.2s]\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/Example_report.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_report.pdf successfully generated. Cleaning up .aux and .log files.\n", "*** 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/Example_brief.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_brief.pdf successfully generated. Cleaning up .aux and .log files.\n", "*** 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 (9): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot (w/95% CIs)\n", " Iter 2 of 9 : Retrieving cached figure: estimateForLIndex1ColorBoxPlot (w/95% CIs)\n", " Iter 3 of 9 : Retrieving cached figure: estimateForLIndex2ColorBoxPlot (w/95% CIs)\n", " Iter 4 of 9 : Retrieving cached figure: estimateForLIndex3ColorBoxPlot (w/95% CIs)\n", " Iter 5 of 9 : Retrieving cached figure: estimateForLIndex4ColorBoxPlot (w/95% CIs)\n", " Iter 6 of 9 : Retrieving cached figure: estimateForLIndex5ColorBoxPlot (w/95% CIs)\n", " Iter 7 of 9 : Retrieving cached figure: estimateForLIndex6ColorBoxPlot (w/95% CIs)\n", " Iter 8 of 9 : Retrieving cached figure: estimateForLIndex7ColorBoxPlot (w/95% CIs)\n", " Iter 9 of 9 : Retrieving cached figure: estimateForLIndex8ColorBoxPlot (w/95% CIs)\n", "\n", " -- Direct-X plots (2) Iter 1 of 2 : Retrieving cached figure: directLongSeqGSTColorBoxPlot (w/95% CIs)\n", " Iter 2 of 2 : Retrieving cached figure: directLongSeqGSTDeviationColorBoxPlot (w/95% CIs)\n", "\n", " -- Error rate plots...\n", " Retrieving cached figure: smallEigvalErrRateColorBoxPlot (w/95% CIs)\n", " -- Whack-a-mole plots (6): Iter 1 of 3 : Retrieving cached figure: whackGxMoleBoxes (w/95% CIs)\n", " Iter 2 of 3 : Retrieving cached figure: whackGyMoleBoxes (w/95% CIs)\n", " Iter 3 of 3 : Retrieving cached figure: whackGiMoleBoxes (w/95% CIs)\n", " Iter 1 of 3 : Retrieving cached figure: whackGxMoleBoxesSummed (w/95% CIs)\n", " Iter 2 of 3 : Retrieving cached figure: whackGyMoleBoxesSummed (w/95% CIs)\n", " Iter 3 of 3 : Retrieving cached figure: whackGiMoleBoxesSummed (w/95% CIs)\n", "\n", "*** Merging into template file ***\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "*** 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 (9): Iter 1 of 1 : Retrieving cached figure: bestEstimateColorBoxPlot (w/95% CIs)\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "ERROR: pdflatex returned code 1 Check Example_slides.log to see details.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " Iter 2 of 9 : Retrieving cached figure: estimateForLIndex1ColorBoxPlot (w/95% CIs)\n", " Iter 3 of 9 : Retrieving cached figure: estimateForLIndex2ColorBoxPlot (w/95% CIs)\n", " Iter 4 of 9 : Retrieving cached figure: estimateForLIndex3ColorBoxPlot (w/95% CIs)\n", " Iter 5 of 9 : Retrieving cached figure: estimateForLIndex4ColorBoxPlot (w/95% CIs)\n", " Iter 6 of 9 : Retrieving cached figure: estimateForLIndex5ColorBoxPlot (w/95% CIs)\n", " Iter 7 of 9 : Retrieving cached figure: estimateForLIndex6ColorBoxPlot (w/95% CIs)\n", " Iter 8 of 9 : Retrieving cached figure: estimateForLIndex7ColorBoxPlot (w/95% CIs)\n", " Iter 9 of 9 : Retrieving cached figure: estimateForLIndex8ColorBoxPlot (w/95% CIs)\n", "\n", " -- Direct-X plots (2) Iter 1 of 2 : Retrieving cached figure: directLongSeqGSTColorBoxPlot (w/95% CIs)\n", " Iter 2 of 2 : Retrieving cached figure: directLongSeqGSTDeviationColorBoxPlot (w/95% CIs)\n", "\n", " -- Error rate plots...\n", " Retrieving cached figure: smallEigvalErrRateColorBoxPlot (w/95% CIs)\n", " -- Whack-a-mole plots (6): Iter 1 of 3 : Retrieving cached figure: whackGxMoleBoxes (w/95% CIs)\n", " Iter 2 of 3 : Retrieving cached figure: whackGyMoleBoxes (w/95% CIs)\n", " Iter 3 of 3 : Retrieving cached figure: whackGiMoleBoxes (w/95% CIs)\n", " Iter 1 of 3 : Retrieving cached figure: whackGxMoleBoxesSummed (w/95% CIs)\n", " Iter 2 of 3 : Retrieving cached figure: whackGyMoleBoxesSummed (w/95% CIs)\n", " Iter 3 of 3 : Retrieving cached figure: whackGiMoleBoxesSummed (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" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "ERROR: b'system returned with code 256\\n'\n", "\n", "ERROR: pdflatex returned code 1 trying to render standalone datasetOverviewTable. Check datasetOverviewTable.log to see details.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Final output PPT tutorial_files/Example_slides.pptx successfully generated.\n", "*** Generating tables *** (0.0s elapsed)\n", " Generating table: targetSpamBriefTable (w/95% CIs) [0.0s]\n", " Generating table: bestGatesetSpamBriefTable (w/95% CIs) [0.0s]\n", " Retrieving cached table: bestGatesetSpamParametersTable (w/95% CIs)\n", " Retrieving cached table: bestGatesetVsTargetTable (w/95% CIs)\n", " Generating table: bestGatesetSpamVsTargetTable (w/95% CIs) [0.0s]\n", " Retrieving cached table: bestGatesetGaugeOptParamsTable (w/95% CIs)\n", " Generating table: bestGatesetChoiEvalTable (w/95% CIs)" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib-1.5.3-py3.5-macosx-10.6-intel.egg/matplotlib/pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).\n", " max_open_warning, RuntimeWarning)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " [2.2s]\n", " Retrieving cached table: datasetOverviewTable (w/95% CIs)\n", " Generating table: bestGatesetEvalTable (w/95% CIs) [0.7s]\n", " Generating table: bestGatesetRelEvalTable (w/95% CIs) [0.6s]\n", " Generating table: targetGatesBoxTable (w/95% CIs) [1.3s]\n", " Generating table: bestGatesetGatesBoxTable (w/95% CIs) [2.6s]\n", " Generating table: bestGatesetErrGenBoxTable (w/95% CIs) [3.7s]\n", " Retrieving cached table: metadataTable (w/95% CIs)\n", " Retrieving cached table: softwareEnvTable (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", " Generating table: germList2ColTable (w/95% CIs) [0.0s]\n", " Retrieving cached table: progressTable (w/95% CIs)\n", "*** Generating plots *** (18.3s elapsed)\n", " -- LogL plots: Iter 1 of 3 : Retrieving cached figure: colorBoxPlotKeyPlot (w/95% CIs)\n", " Iter 2 of 3 : Generating figure: bestEstimateSummedColorBoxPlot (w/95% CIs) Retrieving cached figure: bestEstimateSummedColorBoxPlot\n", " Iter 3 of 3 : Generating special: bestEstimateColorBoxPlotPages (w/95% CIs) Retrieving cached special: bestEstimateColorBoxPlotPages\n", "\n", "*** Merging into template file *** (26.8s elapsed)\n", "Latex file(s) successfully generated. Attempting to compile with pdflatex...\n", "Initial output PDF tutorial_files/Example_generalB.pdf successfully generated.\n", "Final output PDF tutorial_files/Example_generalB.pdf successfully generated. Cleaning up .aux and .log files.\n", "Report generation complete! [total time 31s]\n" ] } ], "source": [ "res.create_full_report_pdf(filename=\"tutorial_files/Example_report.pdf\", verbosity=2, confidenceLevel=95,\n", " debugAidsAppendix=True, gaugeOptAppendix=True,\n", " pixelPlotAppendix=True, whackamoleAppendix=True)\n", "\n", "res.create_brief_report_pdf(filename=\"tutorial_files/Example_brief.pdf\", verbosity=2, confidenceLevel=95)\n", "\n", "res.create_presentation_pdf(filename=\"tutorial_files/Example_slides.pdf\", verbosity=2, confidenceLevel=95,\n", " debugAidsAppendix=True, pixelPlotAppendix=True, whackamoleAppendix=True)\n", "\n", "res.create_presentation_ppt(filename=\"tutorial_files/Example_slides.ppt\", verbosity=2, confidenceLevel=95,\n", " debugAidsAppendix=True, pixelPlotAppendix=True, whackamoleAppendix=True)\n", "\n", "res.create_general_report_pdf(filename=\"tutorial_files/Example_generalB.pdf\", verbosity=2, confidenceLevel=95)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#Results can be pickled after generating reports in order to save cached derived quantities\n", "import pickle\n", "pickle.dump(res, open(\"tutorial_files/example_results.pkl\",\"wb\"))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'1\\\\e{30}'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pygsti.report.latex as LU\n", "from imp import reload\n", "reload(LU)\n", "LU.latex_value(1.2e30,2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "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 }