pygsti.circuits.circuitconstruction.manipulate_circuit#
- manipulate_circuit(circuit, rules, line_labels='auto')#
Manipulates a Circuit object according to rules.
Each element of rules is of the form (find,replace), and specifies a replacement rule. For example, (‘A’,), (‘B’,’C’) simply replaces each A with B,C. (‘A’, ‘B’), (‘A’, ‘B2’)) replaces B with B2 when it follows A. (‘B’, ‘A’), (‘B2’, ‘A’)) replaces B with B2 when it precedes A.
- Parameters:
circuit (Circuit or tuple) – The circuit to manipulate.
rules (list) – A list of (find,replace) 2-tuples which specify the replacement rules. Both find and replace are tuples of operation labels (or Circuit objects). If rules is None then circuit is returned.
line_labels ("auto" or tuple, optional) – The line labels to use when creating a the output Circuit objects. If “auto” then the line labels are determined automatically based on the line-labels which are present in the corresponding layer labels.
- Return type:
list of Circuits