deltakit.circuit.Circuit#

class deltakit.circuit.Circuit(layers: GateLayer | NoiseLayer | Circuit | Detector | Observable | ShiftCoordinates | Iterable[GateLayer | NoiseLayer | Circuit | Detector | Observable | ShiftCoordinates] | None = None, iterations: int = 1)#

Bases: Generic[T]

The deltakit_circuit circuit class. The circuit is implemented as a mutable list of layers where each layer is a gate layer, a noise layer, an annotation or another circuit.

Parameters:
  • layers (LayerT | Iterable[LayerT] | None, optional) – The layers to include in this circuit. Circuits are mutable so layers can be added to the circuit after construction. By default, None.

  • iterations (int, optional) – The number of times this circuit is run. If this circuit specifies a repeat block then iterations should be greater than 1. By default, 1.

Methods#

Circuit.append_layers

Append any layers to the end of this circuit.

Circuit.apply_gate_noise

Apply gate noise according to the noise profile.

Circuit.approx_equals

Determine whether two circuits are approximately equal within a tolerance.

Circuit.as_detector_error_model

Returns a stim.DetectorErrorModel describing the error process in the circuit.

Circuit.as_stim_circuit

Get the equivalent Stim circuit from this deltakit_circuit circuit.

Circuit.detectors

All of the detectors in this circuit.

Circuit.detectors_gates

Return the gates associated with each detector in this circuit, including nested circuits.

Circuit.flatten

Flatten a deltakit_circuit circuit to remove iteration blocks.

Circuit.from_stim_circuit

Parse a Stim circuit into a deltakit_circuit circuit.

Circuit.gate_layers

All the gate layers in this circuit.

Circuit.noise_layers

All the noise layers in this circuit.

Circuit.permute_stim_circuit

Convert this circuit to a Stim circuit and append it to the end of the given circuit.

Circuit.remove_noise

Remove all noise layers from this circuit and make any noisy measurement gates noiseless.

Circuit.reorder_detectors

Reorder the detectors in this circuit according to the given key.

Circuit.replace_gates

Replace gates in the circuit with other gates.

Circuit.transform_qubits

Transform this circuit's qubits and detectors according to the id mapping.