2
$\begingroup$

Suppose Circuits= [circuit1, circuit2, ..., circuitn] is a list of defined circuits. Then, job = execute(Circuits, backend=backend, shots=shots, max_credits=max_credits) will execute a list of circuits all together. Then, one can get the result by using job.result().get_counts. It looks like this (with the results of the first circuit execution highlighted): enter image description here

Is there any way to extract the counts like how it usually is with only one circuit in execution?

$\endgroup$
3
$\begingroup$

From the Getting started tutorial on Qiskit, it seems that you grab the result of job first and you access the counts via the function get_counts(circuit) for a specific circuit. So I would loop through Circuits and use this function on each:

result_submissions = job.result()
for qc in Circuits:
     counts = result_submissions.get_counts(qc)
     print(counts)
$\endgroup$
  • $\begingroup$ I'm sorry I should have mentioned probably, but I only have two circuits qc and qc5 and my list is: Circuits= [qc, qc5, qc, qc5, qc, qc5, qc, qc5], so by looking at job.result().get_counts I get 8 different (but unexpectedly close) sets of values, but by looping over qc in Circuits I only get two sets of values, repeated four times. $\endgroup$ – Mathophile-Mathochist Jan 7 at 2:41
  • $\begingroup$ @Mathophile-Mathochist I guess that is because the execute function on a list sample independently and the get_counts take the first result circuit as reference. Maybe you can try calling get_counts() with the parenthesis then see if you have access to the results argument which you may be able to loop through and use the get_counts() method if the ExperimentResult class has one. $\endgroup$ – cnada Jan 7 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.