# How do I know in which state the qubit is in each step of the circuit for the simulator in qiskit?

I would like to know how to know in which state a qubit is (I am talking about single-qubit errors), because in order to apply a non unitary gate in the simulator I have to renormalize the state or the corresponding non unitary Kraus operator (the non unitary gate in my circuit). Therefore I need to know in which state the circuit it. I am of course talking about the simulator, which in fact is classical and therefore it must be a way to know the state at each point of the circuit.

You can take snapshots of the statevector of the circuit when you use the 'qasm_simulator'. You simply append snapshot instructions into your circuit where you would like to see the statevector, and then can see the values in the result object that is returned. You add a snapshot instruction using
from qiskit.extensions.simulator import snapshot

• You have to run the circuit, and the snapshots will be contained in the results object. I believe the command to retrieve them is something like result.get_snapshot('my_label') – met927 Mar 3 '20 at 8:27