3
$\begingroup$

Is there a way to access the results of measurements 'per shot' performed on a backend such as one of the real IBM machines?

I know it can generate a histogram from the cumulative data, but I was wondering if it is possible to see what the measurement outcomes were for a particular shot out of the standard 1024.

$\endgroup$

1 Answer 1

1
$\begingroup$

There is indeed. You just need to use get_memory() instead of get_counts() (and also use a memory=True flag in the execute function. It works with the local qasm simulator and the 5 qubit device (and not currently with the cloud-based qasm simulator or 14 qubit device).

Here's an example using it to generate a series of random bits.

q = QuantumRegister(1)
c = ClassicalRegister(1)
circ = QuantumCircuit(q, c)

circ.h(q)

circ.measure(q,c)

job = execute(circ, Aer.get_backend('qasm_simulator'), shots=10024, memory=True)
data = job.result().get_memory()
$\endgroup$
2
  • $\begingroup$ Thank you, this worked when I changed to BasicAer. Are there plans to extend to the other IBM machines? $\endgroup$
    – Caleb GS
    Jan 30, 2019 at 11:43
  • $\begingroup$ All new machine will have it, I think. But for upgrades, I don’t know what the timescales are. $\endgroup$ Jan 30, 2019 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.