I am doing Qiskit Lab 4 about Iterative Phase Estimation. I created a circuit implementing IPE for theta = 1/3 (phase of 2pi/3). Here's the circuit:
It seems to do okay if I run it without noise in a QASM sim:
Then the lab compares how IPE performs compared to QPE when you add noise - in this lab they use NoiseModel.from_backend() from the Athens IBM computer to simulate the noise.
The lab guide says I'm supposed to get something like this:
In reality I get this:
I have zero idea how to approach this problem because I tried inputing several values of theta to simulate in QASM without noise and everything seems to be fine there. Any ideas?
For reference, the code implementing IPE is below:
import math theta = 2/3*math.pi IPE = QuantumCircuit(2) cregs =  IPE.x(1) for i in range(n): cregs.append(ClassicalRegister(1)) IPE.add_register(cregs[i]) for i in range(n): IPE.reset(0) IPE.h(0) IPE.crz(theta*(2**(n-i)),0,1) if i > 0: for j in range(i): IPE.rz(-math.pi*2**(j-i),0).c_if(cregs[j],1) IPE.h(0) IPE.measure(0,cregs[i])
UPDATE: Apparently specifying the initial_layout during transpiling is crucial as it seems to have worked!