pyGSTi is a software package to perform gate set tomography (GST). GST is a kind of quantum tomography, and it provides full characterization of quantum logic gates on quantum devices such as qubits. For a basic (albeit out of date) introduction to GST, see http://arxiv.org/abs/1605.07674 (by the pyGSTi authors) or http://arxiv.org/abs/1509.02921 (by an independent 3rd party). The first of these papers describes a relatively recent use of GST, similar to what's in pyGSTi. The second describes a more primitive initial version of gate set tomography which looks much different than the current pyGSTi code.
pyGSTi is written entirely in Python, so there's no compiling necessary. The first step is to install Python and iPython (Jupyter) notebook (if they aren't installed already). In order to use pyGSTi you need to tell your python distribution where pyGSTi lives, which can be done in one of two ways:
This adds the current pyGSTi path to Python's list of search paths, and doesn't required administrative access (but only applies to the current user). Typically you want to do this if you've cloned the pyGSTi GitHub repository and want any changes you make to your local file to have effect when you
import pygstifrom Python. You'd also want to use this option if you plan to use the tutorial notebook files for a while, since this means you'll be keeping the pyGSTi directory you unpacked or cloned around for a while.
python setup.py install
This installs the pyGSTi package into one of the Python distribution's search directories. This typically requires administrative privileges, and is the way most Python packages are installed. Installing this way has the advantage that it makes the package available to all users and then allows you to move or delete the directory you're installing from. If you don't use this method you must not delete the pyGSTi directory that you cloned or unpacked so long as you want to use pyGSTi.
Reasons you may not want to use this installation method are (1) that you want to access the pyGSTi tutorials for weeks and years to or (2) you've cloned the pyGSTi repository and want the resulting local git directory to be the one Python uses when you
import pygsti(so that when you do a
git pullto update the repository, this actually updates the behavior in your scripts!).
After you've installed pyGSTi, you should be able to
import pygsti in Python or an iPython (Jupyter) notebook. The next step is to take a look at
the tutorials. To do this:
change to the notebook directory, by running:
start up the Jupyter ipython notebook server by running:
The iPython server should open up your web browser to the server root. From there, you can navigate to the "Tutorials" folder and start the first tutorial notebook, “00 Quick and easy GST”. If you're new to iPython notebook, note that the key command to execute a cell within a notebook is <Shift+Enter>, not just <Enter>. Static HTML versions of these tutorials are linked to in the "Tutorials" section below.
Congratulations! You're up and running with pyGSTi!
Below is a list of tutorials for getting started with pyGSTi. These are HTML versions of the tutorials you can run interactively from iPython notebook after installing pyGSTi (see above). We've converted them to HTML and made them available here both to serve as a reference and so you can see pyGSTi in action before you (or without needing to) install it.
Quick and easy GST Get started with pyGSTi
using the high-level interface. This may be the only tutorial many users will need.
Gate sets Covers the
GateSetobject and related functions.
Gate strings Covers the
GateStringobject and related functions, specifically how to make lists of gate strings.
Data sets Covers construction and use of
- Algorithms How to invoke pyGSTi's algorithms (at a lower level than in the first tutorial).
- Making Plots Shows how to construct various types of plots from a GST estimate.
- Advanced: Algorithms An advanced and incomplete tutorial showing how to use some of pyGSTi's model selection routines.
- Generating Reports Covers how to generate reports from a GST estimate.
- Advanced: Fiducial Reduction An advanced tutorial demonstrating fiducial-pair-reduction.
- Advanced: Bootstrapped Error Bars An advanced tutorial which constructs error bars on a GST estimate using parametric and non-parametric bootstrapping.
Fiducial Selection A tutorial demonstrating how the
fiducialgate sequences are chosen (1-qubit example).
Fiducial Selection II A tutorial demonstrating how the
fiducialgate sequences are chosen (2-qubit example).
- Germ Selection A tutorial demonstrating how germ sequences are chosen.
- 2-qubit GST A tutorial demonstrating how to peform GST on a 2-qubit system.
Custom 2-qubit gate A tutorial demonstrating a process that can be used to construct a
custom2-qubit gate (i.e. a gate not included in one of pyGSTi's standard gate sets).
Detailed documentation of the pyGSTi code (automatically generated from the source code's docstrings) can be found here. These pages provide a searchable reference for just about everything pyGSTi can do. Please let us know if you find any errors.
pyGSTi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. To cite this work, please use the DOI:
For help and support with pyGSTi, please contact the authors at firstname.lastname@example.org.