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

description

a description of the model pack.

Type

str

gates

a list of the gate labels of this model pack.

Type

list

_sslbls

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

Type

tuple

description
gates
_sslbls
abstract _target_model(self, sslbls, **kwargs)
_build_explicit_target_model(self, sslbls, gate_names, gate_expressions, **kwargs)

A helper function for derived classes which create explicit models. Updates gate names and expressions with a given set of state-space labels.

target_model(self, 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 :function:`Model.set_all_parameterizations` for all allowed values.

  • simulator (ForwardSimulator 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_labels (tuple, optional) – A tuple of qubit labels, e.g. (‘Q0’, ‘Q1’) or (0, 1). The default are the integers starting at 0.

  • evotype (Evotype 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(self, qubit_labels=None)

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

Parameters

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

Returns

QubitProcessorSpec

_get_cachefile_names(self, param_type, simulator)

Get the standard cache file names for a modelpack

class pygsti.modelpacks.GSTModelPack

Bases: ModelPack

ABC for modelpacks with GST information

_germs

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

Type

list

_germs_lite

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

Type

list

_fiducials

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

Type

list

_prepfiducials

the preparation fiducials.

Type

list

_measfiducials

the measurement fiducials.

Type

list

global_fidpairs

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

Type

list

global_fidpairs_lite

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

Type

list

_pergerm_fidpairsdict

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.

Type

dict

_pergerm_fidpairsdict_lite

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.

Type

dict

_germs
_germs_lite
_fiducials
_prepfiducials
_measfiducials
global_fidpairs
global_fidpairs_lite
_pergerm_fidpairsdict
_pergerm_fidpairsdict_lite
_indexed_circuits(self, prototype, index)
_indexed_circuitdict(self, prototype, index)
germs(self, qubit_labels=None, lite=True)

Returns the list of germ circuits for this model pack.

Parameters
  • qubit_labels (tuple, 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.

  • lite (bool, 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(self, qubit_labels=None)

Returns the list of fiducial circuits for this model pack.

Parameters

qubit_labels (tuple, 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(self, qubit_labels=None)

Returns the list of preparation fiducials for this model pack.

Parameters

qubit_labels (tuple, 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(self, qubit_labels=None)

Returns the list of measurement fiducials for this model pack.

Parameters

qubit_labels (tuple, 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(self, 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_labels (tuple, 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(self, 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_labels (tuple, 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(self, max_max_length, qubit_labels=None, fpr=False, lite=True, evotype='default', **kwargs)
create_gst_experiment_design(self, max_max_length, qubit_labels=None, fpr=False, lite=True, **kwargs)

Construct a protocols.gst.StandardGSTDesign from this modelpack

Parameters
  • max_max_length (number 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_labels (tuple, optional) – A tuple of qubit labels. None means the integers starting at 0.

  • fpr (bool, optional) – Whether to reduce the number of sequences using fiducial pair reduction (FPR).

  • lite (bool, 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(self, max_max_length, qubit_labels=None, fpr=False, lite=True, **kwargs)

Construct a pygsti.objects.CircuitList from this modelpack.

Parameters
  • max_max_length (number) – 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_labels (tuple, optional) – A tuple of qubit labels. None means the integers starting at 0.

  • fpr (bool, optional) – Whether to reduce the number of sequences using fiducial pair reduction (FPR).

  • lite (bool, 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.

_clifford_compilation

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.

Type

OrderedDict

_clifford_compilation
clifford_compilation(self, 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_labels (tuple, 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