• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Jupyter Notebook
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python implementation of Gate Set Tomography

pyGSTi 0.9


master build develop build beta build

pyGSTi

pyGSTi is an open-source software for modeling and characterizing noisy quantum information processors (QIPs), i.e., systems of one or more qubits. It is licensed under the Apache License, Version 2.0. Copyright information can be found in NOTICE, and the license itself in LICENSE.

There are three main objects in pyGSTi:

  • Circuit: a quantum circuit (can have many qubits).
  • Model: a description of a QIP's gate and SPAM operations (a noise model).
  • DataSet: a dictionary-like container holding experimental data.

You can do various things by with these objects:

  • Circuit simulation: compute a the outcome probabilities of a Circuit using a Model.
  • Data simulation: simulate experimental data (a DataSet) using a Model.
  • Model testing: Test whether a given Model fits the data in a DataSet.
  • Model estimation: Estimate a Model from a DataSet (e.g. using GST).
  • Model-less characterization: Perform Randomized Benchmarking on a DataSet.

In particular, there are a number of characterization protocols currently implemented in pyGSTi:

  • Gate Set Tomography (GST) is the most complex and is where the software derives its name (a "python GST implementation").
  • Randomized Benchmarking (RB) is a well-known method for assessing the quality of a QIP in an average sense. PyGSTi implements standard "Clifford" RB as well as the more scalable "Direct" RB methods.
  • Robust Phase Estimation (RPE) is a method designed for quickly learning a few noise parameters of a QIP that particularly useful for tuning up qubits.

PyGSTi is designed with a modular structure so as to be highly customizable and easily integrated to new or existing python software. It runs using python2.7 or python3. To faclilitate integration with software for running cloud-QIP experiments, pyGSTi Circuit objects can be converted to IBM's OpenQASM and Rigetti Quantum Computing's Quil circuit description languages.

Installation

Apart from several optional Cython modules, pyGSTi is written entirely in Python. To install pyGSTi and only its required dependencies run:

pip install pygsti

Or, to install pyGSTi with all its optional dependencies too, run:

pip install pygsti[complete]

The disadvantage to these approaches is that the numerous tutorials included in the package will then be buried within your Python's site_packages directory, which you'll likely want to access later on. Alternatively, you can locally install pyGSTi using the following commands:

cd <install_directory>
git clone https://github.com/pyGSTio/pyGSTi.git
cd pyGSTi
pip install -e .[complete]

As above, you can leave off the .[complete] if you only went the minimal set of dependencies installed. You could also replace the git clone ... command with unzip pygsti-0.9.x.zip where the latter file is a downloaded pyGSTi source archive. Any of the above installations should build the set of optional Cython extension modules if a working C/C++ compiler and the Cython package are present. If, however, compilation fails or you later decided to add Cython support, you can rebuild the extension modules (without reinstalling) if you've followed the local installation approach above using the command:

python setup.py build_ext --inplace

Finally, Jupyter notebook is highly recommended as it is generally convenient and the format of the included tutorials and examples. It is installed automatically when [complete] is used, otherwise it can be installed separately.

Getting Started

Here's a couple of simple examples to get you started.

Circuit simulation

To compute the outcome probabilities of a circuit, you just need to create a Circuit object (describing your circuit) and a Model object containing the operations contained in your circuit. Here we use a "stock" single-qubit Model containing Idle, X(Ο€/2), and Y(Ο€/2) gates labelled Gi, Gx, and Gy, respectively:

import pygsti
from pygsti.construction import std1Q_XYI

mycircuit = pygsti.obj.Circuit( ('Gx','Gy','Gx') )
model = std1Q_XYI.target_model()
outcome_probabilities = model.probs(mycircuit)

Gate Set Tomography

Gate Set Tomography is used to characterize the operations performed by hardware designed to implement a (small) system of quantum bits (qubits). Here's the basic idea:

  1. you tell pyGSTi what gates you'd ideally like to perform

  2. pyGSTi tells you what circuits it want's data for

  3. you perform the requested experiments and place the resulting data (outcome counts) into a text file that looks something like:

    ## Columns = 0 count, 1 count
    {} 0 100  # the empty sequence (just prep then measure)
    Gx 10 90  # prep, do a X(pi/2) gate, then measure
    GxGy 40 60  # prep, do a X(pi/2) gate followed by a Y(pi/2), then measure
    Gx^4 20 80  # etc...
    
  4. pyGSTi takes the data file and outputs a "report" - currently a HTML web page.

