I'm trying to study the effect of noise on a quantum system with partial measurements using Qiskit. Suppose I have $N + M$ qubits and I run a quantum circuit and measure $M$ of them. I want to know the quantum state on the remaining $N$ qubits given the measurement outcomes on the $M$ qubits I measured. In other words, I want to post-select (condition) on some measurement outcomes.
If I'm working with a noiseless circuit, I can do this by building my usual circuit and appending the instruction circuit.snapshot(label = "psi", snapshot_type = "statevector")
after my measurements. Then, I can use the AerSimulator
to simulate my circuit and get out the quantum state as a snapshot after any series of measurements using:
results = simulator.run(circuit, shots = shots, memory = True).result()
states = results.data()["snapshots"]["statevector"]["psi"]
But what happens if I want to implement noise in my simulator? I know how to do this using AerSimulator
, but I'm not sure how to get the state I'm looking for.
One option is to use the instruction circuit.snapshot(label = "rho", snapshot_type = "density_matrix")
. Is this the recommended way to do the simulation when I want to see the effect of noise after partially measuring a quantum system?