pygsti.circuits.circuitlist
Defines the CircuitList class, for holding meta-data alongside a list or tuple of Circuits.
Module Contents
Classes
A unmutable list (a tuple) of |
- class pygsti.circuits.circuitlist.CircuitList(circuits, op_label_aliases=None, circuit_rules=None, circuit_weights=None, name=None)
Bases:
pygsti.baseobjs.nicelyserializable.NicelySerializable
A unmutable list (a tuple) of
Circuit
objects and associated metadata.Parameters
- circuitslist
The list of circuits that constitutes the primary data held by this object.
- op_label_aliasesdict, optional
Dictionary of circuit meta-data whose keys are operation label “aliases” and whose values are circuits corresponding to what that operation label should be expanded into before querying the dataset. Defaults to the empty dictionary (no aliases defined). e.g. op_label_aliases[‘Gx^3’] = pygsti.baseobjs.Circuit([‘Gx’,’Gx’,’Gx’])
- circuit_weightsnumpy.ndarray, optional
If not None, an array of per-circuit weights (of length equal to the number of circuits) that are typically used to multiply the counts extracted for each circuit.
- namestr, optional
An optional name for this list, used for status messages.
Create a CircuitList.
Parameters
- circuitslist
The list of circuits that constitutes the primary data held by this object.
- op_label_aliasesdict, optional
Dictionary of circuit meta-data whose keys are operation label “aliases” and whose values are circuits corresponding to what that operation label should be expanded into before querying the dataset. Defaults to the empty dictionary (no aliases defined). e.g. op_label_aliases[‘Gx^3’] = pygsti.baseobjs.Circuit([‘Gx’,’Gx’,’Gx’])
- circuit_ruleslist, optional
A list of (find,replace) 2-tuples which specify circuit-label replacement rules. Both find and replace are tuples of operation labels (or Circuit objects).
- circuit_weightsnumpy.ndarray, optional
If not None, an array of per-circuit weights (of length equal to the number of circuits) that are typically used to multiply the counts extracted for each circuit.
- namestr, optional
An optional name for this list, used for status messages.
- classmethod cast(circuits)
Convert (if needed) an object into a
CircuitList
.Parameters
- circuitslist or CircuitList
The object to convert.
Returns
CircuitList
- apply_aliases()
Applies any operation-label aliases to this circuit list.
Returns
- list
A list of
Circuit
objects.
- truncate(circuits_to_keep)
Builds a new circuit list containing only a given subset.
This can be safer then just creating a new
CircuitList
because it preserves the aliases, etc., of this list.Parameters
- circuits_to_keeplist or set
The circuits to retain in the returned circuit list.
Returns
CircuitList