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

error in noisy simulation of a single S-gate #180

Open
jagunther opened this issue Jun 7, 2024 · 2 comments
Open

error in noisy simulation of a single S-gate #180

jagunther opened this issue Jun 7, 2024 · 2 comments

Comments

@jagunther
Copy link

qiskit-environment:

qiskit 1.0.2
qiskit-aer 0.14.2
qiskit-experiments 0.6.1
qiskit-ibm-experiment 0.4.7
qiskit-ionq 0.5.2

python version: python 3.12

OS: Mac OS 14.5

What is the current behavior?

Not able to get counts of simulation of a single S-gate with noise. There is no error without the noise-model or if another Hadamard-gate is added. The problem exists also in qiskit-ionq 0.5.1

Steps to reproduce the problem

from qiskit_ionq import IonQProvider
from qiskit import QuantumCircuit
import os
import qiskit_ionq

api_key = os.getenv('IONQ_API_KEY')

def main():
    print(qiskit_ionq.__version__)

    provider = IonQProvider(token=api_key)
    backend = provider.get_backend("simulator")
    backend.set_options(noise_model="aria-2")

    qc = QuantumCircuit(1, 1)
    qc.s(0)
    # qc.h(0)   # no error when uncommented
    qc.measure([0], [0])

    job = backend.run(qc, shots=1024)
    print(job.get_counts())


if __name__ == '__main__':
    main()

error message:

Traceback (most recent call last):
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/ionq/test.py", line 25, in <module>
    main()
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/ionq/test.py", line 21, in main
    print(job.get_counts())
          ^^^^^^^^^^^^^^^^
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/.venv/lib/python3.12/site-packages/qiskit_ionq/ionq_job.py", line 228, in get_counts
    return self.result().get_counts(circuit)
           ^^^^^^^^^^^^^
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/.venv/lib/python3.12/site-packages/qiskit_ionq/ionq_job.py", line 286, in result
    self._result = self._format_result(response)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/.venv/lib/python3.12/site-packages/qiskit_ionq/ionq_job.py", line 494, in _format_result
    (counts, probabilities) = _build_counts(
                              ^^^^^^^^^^^^^^
  File "/Users/vrn738/PycharmProjects/hardware_benchmark/.venv/lib/python3.12/site-packages/qiskit_ionq/ionq_job.py", line 109, in _build_counts
    raise exceptions.IonQJobError("Cannot remap counts without data!")
qiskit_ionq.exceptions.IonQJobError: IonQJobError('Cannot remap counts without data!')

What is the expected behavior?

job.get_counts() should return the measurement counts

Suggested solutions

@Cynocracy
Copy link
Collaborator

ty for the bug report! I suspect this is a bug in the recent change to logic where we filter down the results to only those qubits measured.

@Cynocracy
Copy link
Collaborator

No longer able to reproduce on 0.5.* versions.

A couple of possiblities:

  • A race condition exists where the results load as empty
  • A bug in the simulation logic we host server-side was corrected in the meantime.

Happy to keep this open if we suspect the first of the two is in play, otherwise, this should be resolve 🤞

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

No branches or pull requests

2 participants