1
$\begingroup$

I hope this message finds you well. After nearly a year, I've recently returned to using the IBM Quantum platform to run quantum circuits. I've noticed several changes in the process compared to my last experience. Previously, I could directly obtain the observation results of a circuit execution in the following manner:

...
execute = execute(circ, backend, shots=1000)
count = execute.result().get_counts()
print(count)

This would yield measurement counts directly, in a format similar to {'0': 500, '1': 500}. However, upon using the platform again, I've noticed the introduction of the Sampler, which seems to present the outcomes in terms of quasi-probabilities instead of the direct measurement counts I am accustomed to.

Could someone kindly advise if there is a way to obtain the direct measurement counts as before? I would greatly appreciate any guidance or updates on how to achieve this with the current system.

Thank you for your time and assistance.

$\endgroup$

2 Answers 2

1
$\begingroup$

The execute() function was removed in the Qiskit 1.0 release - see the notes here https://docs.quantum.ibm.com/api/qiskit/release-notes/1.0#misc-upgrade-notes. However, you only need to change one line of your code to make things work as before:

execute = backend.run(transpile(circ, backend), shots=1000)
$\endgroup$
1
$\begingroup$

Take a look at SamplerV2 in the latest IBM Runtime. From the result you can get counts as well as the per shot information (the former memory option) if you want that. The sample code in this page uses the SamplerV2 https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/runtime_service. This is a change from the SamplerV1, which as you noted returned quasi-probabilities.

$\endgroup$

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.