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?
1 Answer
$\begingroup$
$\endgroup$
3
You need to know your job id fist. You can get it from https://quantum-computing.ibm.com/jobs:
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,
...
}
-
$\begingroup$ So i just take the highest value from the
count
result ? $\endgroup$– AFOEKCommented 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$– lucianoCommented 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$– AFOEKCommented Jun 23, 2021 at 9:18