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
#Choose device
for initial_layout in [[0,3],[2,4]]:
    job=execute(circuit, backend, initial_layout=initial_layout).result()

followed by plot_histogram([C[0],C[1]],title="Comparing Noise") to create the histogram which give me ... enter image description here

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 ... enter image description here

enter image description here

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.


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.

  • 1
    $\begingroup$ You have a typo inside the for loop. Change this row: c=result.get_counts() to this: c = job.result().get_counts(). $\endgroup$
    – Ohad
    Oct 26, 2022 at 21:09
  • 1
    $\begingroup$ @Ohad You found that just as I did! Thank you for taking a look! $\endgroup$
    – PGibbon
    Oct 26, 2022 at 21:27

1 Answer 1


Figured it out! It was using my result label from the initial coding when I used the simulator and appending that twice to my set C. So in my code I have now changed c=result.get_counts() to c=job.get_counts() as that was the 'job' I wanted the results from! And now all is beautiful and full of noise!


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.