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
- truncate_to_dataset(dataset)
Builds a new circuit list containing only those elements in dataset.
Parameters
- datasetDataSet
The dataset to check. Aliases are applied to the circuits in this circuit list before they are tested.
Returns
CircuitList
- elementvec_to_array(elementvec, layout, mergeop='sum')
Form an array of values corresponding to this CircuitList from an element vector.
An element vector holds individual-outcome elements (e.g. the bulk probabilities computed by a model).
Parameters
- elementvecnumpy array
An array containting the values to use when constructing a matrix of values for this CircuitList. This array may contain more values than are needed by this CircuitList. Indices into this array are given by elindices_lookup.
- layoutCircuitOutcomeProbabilityArrayLayout
The layout of elementvec, giving the mapping between its elements and circuit outcomes.
- mergeop“sum” or format string, optional
Dictates how to combine the elementvec components corresponding to a single plaquette entry (circuit). If “sum”, the returned array contains summed values. If a format string, e.g. “%.2f”, then the so-formatted components are joined together with separating commas, and the resulting array contains string (object-type) entries.
Returns
numpy array