1
$\begingroup$

I want to get measurement result from my circuit output, like '00', '01', '10', or '11' because want to process it further classically. Any suggestion? We can see the highest probability '01'. How I can extract the result?

enter image description here

$\endgroup$

1 Answer 1

6
$\begingroup$

You need to know your job id fist. You can get it from https://quantum-computing.ibm.com/jobs:

sreenshot

With the job id and the backend, you can enter that information to retrieve the job in Qiskit:

from qiskit import IBMQ
provider = IBMQ.load_account()
job = provider.get_backend(<backend_name>).retrieve_job(<job_id>)

With the job, you can access the count like this:

counts = job.result().get_counts()
print(counts)
{'000000': 8,
 '000001': 16,
 '010000': 2,
 '010001': 3,
 '010100': 6,
 '010101': 2,
 '010110': 3,
 ...
}
$\endgroup$
3
  • $\begingroup$ So i just take the highest value from the count result ? $\endgroup$
    – AFOEK
    Commented Jun 22, 2021 at 1:55
  • $\begingroup$ You said you wanted "to get measurement result [...] to process it further classically". I don't know what's your classical process. If you want do counts.most_frequent() to get the result with the higher count. $\endgroup$
    – luciano
    Commented Jun 22, 2021 at 7:57
  • $\begingroup$ Oww I think I get confused, so the output of the jobs are probability of all possible state ? I think I need the counts.most_frequent() for my code thanks $\endgroup$
    – AFOEK
    Commented Jun 23, 2021 at 9:18

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.