pygsti.circuits.circuitconstruction.filter_circuits

pygsti.circuits.circuitconstruction.filter_circuits#

filter_circuits(circuits, sslbls_to_keep, new_sslbls=None, drop=False, idle=())#

Applies filter_circuit() to each element of circuits.

Removes any labels from circuits 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:
  • circuits (list) – A list of circuits 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.

  • drop (bool, optional) – If True, then non-empty circuits which become empty after filtering are not included in (i.e. dropped from) the returned list. If False, then the returned list is always the same length as the input list.

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

Returns:

A list of Circuits

Return type:

list