{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to create an LGST-only report\n", "This example shows how you can create a HTML report from just the results of running *linear GST* (LGST). This can be useful when you want to get a rough estimate of your gates quickly, as LGST is takes substantially less data and computation time compared with long-sequence GST. This example is modeled after Tutorial 0." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Only 92 sequences are required!\n" ] } ], "source": [ "#Import the pygsti module (always do this) and the standard XYI model\n", "import pygsti\n", "from pygsti.modelpacks import smq1Q_XYI\n", "\n", "#Get experiment design (for now, just max_max_length=1 GST sequences)\n", "exp_design = smq1Q_XYI.get_gst_experiment_design(max_max_length=1)\n", "pygsti.io.write_empty_protocol_data(exp_design, \"example_files/lgst_only_example\", clobber_ok=True)\n", "print(\"Only %d sequences are required!\" % len(exp_design.all_circuits_needing_data))\n", "\n", "#Simulate taking the data (here you'd really fill in dataset.txt with actual data)\n", "mdl_datagen = smq1Q_XYI.target_model().depolarize(op_noise=0.1, spam_noise=0.001)\n", "pygsti.io.fill_in_empty_dataset_with_fake_data(mdl_datagen, \"example_files/lgst_only_example/data/dataset.txt\",\n", " nSamples=1000, seed=2020)\n", "\n", "#load in the data\n", "data = pygsti.io.load_data_from_dir(\"example_files/lgst_only_example\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "--- LGST ---\n", " Singular values of I_tilde (truncating to first 4 of 6) = \n", " 4.243739384333438\n", " 1.174085597747583\n", " 0.9927915010167846\n", " 0.9182042113995429\n", " 0.0731735967798496\n", " 0.032353259963406746\n", " \n", " Singular values of target I_tilde (truncating to first 4 of 6) = \n", " 4.242640687119284\n", " 1.4142135623730956\n", " 1.4142135623730954\n", " 1.4142135623730951\n", " 2.5394445830714747e-16\n", " 1.118988490269554e-16\n", " \n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\n", "WARNING: Treating result as *converged* after maximum iterations (100) were exceeded.\n" ] } ], "source": [ "#Run LGST and create a report\n", "# You can also eliminate gauge optimization step by setting gaugeOptParams=False\n", "results = pygsti.protocols.LGST().run(data)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running idle tomography\n", "Computing switchable properties\n", "Found standard clifford compilation from smq1Q_XYI\n" ] } ], "source": [ "pygsti.report.construct_standard_report(\n", " results, title=\"LGST-only Example Report\", verbosity=2\n", ").write_html('example_files/LGSTonlyReport', verbosity=2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Click to open the file [example_files/LGSTonlyReport/main.html](example_files/LGSTonlyReport/main.html) in your browser to view the report." ] } ], "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }