Skip to main content
IBM Quantum Platform

extend_annotations

samplomatic.utils.extend_annotations(circuit: QuantumCircuit, *annotations: Annotation) → QuantumCircuit

GitHub

Return a new circuit with the given annotations appended to every box.

Parameters

  • circuit – The circuit whose boxes to extend.
  • *annotations – One or more annotation instances to append.

Returns

A new circuit where each box’s annotations are the original list followed by annotations.

from qiskit.circuit import QuantumCircuit
from samplomatic import Twirl, InjectNoise
from samplomatic.utils import extend_annotations

circuit = QuantumCircuit(2)
with circuit.box([Twirl()]):
    circuit.cx(0, 1)

with_noise = extend_annotations(circuit, InjectNoise("ref"))
Was this page helpful?
Report a bug, typo, or request content on GitHub.