In code, running GST looks something like this:

import pygsti
from pygsti.construction import std1Q_XYI

# 1) get the ideal "target" Model (a "stock" model in this case)
mdl_ideal = std1Q_XYI.target_model()

# 2) get the building blocks needed to specify which circuits are needed
prepfids, measfids, germs = std1Q_XYI.prepStrs, std1Q_XYI.effectStrs, std1Q_XYI.germs
maxLengths = [1,2,4] # user-defined: how long do you want the circuits?

# 3) generate a list of circuits for GST & write a data-set template
listOfExperiments = pygsti.construction.make_lsgst_experiment_list(
    mdl_ideal, prepfids, measfids, germs, maxLengths)
pygsti.io.write_empty_dataset("MyData.txt", listOfExperiments, "## Columns = 0 count, 1 count")

# STOP! "MyData.txt" now has columns of zeros where actual data should go.
# REPLACE THE ZEROS WITH ACTUAL DATA, then proceed with:
ds = pygsti.io.load_dataset("MyData.txt") # load data -> DataSet object

# 4) run GST
results = pygsti.do_stdpractice_gst(ds, mdl_ideal, prepfids, measfids, germs, maxLengths)

# 5) Create a nice HTML report detailing the results
pygsti.report.create_standard_report(results, filename="myReport", title="Sample Report")

Tutorials and Examples

There are numerous tutorials (meant to be pedagogical) and examples (meant to be demonstrate how to do some particular thing) in the form of Jupyter notebooks beneath the pyGSTi/jupyter_notebooks directory. The root "START HERE" notebook will direct you where to go based on what you're most interested in learning about. You can view the read-only GitHub version of this notebook or you can explore the tutorials interactively using JupyterHub via Binder. Note the existence of a FAQ, which addresses common issues.

Running notebooks locally

While it's possible to view the notebooks on GitHub using the links above, it's usually nicer to run them locally so you can mess around with the code as you step through it. To do this, you'll need to start up a Jupyter notebook server using the following steps (this assumes you've followed the local installation directions above):

  • Changing to the notebook directory, by running: cd jupyter_notebooks/Tutorials/

  • Start up the Jupyter notebook server by running: jupyter notebook

The Jupyter server should open up your web browser to the server root, from where you can start the first "START_HERE.ipynb" notebook. Note that the key command to execute a cell within the Jupyter notebook is Shift+Enter, not just Enter.

Documentation

Online documentation is hosted on Read the Docs.

License

PyGSTi is licensed under the Apache License Version 2.0.

Questions?

For help and support with pyGSTi, please contact the authors at [email protected].

More Repositories

1

wiretap

Wiretap is a transparent, VPN-like proxy server that tunnels traffic via WireGuard and requires no special privileges to run.
Go
847
star
2

toyplot

Interactive plotting for Python.
Jupyter Notebook
422
star
3

Albany

Sandia National Laboratories' Albany multiphysics code
C++
281
star
4

scot

Sandia Cyber Omni Tracker (SCOT)
JavaScript
237
star
5

qthreads

Lightweight locality-aware user-level threading runtime.
C
170
star
6

dr_robot

This tool can be used to enumerate the subdomains associated with a company by aggregating the results of multiple OSINT (Open Source Intelligence) tools.
Python
138
star
7

seacas

The Sandia Engineering Analysis Code Access System (SEACAS) is a suite of preprocessing, postprocessing, translation, and utility applications supporting finite element analysis software using the Exodus database file format.
C
131
star
8

snl-quest

An open source, Python-based software platform for energy storage simulation and analysis developed by Sandia National Laboratories.
Python
128
star
9

InterSpec

spectral radiation analysis software
C++
120
star
10

omega_h

Simplex mesh adaptivity for HPC
C++
105
star
11

slycat

Web-based data science analysis and visualization platform.
JavaScript
75
star
12

pecos

Python package for performance monitoring of time series data
Python
64
star
13

gr-pdu_utils

GNU Radio PDU Utilities
C++
61
star
14

UQTk

Sandia Uncertainty Quantification Toolkit
Fortran
59
star
15

chama

Python package for sensor placement optimization
Python
57
star
16

bcnn

3D Bayesian Convolutional Neural Network (BCNN) for Credible Geometric Uncertainty. Code for the paper: https://arxiv.org/abs/1910.10793
Python
56
star
17

gr-fhss_utils

Bursty modem utilities
C++
56
star
18

Whetstone

Python
47
star
19

TChem

