Defines the ElementaryErrorgenLabel class and supporting functionality.

Module Contents



TODO: docstring - for entire module


Labels an elementary error generator by simply a type and one or two


Labels an elementary error generator on n qubits that includes the state

class pygsti.baseobjs.errorgenlabel.ElementaryErrorgenLabel

Bases: object

TODO: docstring - for entire module

class pygsti.baseobjs.errorgenlabel.LocalElementaryErrorgenLabel(errorgen_type, basis_element_labels)

Bases: ElementaryErrorgenLabel

Labels an elementary error generator by simply a type and one or two basis element labels.

classmethod cast(obj, sslbls=None, identity_label='I')
class pygsti.baseobjs.errorgenlabel.GlobalElementaryErrorgenLabel(errorgen_type, basis_element_labels, sslbls, sort=True)

Bases: ElementaryErrorgenLabel

Labels an elementary error generator on n qubits that includes the state space labels on which the generator acts (unlike a “local” label, i.e. a LocalElementaryErrorgenLabel which doesn’t)

property support

Returns a sorted tuple of the elements of self.sslbls

classmethod cast(obj, sslbls=None, identity_label='I')

TODO: docstring - lots in this module

padded_basis_element_labels(all_sslbls, identity_label='I')

Idle-padded versions of this label’s basis element labels based on its state space labels.

A tuple of strings which positions the non-trivial single-qubit labels within the elements of self.basis_element_labels into a background of identity_label characters. For example, if the ordering of all_sslbls is (0, 1, 2), self.sslbls is (1,), and self.basis_element_labels is (‘X’,) then this method returns (‘IXI’,).

For this method to work correctly, basis element labels should be composed of single characters corresponding to non-trivial single-qubit basis elements, and the total basis element should be a product of these along with the identity on the state space labels absent from self.sslbls.



An ordered list of the entirety of the state space labels to create padded basis element labels for. For example, (0, 1, 2) or (‘Q0’, ‘Q1’, ‘Q2’).

identity_labelstr, optional

The single-character label used to indicate the single-qubit identity operation.



A tuple of strings.


Creates a new GlobalElementaryErrorgenLabel whose sslbls attribute is updated according to a mapping function.


mapperdict or function

A dictionary whose keys are the existing self.sslbls values and whose value are the new labels, or a function which takes a single existing state space label argument and returns a new state space label to replace it with.




Creates a new GlobalElementaryErrorgenLabel with sorted (potentially reordered) state space labels.

This puts the label into a canonical form that can be useful for comparison with other labels.