Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify what result types we expect in our Qiskit result conversion functions #406

Merged

Conversation

isobelhooper
Copy link
Contributor

Description

Adds parameters to qiskit_result_to_backendresult / qiskit_experimentresult_to_backendresult to specify which type of results we expect to have back.

Previously, circuits with classical bits submitted to AerStateBackend would have a counts field in their returned result, because Qiskit reads from the classical register memory. Now we don't set that, because we don't expect counts to be returned from AerStateBackend so we ignore that field.

Also, we weren't ever passing in anything to ppcirc in qiskit_experimentresult_to_backendresult, so after discussion with @cqc-melf and @cqc-alec that's been removed as part of this PR.

Related issues

Please mention any github issues addressed by this PR.

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

It's not included in any of the existing calls to this function, and
the last time it seems to have been used is by IBMQBackend before the
Qiskit API changed (since now IBMQBackend.get_results() handles its
own result conversion).
And when we call those conversion methods from _AerBaseBackend.get_results(),
pass what we know about what the backend is expected to support.

This should mean that if we run anything on AerStateBackend or AerUnitaryBackend,
we don't get counts passed back even if the Qiskit result included them.
@isobelhooper isobelhooper force-pushed the bugfix/specify-what-we-expect-in-qiskit-result-conversion branch from c11e63c to 6f320e2 Compare October 24, 2024 10:52
@isobelhooper isobelhooper marked this pull request as ready for review October 24, 2024 11:05
@isobelhooper isobelhooper merged commit 577b9a0 into main Oct 24, 2024
6 checks passed
@isobelhooper isobelhooper deleted the bugfix/specify-what-we-expect-in-qiskit-result-conversion branch October 31, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants