pygsti.circuits.circuitconstruction.filter_circuit

Contents

pygsti.circuits.circuitconstruction.filter_circuit#

filter_circuit(circuit, sslbls_to_keep, new_sslbls=None, idle=())#

Filters circuit by keeping only a subset of its “lines” (i.e. state space labels, often qubits).

Removes any labels from circuit whose state-space labels are not entirely in sslbls_to_keep. If a gates label’s state-space labels (its .sslbls) is None, then the label is retained in the returned string.

Furthermore, by specifying new_sslbls one can map the state-space labels in sslbls_to_keep to new labels (useful for “re-basing” a set of qubit strings.

Parameters:
  • circuit (Circuit) – The circuit to act on.

  • sslbls_to_keep (list) – A list of state space labels specifying which operation labels should be retained.

  • new_sslbls (list, optional) – If not None, a list of the same length as sslbls_to_keep specifying a new set of state space labels to replace those in sslbls_to_keep.

  • idle (string or Label, optional) – The operation label to be used when there are no kept components of a “layer” (element) of circuit.

Return type:

Circuit