{ "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": null, "metadata": {}, "outputs": [], "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.create_gst_experiment_design(max_max_length=1)\n", "pygsti.io.write_empty_protocol_data(\"example_files/lgst_only_example\", exp_design, 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(\"example_files/lgst_only_example/data/dataset.txt\",\n", " mdl_datagen, num_samples=1000, seed=2020)\n", "\n", "#load in the data\n", "data = pygsti.io.read_data_from_dir(\"example_files/lgst_only_example\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#Run LGST and create a report\n", "# You can also eliminate gauge optimization step by setting gaugeOptParams=False\n", "results = pygsti.protocols.LGST(smq1Q_XYI.target_model()).run(data)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "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 (ipykernel)", "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.9.13" } }, "nbformat": 4, "nbformat_minor": 4 }