deltakit.circuit.Circuit.append_layers#
- Circuit.append_layers(layers: GateLayer | NoiseLayer | Circuit | Detector | Observable | ShiftCoordinates | Iterable[GateLayer | NoiseLayer | Circuit | Detector | Observable | ShiftCoordinates])#
Append any layers to the end of this circuit. If a layer consisting of a circuit with a single iteration is added to this circuit, it is flattened, i.e. all of the layers of that circuit are appended into this circuit. If the nested circuit has more than one iteration then no flattening occurs and this is analogous to inserting a repeat block into stim.
Please note that this append operation works by reference, the layers input into the circuit are not copied.
- Parameters:
layers (LayerT | Iterable[LayerT]) – The layer or layers to append.
- Raises:
TypeError – When types of qubit UIDs are not homogeneous.
ValueError – When a layer is not of type LayerT
Examples
>>> import deltakit_circuit as sp >>> circuit = sp.Circuit() >>> nested_circuit = sp.Circuit(sp.GateLayer(sp.gates.X(0))) >>> circuit.append_layers(nested_circuit) >>> circuit.layers [GateLayer([ X(Qubit(0)) ])]