Is there any way to get information from intermediate points in the execution of a quantum circuit. This is not possible on real quantum hardware but would be very useful on the Aer simulators for both learning quantum programming and for debugging.


1 Answer 1


This feature is now available using the snapshot function of Qiskit Aer. Snapshots can be added to the circuit and the values are then returned in the results object.

This is an example of how you can create a circuit, add a snapshot to it and then get the result:

from qiskit import *

qc = QuantumCircuit(2)
qc.snapshot('1')             # add a snapshot with the key '1'
qc.h(0)                      # add more gates after the snapshot

backend = Aer.get_backend('statevector_simulator')
result = execute(qc, backend).result()
snapshots = result.data()['snapshots']['statevector']

snapshots now contains a dictionary where the keys are the names given to the snapshots, and the values are an array of state vectors associated with that key.

In this example it is{'1': [[[0.7071067811865476, 0.0], [0.7071067811865475, 0.0], [0.0, 0.0], [0.0, 0.0]]]}.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.