pygsti.modelpacks

Preset definitions for working with well-known common models

Subpackages

Submodules

Package Contents

Classes

ModelPack

ABC of all derived modelpack types

GSTModelPack

ABC for modelpacks with GST information

RBModelPack

Quantities related to performing Randomized Benchmarking (RB) on a given gate-set or model.

class pygsti.modelpacks.ModelPack

Bases: abc.ABC

ABC of all derived modelpack types

Attributes

descriptionstr

a description of the model pack.

gateslist

a list of the gate labels of this model pack.

_sslblstuple

a tuple of the state space labels (usually qubit labels) of this model pack.

description
gates
target_model(gate_type='full', prep_type='auto', povm_type='auto', instrument_type='auto', simulator='auto', evotype='default', qubit_labels=None)

Returns a copy of the target model in the given parameterization.

Parameters
parameterization_type{“TP”, “CPTP”, “H+S”, “S”, … }

The gate and SPAM vector parameterization type. See Model.set_all_parameterizations() for all allowed values.

simulatorForwardSimulator or {“auto”, “matrix”, “map”}

The simulator (or type) to be used for model calculations (leave as “auto” if you’re not sure what this is).

qubit_labelstuple, optional

A tuple of qubit labels, e.g. (‘Q0’, ‘Q1’) or (0, 1). The default are the integers starting at 0.

evotypeEvotype or str, optional

The evolution type of this model, describing how states are represented. The special value “default” is equivalent to specifying the value of pygsti.evotypes.Evotype.default_evotype.

Returns

Model

processor_spec(qubit_labels=None)

Create a processor specification for this model pack with the given qubit labels.

Parameters
qubit_labelstuple, optional

A tuple of qubit labels, e.g. (‘Q0’, ‘Q1’) or (0, 1). The default are the integers starting at 0.

Returns

QubitProcessorSpec

class pygsti.modelpacks.GSTModelPack

Bases: ModelPack

ABC for modelpacks with GST information

Attributes

_germslist

a list of “full” germ circuits, found by randomizing around the target model.

_germs_litelist

a list of “lite” germ circuits, found without randomizing around the target model.

_fiducialslist

a list of the fiducial circuits in cases when the preparation and measurement fiducials are the same.

_prepfiducialslist

the preparation fiducials.

_measfiducialslist

the measurement fiducials.

global_fidpairslist

a list of 2-tuples of integers indexing _prepfiducials and _measfiducials respectively, giving a list of global fiducial-pair-reduction results for _germs.

global_fidpairs_litelist

a list of 2-tuples of integers indexing _prepfiducials and _measfiducials respectively, giving a list of global fiducial-pair-reduction results for _germs_lite.

_pergerm_fidpairsdictdict

a dictionary with germ circuits (as tuples of labels) as keys and lists of 2-tuples as values. The 2-tuples contain integers indexing _prepfiducials and _measfiducials respectively, and together this dictionary gives per-germ FPR results for _germs.

_pergerm_fidpairsdict_litedict

a dictionary with germ circuits (as tuples of labels) as keys and lists of 2-tuples as values. The 2-tuples contain integers indexing _prepfiducials and _measfiducials respectively, and together this dictionary gives per-germ FPR results for _germs_lite.

global_fidpairs
global_fidpairs_lite
germs(qubit_labels=None, lite=True)

Returns the list of germ circuits for this model pack.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

litebool, optional

Whether to return the “lite” set of germs, which amplifies all the errors of the target model to first order. Setting lite=False will result in more (significantly more in 2+ qubit cases) germs which are selected to amplify all the errors of even small deviations from the target model. Usually this added sensitivity is not worth the additional effort required to obtain data for the increased number of circuits, so the default is lite=True.

Returns

list of Circuits

fiducials(qubit_labels=None)

Returns the list of fiducial circuits for this model pack.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

list of Circuits

prep_fiducials(qubit_labels=None)

Returns the list of preparation fiducials for this model pack.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

list of Circuits

meas_fiducials(qubit_labels=None)

Returns the list of measurement fiducials for this model pack.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

list of Circuits

pergerm_fidpair_dict(qubit_labels=None)

Returns the per-germ fiducial pair reduction (FPR) dictionary for this model pack.

Note that these fiducial pairs correspond to the full (lite=False) set of germs.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

dict

pergerm_fidpair_dict_lite(qubit_labels=None)

Returns the per-germ fiducial pair reduction (FPR) dictionary for this model pack.

Note that these fiducial pairs correspond to the lite set of germs.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

dict

get_gst_experiment_design(max_max_length, qubit_labels=None, fpr=False, lite=True, evotype='default', **kwargs)
create_gst_experiment_design(max_max_length, qubit_labels=None, fpr=False, lite=True, **kwargs)

Construct a protocols.gst.StandardGSTDesign from this modelpack

Parameters
max_max_lengthnumber or list

The greatest maximum-length to use. Equivalent to constructing a StandardGSTDesign with a max_lengths list of powers of two less than or equal to the given value. If a list is given, that this is treated as the raw list of maximum lengths, rather than just the maximum.

qubit_labelstuple, optional

A tuple of qubit labels. None means the integers starting at 0.

fprbool, optional

Whether to reduce the number of sequences using fiducial pair reduction (FPR).

litebool, optional

Whether to use a smaller “lite” list of germs. Unless you know you have a need to use the more pessimistic “full” set of germs, leave this set to True.

Returns

StandardGSTDesign

create_gst_circuits(max_max_length, qubit_labels=None, fpr=False, lite=True, **kwargs)

Construct a pygsti.objects.CircuitList from this modelpack.

Parameters
max_max_lengthnumber

The greatest maximum-length to use. Equivalent to constructing a cicuit struct with a max_lengths list of powers of two less than or equal to the given value.

qubit_labelstuple, optional

A tuple of qubit labels. None means the integers starting at 0.

fprbool, optional

Whether to reduce the number of sequences using fiducial pair reduction (FPR).

litebool, optional

Whether to use a smaller “lite” list of germs. Unless you know you have a need to use the more pessimistic “full” set of germs, leave this set to True.

Returns

: class:pygsti.objects.CircuitList

class pygsti.modelpacks.RBModelPack

Bases: ModelPack

Quantities related to performing Randomized Benchmarking (RB) on a given gate-set or model.

Attributes

_clifford_compilationOrderedDict

A dictionary whose keys are all the n-qubit Clifford gates, “GcX”, where X is an integer, and whose values are circuits (given as tuples of labels) specifying how to compile that Clifford out of the native gates.

clifford_compilation(qubit_labels=None)

Return the Clifford-compilation dictionary for this model pack.

This is a dictionary whose keys are all the n-qubit Clifford gates, “GcX”, where X is an integer, and whose values are circuits (given as tuples of labels) specifying how to compile that Clifford out of the native gates.

Parameters
qubit_labelstuple, optional

If not None, a tuple of the qubit labels to use in the returned circuits. If None, then the default labels are used, which are often the integers beginning with 0.

Returns

dict