TChem - A Software Toolkit for the Analysis of Complex Kinetic Models
Jupyter Notebook
44
star
20

tracktable

Tracktable: moving object trajectory analysis in C++ and Python
C++
39
star
21

tbnn

This code implements the Tensor Basis Neural Network (TBNN) as described in Ling et al. (Journal of Fluid Mechanics, 2016).
Python
38
star
22

hyram

Python
38
star
23

reverse_argparse

A Python library to determine what exactly the user ran at the command line, along with default values, and any transformations that happened after parsing arguments.
Python
38
star
24

pyapprox

Python
37
star
25

Spitfire

Spitfire is a Python/C++ library for constructing tabulated chemistry models and solving differential equations.
Python
37
star
26

portals4

Portals is a low-level network API for high-performance networking on high-performance computing systems developed by Sandia National Laboratories, Intel Corporation, and the University of New Mexico. The Portals 4 Reference Implementation is a complete implementation of Portals 4, with transport over InfiniBand VERBS and UDP. Shared memory transport is available as an optimization, including Linux KNEM support. The Portals 4 reference implementation is supported on both modern 64 bit Linux and 64 bit Mac OS X. The reference implementation has been developed by Sandia National Laboratories, Intel Corporation, and System Fabric Works. For more information on the Portals 4 standard, please see the Portals 4 page.
C
34
star
27

cross-sim

CrossSim: accuracy simulation of analog in-memory computing
Python
33
star
28

NuMAD

Numerical Manufacturing And Design Tool (NuMAD) -- A design tool for wind and water turbine composite blades
MATLAB
33
star
29

Prove-It

A tool for proving and organizing general theorems using Python.
Jupyter Notebook
27
star
30

SpecUtils

A library for opening, manipulating, and exporting gamma spectral files
C++
26
star
31

optimism

Computational solid mechanics made easy with Jax
Python
26
star
32

spack-manager

A project and machine deployment model using Spack
Python
25
star
33

gr-timing_utils

GNU Radio Timing Utilties
C++
25
star
34

MATLAB_PV_LIB

MATLAB PV function library
HTML
24
star
35

lgrtk

Tool Kit for Lagrangian Grid Reconnection
C++
22
star
36

mac-sandbox

