I'm running a circuit on ionq device using qiskit_braket_provider. I want to extract per shot measurement results. While running on IBMQ backends, it can be accessed by setting memory=True in execute function and then running job.result().get_memory(qc). I'm trying to similar thing for ionq device, but getting the following error.


job = ionq.run(tqc,shots=1024,memory=True)
result = job.result()
m = job.result().get_memory(tqc)


QiskitError                               Traceback (most recent call last)
Input In [70], in <cell line: 1>()
----> 1 m = job.result().get_memory(tqc)
      2 m

File ~/anaconda3/envs/qlab/lib/python3.10/site-packages/qiskit/result/result.py:217, in Result.get_memory(self, experiment)
    191 def get_memory(self, experiment=None):
    192     """Get the sequence of memory states (readouts) for each shot
    193     The data from the experiment is a list of format
    194     ['00000', '01000', '10100', '10100', '11101', '11100', '00101', ..., '01010']
    215         QiskitError: if there is no memory data for the circuit.
    216     """
--> 217     exp_result = self._get_experiment(experiment)
    218     try:
    219         try:  # header is not available

File ~/anaconda3/envs/qlab/lib/python3.10/site-packages/qiskit/result/result.py:380, in Result._get_experiment(self, key)
    373 exp = [
    374     result
    375     for result in self.results
    376     if getattr(getattr(result, "header", None), "name", "") == key
    377 ]
    379 if len(exp) == 0:
--> 380     raise QiskitError('Data for experiment "%s" could not be found.' % key)
    381 if len(exp) == 1:
    382     exp = exp[0]

QiskitError: 'Data for experiment "circuit-7034" could not be found.'

One more thing, how to extract execution time for job on ionq device? In IBMQ simply job.result().time_taken returns it.


1 Answer 1


From what I can tell, this information isn't available from the provider because the header parameter isn't supplied to the ExperimentResult constructor. This might be worth submitting an issue or PR for!

In the meantime, you can get per-shot results by getting the Amazon Braket task result directly:

from braket.aws import AwsQuantumTask
task = AwsQuantumTask(job.job_id())
measurements = task.result().measurements
  • 1
    $\begingroup$ Thanks for the help! It worked. $\endgroup$
    – Devesh
    Commented Aug 20, 2022 at 8:57

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.