Pad results with zeros for unmeasured states
See original GitHub issueWhat is the expected enhancement?
After executing a job on qiskit, the typically procedure to get the measurement data from the quantum computer is to call get_counts()
like so…
job = execute(qc, backend, shots=100)
result = job.result()
counts = result.get_counts()
If the final state is, for example, $| 01 \rangle$ then ‘01’ would be the only key in counts. For some analyses, it would be very useful if the returned counts dictionary had 0s for all the states that were not measured. Maybe something like
counts = results.get_counts(pad=True)
, and counts would then be counts = {'00':0, '01':100, '10':0, '11':0}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Pad get_counts() with zeros for unmeasured states? (Qiskit)
After executing a job on qiskit, the typically procedure to get the measurement data from the quantum computer is to call get_counts() like...
Read more >Pad with leading zeros to common width - Stack Overflow
Simply following the advise in @joran's comment, DB <- data.frame( HOUR = c(1, 10, 5, 20), ID = c(2, 4, 6, 6)) NHOUR...
Read more >Zero filling interpolation | Radiology Reference Article
Zero filling interpolation (ZIP) is the substitution of zeroes for unmeasured data points in order to increase the matrix size of the new ......
Read more >Retinal microvascular findings and risk of incident peripheral ...
PAD is associated with major clinical outcomes including mortality, ... using a random zero sphygmomanometer after a 5-minute rest.
Read more >One-time pad - Wikipedia
In cryptography, the one-time pad (OTP) is an encryption technique that cannot be cracked, ... state along a one-way quantum channel (by analogue...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you try to get valid bitstrings from it, it will return 0 if no counts were seen (and obviously return the correct number if the state was seen). You wouldn’t need an option for it to work; it’d do it by default. Things like
print(counts)
won’t show the 0s, though - that would involve the exponential behaviour that we can’t safely include.Ah ok, I see now. Yes, that behavior is even better! Thank you!