This is a malware analyzer for Mac OS X that extends the Cuckoo Sandbox project (https://cuckoosandbox.org/)
Python
22
star
37

gait

Zeek Extension to Collect Metadata for Profiling of Endpoints and Proxies
Zeek
21
star
38

n2a

An object-oriented language for modeling large-scale neural systems, along with an IDE for writing and simulating models.
Java
21
star
39

MEWS

Multi-scenario Extreme Weather Simulator (MEWS)
Python
20
star
40

spat

A graphical user interface for measuring and performing inter-active analysis of physical unclonable functions (PUFs)
Python
20
star
41

compadre

Compadre (Compatible Particle Discretization and Remap)
C++
20
star
42

pyttb

Python Tensor Toolbox
Python
19
star
43

poblano_toolbox

Nonlinear optimization for MATLAB.
MATLAB
19
star
44

pycheron

Pycheron - A python library for quality control of seismic data based on IRIS Mustang.
Python
18
star
45

MatMCNP

A utility code for generating material cards for MCNP
Python
18
star
46

Zoltan

Zoltan Dynamic Load Balancing and Graph Algorithm Toolkit -- Distribution site
C
18
star
47

pvOps

A set of documented functions for supporting operations research of photovoltaic energy systems.
Jupyter Notebook
18
star
48

verdict

verdict
C++
17
star
49

Chordly

Chordly is a javascript library that may be used to detect and act upon key sequences entered by a user.
JavaScript
17
star
50

SandiaDecay

Easy to use C++ library to calculate nuclear decays and emissions
C++
17
star
51

CACTUS

CACTUS (Code for Axial and Cross-flow TUrbine Simulation) is a turbine performance simulation code, based on a free wake vortex method, to study wind turbines and marine hydrokinetic (MHK) devices.
Fortran
17
star
52

sceptre-phenix

phenix is an orchestration tool and GUI for Sandia's minimega platform
JavaScript
17
star
53

Gulliver

Gulliver is a C# utility package and library engineered for the manipulation of arbitrary sized byte arrays accounting for appropriate endianness and jagged byte length.
C#
15
star
54

PyRIID

ML-based radioisotope identification and estimation from gamma spectra in Python.
Python
15
star
55

suncal

Suncal - Sandia PSL Uncertainty Calculator
Python
14
star
56

Fugu

Python
14
star
57

cambio

Spectroscopic file conversion tool
C
14
star
58

mesquite

Mesquite: Mesh Quality Improvement Toolkit
HTML
14
star
59

sandialabs.github.io

JavaScript
14
star
60

packet2vec

Word2Vec embeddings over packet capture data n-grams.
C++
14
star
61

parapint

Parallel solution of structured nonlinear optimization problems
Python
13
star
62

WecOptTool

WEC Design Optimization Toolbox
Python
13
star
63

Matrices

Contains the matrix generation software and normed matrices described in "Recreating Raven's: Software for systematically generating large numbers of Raven-like matrix problems with normed properties," published in Behavior Research Methods in 2010
13
star
64

SNL-Delft3D-CEC

Fortran
12
star
65

staged-script

A Python package enabling the development of robust automation scripts that are subdivided into stages.
Python
12
star
66

p3a

Portably Performant Physical Algebra
C++
12
star
67

LCM

Laboratory for Computational Mechanics
C++
12
star
68

gr-sandia_utils

Misc blocks
C++
12
star
69

RUBRIC

C++
12
star
70

parsegen-cpp

A C++17 library for parser generation for LALR(1) languages
C++
12
star
71

snl-pstess

The Power and Energy Storage Systems Toolbox
MATLAB
12
star
72

sibl

Sandia Injury Biomechanics Laboratory (SIBL)
Python
11
star
73

shadow

Shadow semi-supervised consistency regularization PyTorch library
Python
11
star
74

lim1tr

Lithium-Ion Modeling with 1-D Thermal Runaway (LIM1TR)
Python
11
star
75

StrideSearch

Storm detection in climate data
C++
11
star
76

SNL-SWAN

SNL-SWAN
Fortran
11
star
77

sceptre-bennu

Modeling and simulation of ICS devices
C++
11
star
78

barcs

Ballistic Asynchronous Reversible Computing with Superconductors -- Tool for functional element enumeration and classification.
Python
10
star
79

lapart-python

Python
10
star
80

TIGER

Target / Integrative Genetic Element Retriever: precisely maps IGEs (a defined type of genomic island) in bacterial and archaeal genomes; package also includes orthogonal program Islander
Perl
10
star
81

miniIsosurface

A mini-app to explore algorithms for generating contours from 3D volumes.
C++
10
star
82

chemical-recommender-system

Platform for rapid computation of molecular similarity and integration of custom machine learning models
Python
9
star
83

sdynpy

A Structural Dynamics Python Library
Python
9
star
84

quinn

Quantification of Uncertainties in Neural Networks
Python
9
star
85

Arcus

Arcus, developed by Sandia National Laboratories, is a C# library for calculating, parsing, formatting, converting and comparing both IPv4 and IPv6 addresses and subnets. It accounts for 128-bit numbers on 32-bit platforms.
C#
9
star
86

SpokeDartsPublic

SpokeDarts sphere-packing sampling in any dimension. Advancing front sampling from radial lines (spokes) through prior samples.
C++
9
star
87

linkshop

Python
8
star
88

capp

A simple, portable package manager for applications
CMake
8
star
89

pyperc

Python package to model invasion percolation
Python
8
star
90

Fenix

Fenix: A Portable, Flexible Fault Tolerance Programming Framework for MPI Applications
C
8
star
91

svp_1547.1

Test scripts for IEEE 1547.1
Python
8
star
92

pyNuMAD

pynumad is an object-oriented, open-source software program written in Python which simplifies the process of creating a three-dimensional model of a wind turbine blade.
Python
8
star
93

rattlesnake-vibration-controller

Vibration Controller targetting Multiple-Input-Multiple-Output (MIMO) and Combined Environments Control
Python
8
star
94

mcdn-3d-seg

Monte Carlo Dropout Network for 3D Image Segmentation
Python
8
star
95

phoenix

An astrodynamics library.
Scala
7
star
96

xyz

zip metadata extraction tool
Python
7
star
97

CSPlib

Computational singular perturbation analysis library
Jupyter Notebook
7
star
98

BioCompoundML

BioCompoundML is a software tool for rapidly screening chemicals by chemical properties, using machine learning.
Python
7
star
99

miniGraphics

Miniapp to demonstrate parallel rendering in an MPI environment using a sort-last parallel rendering approach.
C++
7
star
100

PRIME

PRIME is a modeling framework designed for the "real-time" characterization and forecasting of partially observed epidemics
Python
7
star