Reference API#
deltakit.circuit#
Top Level#
deltakit.circuit provides classes to represent Stim circuit elements
and functions/methods for interacting with them. The following features
are imported directly from the top-level module.
Circuit Building Blocks#
|
The deltakit_circuit circuit class. |
|
Class which represents a single time step in a circuit for gates. |
|
Class which represents noise in a circuit. |
|
Abstraction of an immutable qubit type. |
|
Annotates that a set of measurements can be used to detect errors, because the set's parity should be deterministic. |
|
A logical observable as defined by stim. |
|
Annotates a shift in the coordinates within a stim circuit. |
|
Abstraction of a sweep bit as used by stim. |
|
Reference to a measurement that has been made |
Paulis#
|
Representation of an X gate on a single qubit which is used in Pauli products. |
|
Representation of a Y gate on a single qubit which is used in Pauli products. |
|
Representation of a Z gate on a single qubit which is used in Pauli products. |
|
A collection of Pauli gates which together make up a Pauli product. |
|
Representation of an X gate measurement on a single qubit the result of which can be inverted. |
|
Representation of a Y gate measurement on a single qubit the result of which can be inverted. |
|
Representation of a Z gate measurement on a single qubit the result of which can be inverted. |
|
A representation of a Pauli product which can include invertible Pauli gates. |
Typing#
Represent a PEP 604 union type |
|
A Mapping is a generic container for associating key/value pairs. |
|
Circuit Manipulation and Noise Generation#
|
Uses deltakit_circuit to remove a given set of detectors from a stim circuit and returns the new stim circuit |
|
Returns a set of callables that can be passed to deltakit_circuit.Circuit.apply_gate_noise to apply DEPOLARIZE1(probability) operations after every single-qubit Clifford gate and DEPOLARIZE2(probability) operations after every two-qubit Clifford operation |
|
Returns a set of callables that can be passed to deltakit_circuit.Circuit.apply_gate_noise to apply X_ERROR(probability) operations before every reset gate that is not in the X basis and Z_ERROR(probability) operations on every reset gate that is in the X basis |
|
Returns a set of callables that can be passed to deltakit_circuit.Circuit.apply_gate_noise to apply X_ERROR(probability) operations before every measurement gate that is not in the X basis and Z_ERROR(probability) operations on every measurement gate that is in the X basis |
|
Return a mapping from deltakit_circuit measurement types to the callables that can construct a gate of that type with a error probability as specified |
Generate a noise profile for a given gate, with additional noise across all other qubits in the circuit that are not operated on by the given gate in a given gate layer |
Other#
|
Class which represents general coordinates. |
|
Circuit data passed by deltakit_circuit.Circuit.apply_gate_noise to the noise generation functions. |
deltakit.circuit.gates#
deltakit.circuit.gates contains class-based representations of Stim gates.
One-Qubit Gates#
|
Identity gate. |
|
The Hadamard gate. |
|
A variant of the Hadamard gate that swaps the X and Y axes (instead of X and Z). |
|
A variant of the Hadamard gate that swaps the Y and Z axes (instead of X and Z). |
|
Pauli X gate. |
|
Principal square root of X gate. |
|
Adjoint of the principal square root of X gate. |
|
Pauli Y gate. |
|
Principal square root of Y gate. |
|
Adjoint of the principal square root of Y gate. |
|
Pauli Z gate. |
|
Principal square root of Z gate. |
|
Adjoint of the principal square root of Z gate. |
|
Right handed period 3 axis cycling gate, sending X -> Y -> Z -> X. |
|
Left handed period 3 axis cycling gate, sending Z -> Y -> X -> Z. |
Two-Qubit Gates#
|
The Z-controlled X gate. |
|
The Z-controlled Y gate. |
|
The Z-controlled Z gate. |
|
The X-controlled X gate. |
|
The X-controlled Y gate. |
|
The X-controlled Z gate. |
|
The Y-controlled X gate. |
|
The Y-controlled Y gate. |
|
The Y-controlled Z gate. |
|
Swaps two qubits. |
|
A combination CX-and-SWAP gate. |
|
A combination CZ-and-SWAP gate. |
|
Swaps two qubits and phases the -1 eigenspace of the ZZ observable by i. |
|
Swaps two qubits and phases the -1 eigenspace of the ZZ observable by -i. |
|
Phases the -1 eigenspace of the XX observable by i. |
|
Phases the -1 eigenspace of the XX observable by -i. |
|
Phases the -1 eigenspace of the YY observable by i. |
|
Phases the -1 eigenspace of the YY observable by -i. |
|
Phases the -1 eigenspace of the ZZ observable by i. |
|
Phases the -1 eigenspace of the ZZ observable by -i. |
Measurement Gates#
|
X-basis measurement (optionally noisy). Projects each target qubit into |
|
Y-basis measurement (optionally noisy). |
|
Z-basis measurement (optionally noisy). |
|
X-basis demolition measurement (optionally noisy). |
|
Y-basis demolition measurement (optionally noisy). |
|
Z-basis demolition measurement (optionally noisy). |
|
Measure Pauli products. |
Reset Gates#
|
X - basis reset. |
|
Y - basis reset. |
|
Z - basis reset. |
Leakage Gates#
|
The single qubit leakage heralding gate (optionally noisy). |
Abstract Gates#
|
Abstract gate class from which all other gate classes must inherit. |
|
Gate for the abstract single qubit Clifford gate. |
|
Abstraction of a single qubit gate. |
|
Abstraction of a Clifford gate which take two generic operands. |
|
Gate for the abstract single qubit measurement gate. |
|
Gate for the abstract single qubit reset gate. |
|
Abstraction of a two-qubit gate which is symmetric in the control and target qubits. |
|
The different Pauli bases for measurement and reset gates. |
Gates Sets#
Build an immutable unordered collection of unique elements. |
|
Build an immutable unordered collection of unique elements. |
|
Build an unordered collection of unique elements. |
|
Build an immutable unordered collection of unique elements. |
|
Build an immutable unordered collection of unique elements. |
deltakit.circuit.noise_channels#
Description of deltakit.circuit.noise_channels namespace here.
|
Abstract noise channel which contains multiple probabilities. |
|
Abstract base noise channel which all other noise channel classes must implement. |
|
Abstract noise channel which contains only one probability. |
|
Abstract noise channel which only acts on a single qubit. |
|
Abstract noise channel which acts on pairs of qubits. |
|
Probabilistically applies a Pauli product error with a given probability. |
|
Probabilistically applies a Pauli product error with a given probability, unless the "correlated error occurred flag" is set. |
|
The one-qubit depolarising channel. |
|
The two-qubit depolarising channel. |
|
The single qubit leakage channel. |
|
The single qubit relaxation channel. |
|
A single qubit Pauli error channel with explicitly specified probabilities for each case. |
|
A two-qubit Pauli error channel with explicitly specified probabilities for each case. |
|
Applies a Pauli X with a given probability. |
|
Applies a Pauli Y with a given probability. |
|
Applies a Pauli Z with a given probability. |
deltakit.core#
Description of deltakit.core namespace here.
deltakit.core.data_formats#
Description of deltakit.core.data_formats namespace here.
|
Given a b8 input (either a file path containing b8 data or bytes), and the number of detectors that should be in each syndrome, return a generator of logical flips. |
|
Given a b8 input (a file path containing b8 data), and the number of measurements in each shot, return a generator of measurement bitstrings. |
|
Given a b8 input (either a file path containing b8 data or bytes), and the number of detectors that should be in each syndrome, return a generator of syndromes. |
|
Given a path to a c64 file, return, for each line, the words within the line and the index of each word in each round. |
Given a logical flip generator, this will output them to file in the b8 format. |
|
|
Given a filepath for a 01 file containing target logical flips, return a generator of logical flips as booleans. |
|
Given a filepath for a 01 file containing syndromes, return a generator of OrderedSyndromes. |
|
Given a list of round-split decoder input data, this will output them to a file as comma separated 64-bit integers. |
|
Given a syndrome generator, this will output them to file in the b8 format. |
|
Converts either the content of a file or a bytes object to a bytearray object. |
deltakit.core.decoding_graphs#
Description of deltakit.core.decoding_graphs namespace here.
Type variable. |
|
|
Class which efficiently represents a bitstring. |
|
Make a new graph from the given graph where the error probabilities on the edges are changed to the new error probabilities. |
|
Calculates the minimum distance for all logicals. |
|
Computes the distance of the decoding graph given a logical. |
|
Convenience class encapsulating the annotated hypergraph and logicals. |
|
Representation of an immutable decoding edge on a decoding graph, limited to standard graphs where edges connect two distinct detectors. |
|
Representation of an immutable decoding edge on a hyper-graph. |
|
Representation of a decoding hypergraph, built to handle Stim-based noise sources. |
|
Representation of a decoding multigraph with hyper-edges. |
|
Generate decompositions of the given edge into the parts from edges. |
Convert a detector error model into a NXDecodingGraph object and a list of edges which effect particular logicals. |
|
Convert a Stim detector error model into a DecodingHyperGraph and a list of edges which affect the logical observable at the index in the list. |
|
|
Class which handles parsing a detector error model. |
Error handler that counts the number of detectors that each error flips. |
|
|
Dictionary for recording information about a detector. |
A type of detector handler which populates a dictionary of DetectorRecords. |
|
|
Dictionary for recording information about an edge. |
Type variable. |
|
|
Take decoding edges and convert to an ordered syndrome that would be observed if all decoding edges were to be active. |
|
Extract which edges affect which logical observables from a graph by looking through the edge records. |
|
Given some decoding edges, filter to those that directly correspond to a data qubit. |
|
Given some decoding edges, filter to those that directly correspond to a measurement event, i.e. they only move in the time axis. |
|
Class which represents a fixed precision bitstring. |
|
For given sparse-form sequence, return the corresponding bit-strings that correspond to individual decoding rounds. |
|
Represent some graph as an edge list in JSON. |
|
Returns whether the nodes of the graph have contiguous indices with respect to the start index. |
|
Return a weighted edge list representation of a decoding hypergraph. |
All the operations on a read-only sequence. |
|
Class for abstract immutable multigraph with hyperedges. |
|
|
Given a decoding graph and a logical, that is assumed to be along the boundary, return another logical constructed of all the edges incident to the boundary that are not in the given logical. |
Determines whether a graph consists of a single connected component excluding the boundary nodes of the graph. |
|
|
A type of edge handler which collects the errors into a set of edges and edges which affect the logicals. |
|
Convenience class encapsulating the graph and logicals. |
|
Implementation of a decoding graph using NetworkX and the QEC syndrome and edge objects. |
|
Implementation of a decoding multigraph using NetworkX and QEC syndrome and edge objects. |
All the operations on a read-only sequence. |
|
|
Type of logical observable handler which raises a warning when this instruction is encountered. |
|
Immutable ordered mod 2 set of decoding edges. |
|
Immutable ordered mod 2 set of detectors. |
|
Parse an explained DEM into a hyper-multi-graph. |
|
|
|
Sets all weights in the given graph to 1 and error probabilities to 1/(1+e) so that they correspond to the weights. |
|
Treat the edges of a graph as vectors and return a mapping of normalised vectors to a list of weights on those vectors. |
|
For a given decoding_graph representing error mechanisms, and a target_logical_error, return the largest number of detection events we would expect to observe on the decoding_graph. |
deltakit.decode#
Description of deltakit.decode namespace here.
|
PyMatching decoder for minimum weight perfect matching (MWPM), configured to use our decoding graph representation. |
|
Minimum Weight Perfect Matching Decoder (Cloud-based). |
|
Collision Clustering Decoder (Cloud-based). |
|
Belief Matching Decoder (Cloud-based). |
|
Belief Propagation - Ordered Statistics Decoder (Cloud-based). |
|
Ambiguity Clustering Decoder (Cloud-based). |
|
Local Clustering Decoder (Cloud-based). |
deltakit.decode.analysis#
Description of deltakit.decode.analysis namespace here.
|
Class for the abstract DecoderManger, objects that manage the running of a decoder for multiple shots, whilst reporting on the failure rate and running other reporters. |
Raise when decoder manager is not set in global memory or has invalid state token. |
|
|
Compute LEP of the decoder with given circuit. |
Data structure for storing data related to decoding events. |
|
|
Decoder manager to run experiments defined by a b8 input for syndromes and target logical flips. |
|
Decoder manager for a graph decoder with an edge-based noise model. |
|
Decoder manager to support Stim circuits being used for noise generation, and Stim observables to define decoder success. |
|
Class to run experiments on different codes and decoders, it will run all of the given sequence of decoder managers. |
deltakit.decode.noise_sources#
Description of deltakit.decode.noise_sources namespace here.
|
Class to combine several independent noise sources into one combined model, where each error returned from one of the internal sources becomes an element in a tuple. |
|
Class to combine several sequential noise sources into one combined model, where each error returned from one of the internal sources becomes an element in a tuple. |
Abstract class to manage the production of non-terminating independent noise generators. |
|
Abstract class to manage the production of deterministically sized terminating noise generators. |
|
|
A noise model that defines noise over a decoding graph based on the edge probabilities. |
|
A noise model that outputs all errors with a given weight. |
|
A noise model that outputs all errors where their weighted error locations sum up to less than a given exhaustion ceiling |
|
A noise model that outputs errors over basic events with fixed weight of activated events. |
A noise model that outputs an infinite stream of empty decoding edge lists. |
|
|
Noise model that simulates a simple erasure channel. |
|
A noise model that defines noise over a single decoding graph, where all decoding edges are assigned a uniform weight and sampled randomly with given probability. |
|
A class with the ability to manipulate lestim circuits with after clifford gate depolarisation, before measure flip probability and after reset flip probability. |
|
A noise model that uses a stim file, without modification, to generate noise. |
|
A noise model that takes a set of noise profiles that can be applied to a lestim circuit. |
|
A noise model which adds: |
deltakit.decode.utils#
|
Calculates the Pij values given the <Xi> <Xj> etc values. |
|
Generate a correlation matrix for a given Pij matrix. |
|
Create a detector error model from a Pij probabilities data set and accompanying stim Circuit. |
|
Given a stim.DetectorErrorModel and Pij matrix, compare the two to find the maximum difference in probability between similar edges. |
|
Generates the <Xi>, <Xj>, <Xij> etc expectation values for deriving Pij probabilities. |
|
Produce a logger with sensible properties. |
|
Parse a Stim file into a decoding graph and the relevant logicals. |
|
Given a stim.DetectorErrorModel and Pij dict, compare the two to see if they contain the same edges w.r.t nodes in the edges. |
|
Compare two Pij matrices containing identical edges w.r.t nodes and return the maximum difference between similar edges' probabilities. |
|
Compare two Pij dicts to see if they contain the same edges. |
|
Plot a given correlation matrix as a heatmap. |
|
Split a measurement bitstring according to the number of measurements in each layer of the circuit. |
|
Class to render 2+1D DecodingGraphs using plotly. |
deltakit.explorer#
Description of deltakit.explorer namespace here.
|
The Client class provides convenient methods to access circuit generation, noise addition, decoding, simulation, and analysis calls. To create a connection to a particular server, use the following syntax::. |
|
This class enables client-side logging, generates unique request identifiers and proxies events from the calling environment (e.g. JupyterHub or gql library). |
deltakit.explorer.analysis#
Description of deltakit.explorer.analysis namespace here.
Calculate the error suppression factor (Λ) and its standard deviation. |
|
|
Calculate the logical error probability and its standard deviation. |
|
Implement logical error probability per round fit as described in https://arxiv.org/pdf/2310.05900.pdf (p.40) and https://arxiv.org/pdf/2207.06431.pdf (p.21). |
|
Get the best fit line with gradient lambda for plotting purposes. |
deltakit.explorer.plotting#
Description of deltakit.explorer.plotting namespace here.
|
Plot a given correlation matrix as a heatmap. |
|
Plots defect rates patch diagram given detector coordinates and their error rates. |
|
Convenience function to plot the average defect rate plot fig 2b in Google paper https://www.nature.com/articles/s41586-022-05434-1. |
deltakit.explorer.codes#
Description of deltakit.explorer.codes namespace here.
|
Class representing a CSS code. |
|
Return a noiseless deltakit.circuit.Circuit for an X or Z quantum memory experiment for CSS codes. |
|
Return a noiseless deltakit.circuit.Circuit for an X or Z quantum stability experiment for CSS codes. |
|
Class representing a computational stage in a CSS code experiment. |
|
Return a noiseless Circuit for an experiment represented by the input Sequence of CSSStage instances. |
|
Class representing an abstract stabiliser code. |
|
Class to represent the IBM Bivariate Bicycle qLDPC codes, as specified in arXiv:2308.07915. |
|
Class used to encapsulate the "Monomial" concept used in the IBM paper. |
|
Class to encapsulate the "Polynomial" concept used in the IBM paper. |
|
Enum for specifying the schedule type for measuring stabilisers for a planar code. |
|
Class representing the default rotated planar code. |
|
Class representing the unrotated planar code. |
|
Class representing the default unrotated toric code. |
|
Class representing an n-qubit repetition code for memory and stability experiments. |
deltakit.explorer.data#
Description of deltakit.explorer.data namespace here.
|
Read 01 data from steam, StringIO or file descriptor. |
|
Read bit-packed data from steam, BytesIO or file descriptor. |
|
Read CSV data from steam, StringIO or file descriptor. |
|
Write data into a text stream in 01 format. |
|
Write data into a bytes stream in B8 format. |
|
Writes a stream of bit lines (each List[int] is a line of {0, 1}) into a file of desired format. |
deltakit.explorer.enums#
Description of deltakit.explorer.enums namespace here.
|
Represent common data representation formats. |
|
Decoder types, supported by a client. |
|
Type of QEC code. |
|
Type of QEC experiment. |
deltakit.explorer.qpu#
Description of deltakit.explorer.qpu namespace here.
|
Class capturing properties and functionality of a QPU. |
|
Class for capturing native gate sets of a quantum computer. |
|
Class for capturing native gate sets of a quantum computer and times of gate execution (in seconds). |
Class for capturing gateset of a quantum computer that can perform all gates natively. |
|
|
Dataclass to capture a noise model for a quantum computer. |
|
Class for capturing phenomenological noise. |
|
The standard depolarising noise model as seen in QEC literature, e.g.: Table 2 in https://arxiv.org/abs/2108.10457 This model sets all one- and two-qubit depolarising error probabilities to p, as well as setting all measurement flip probabilities to p. |
|
Superconducting inspired noise model from: https://arxiv.org/abs/2108.10457. |
|
A noise model specified only by two parameters. |
|
Gets gate noise parameters given physical gate data |
deltakit.explorer.simulation#
Description of deltakit.explorer.simulation namespace here.
|
This method simulates the circuit using a Clifford STIM simulator. |
deltakit.explorer.types#
Description of deltakit.explorer.types namespace here.
|
Data string is a normal string which encodes arbitrary binary data (e.g. Stim circuit file, or measurements data). |
|
Represents a core of simulated experiment: |
|
Definition, essential to generate a QEC experiment circuit. |
|
Any binary table, stored in a file, datastring, or RAM. |
|
Parameter to be passed as a type for additional parameters for generate_circuit |
|
Common settings for decoding. |
|
Results of decoding |
|
Binary table, representing detectors. |
|
Binary table, representing heralded leakage flags. |
|
Parameters to be passed to BivariateBicycle code type, IBM Bivariate Bicycle qLDPC codes, as specified in arXiv:2308.07915. |
|
Binary table representing measurements. |
Generic noise model class. |
|
|
Binary table, representing observables. |
|
Physically-inspired noise model. |
Mapping of detectors to qubit coordinates. |
|
|
An wrapper around a collection stored in RAM. |
|
The SI 1000 (Superconducting Inspired with 1000 nanosecond cycle) noise model, with leakage. |
|
The size parameter to be passed to generate_circuit() method. |
|
Basic class for all typed data manipulation activities. |
|
Data file with typed content. |
|
Typed data string. |