# Can I extract information from a single shot efficiently?

I'm running a quantum simulation and want to obtain some information from a single shot of an experiment. Here's part of the code I'm working on:

for i in range(Nshot):
Expeb = []
for measure_circuit in [circ_1, circ_2, circ_3, circ_4]:
measure_circuit = transpile(measure_circuit,backend=backend,optimization_level=2,initial_layout = )
counts = execute(measure_circuit, backend = backend, shots=1).result().get_counts()
for output in ['0','1']:
if output not in counts:
counts[output] = 0
expe = (counts['0'] - counts['1'])
Expeb.append(expe)
Est = sum(x*y for x,y in zip(Expeb,[a,b,c,d]))


The code works on simulators, but it might take a very long time if Nshot gets large (Like 5000, I think that's because I generated a lot of circuits) and I submit the jobs to a quantum device. I wonder is there a way I can extract information (like making calculations for) a single shot but in a more efficient way? Thanks for the help!

• If I understand your question correctly, then in general this is probably not the case since a single shot won't give you enough statistic. Aug 9, 2021 at 16:20
• @KAJ226 Thanks for the comment! I want to do some calculations from the results of a single shot and repeat the process many times to get more statistics:) (shots = 1, but Nshot could be large)
– ZR-
Aug 9, 2021 at 16:24
• Ah, I see what you mean now. I should note that if this is the case then this means you have to resubmit the circuit from start every time... which adds a lot of overhead time (validation etc...) Aug 9, 2021 at 18:10
• @KAJ226 Haha thanks!
– ZR-
Aug 9, 2021 at 18:51

You can use memory option. It will make the per-shot measurement bit-strings returned in the result:
memory = execute(measure_circuit, backend = backend, memory = True, shots = 1024).result().get_memory()