I created the following code to run a simple circuit through a quantum device twice. My purpose was to show the effects of noise with different arrangements of qubits when using ibmq_belem.
#Run circuit with two different qubit layouts
from qiskit import IBMQ, execute
#Load account
provider=IBMQ.load_account()
#Choose device
backend=provider.get_backend('ibmq_belem')
C=[]
for initial_layout in [[0,3],[2,4]]:
job=execute(circuit, backend, initial_layout=initial_layout).result()
c=result.get_counts()
C.append(c)
followed by
plot_histogram([C[0],C[1]],title="Comparing Noise")
to create the histogram which give me ...
Which does not reflect any of the noise that I see in my results taken directly from IBMQ which shows the first and second runthroughs respectivly as ...
These are clearly not the identically perfect versions that my C set seems to have created. This makes my question; What have I done wrong in coding this that C is not accurately reflecting my counts?
Edit: I note that it has somehow decided to take the counts from when I ran this circuit on a simulator in a prior cell using the following code.
simulator=Aer.get_backend('aer_simulator')
result=execute(circuit,backend=simulator).result()
plot_histogram(result.get_counts(circuit))
This code had been run before I ever created the set C, so I did not expect it to interfere, but now I'm not sure how to work around this.
c=result.get_counts()
to this:c = job.result().get_counts()
. $\endgroup$