What crosses the boundary
A quantum computer sends its results back as a tally, and a program that needs the exact state simulates the circuit instead.
A tally is the only result a quantum computer sends back across the boundary: the number of shots that read each bitstring. In lesson 1 you pressed Quantum Garden on IonQ's Aria 1 simulator, and Garden printed its counts on the Counts for 100 shots: line. Our run on 22 September 2026 printed counts that added up to 69 of the 100 shots.
Musiq, Quantum Regime Radar and Quantum Butterfly Field, from lesson 1, use more than a tally. The three projects read exact amplitudes, phases, purities or overlaps, which come from a circuit's exact state, its statevector. Programs get a statevector only by simulating the circuit, so the parts of an application that need one run on a simulator.
You read one circuit both ways in the lesson's listing, as a statevector and as a tally, and moving a phase shows which reading changes. At the end you press Quantum Garden twice and work out why neither Counts line adds up to 100 shots.
Why hardware cannot hand you a statevector
A physical quantum state does not expose its amplitudes. The only way to learn anything from one is to measure it, and measuring returns a single bitstring and changes the state into the one you just read. Run the same circuit again and you get another single bitstring; a thousand runs give a tally of bitstrings that estimates the distribution.
A simulator holds the amplitudes in memory as ordinary floating-point numbers, so it can hand them to you directly, phases included, without measuring anything.
Better hardware will not add amplitudes to the output, because the limit comes from measurement itself: reading a physical qubit returns one outcome, however good the qubit is.
If your application needs amplitudes or phases, it runs on a simulator, which caps how many qubits you can use, because holding the state of n qubits takes 2ⁿ numbers. If your application can work from a distribution, it can run on hardware.
Read one circuit both ways
The circuit in this listing is a Hadamard followed by an rz that puts a phase on one of the two paths. The listing reads the circuit both ways: Statevector asks the simulator for the amplitudes, which costs no shots and files no job, and backend.run samples the same circuit a thousand times.
# 'backend' already exists when this runs: it is whatever you pick in the Run Experiment dialog.
from math import pi
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.providers.jobstatus import JobStatus
import time
shots = 1000
1phi = 0.0
2def build(measured):
qc = QuantumCircuit(1, 1)
qc.h(0)
qc.rz(phi, 0)
if measured:
qc.measure(0, 0)
return qc
3sv = Statevector(build(measured=False))
amps = [complex(a) for a in sv.data]
print(f"statevector: |0> {amps[0]:+.3f} |1> {amps[1]:+.3f}")
print(f"from it: P(0)={abs(amps[0])**2:.3f} P(1)={abs(amps[1])**2:.3f}")
4job = backend.run(build(measured=True), shots=shots)
while job.status() not in (JobStatus.DONE, JobStatus.ERROR, JobStatus.CANCELLED):
time.sleep(5)
5counts = job.result().get_counts()
print(f"counts: {counts}")
z = counts.get("0", 0)
print(f"from them: P(0)={z / shots:.3f} P(1)={(shots - z) / shots:.3f}")
- 1the dial: 0 or pi. Change it and run again
- 2the same circuit, with or without the measurement
- 3the simulator hands over the numbers themselves
- 4the only job this run files
- 5the same circuit, observed by sampling
Our run on 22 September 2026, with phi = 0:
statevector: |0> +0.707+0.000j |1> +0.707+0.000j
from it: P(0)=0.500 P(1)=0.500
counts: {'0': 478, '1': 522}
from them: P(0)=0.478 P(1)=0.522
The statevector gives exactly 0.500, computed from the amplitudes the simulator holds. The tally gives 0.478, counted from a thousand samples of the same circuit in the same press.
Assignment: move the phase and see which reading changes
- Open
/u/qollab/learn-app-observe, press Fork, then Fork Project in the dialog. - In your fork, press Run on Qollab, choose IonQ Aria 1 (25q) under Remotely Run Simulators, and press Run.
- Write down the
statevector:line and thecounts:line. - Change line 9 to
phi = pi. - Predict whether the statevector line will change.
- Predict whether the measured shares will change.
- Press Run again, and compare both pairs of lines.
Solution
The statevector changes. The ideal shares stay at 0.500 and 0.500, and the sampled shares move a little from press to press, as any tally does.
Our two presses on 22 September 2026:
phi = 0 statevector: |0> +0.707+0.000j |1> +0.707+0.000j counts: {'0': 478, '1': 522}
phi = pi statevector: |0> +0.000-0.707j |1> +0.000+0.707j counts: {'0': 506, '1': 494}
rz(phi) puts a relative phase of phi between the two amplitudes. At pi the relative sign between the two amplitudes reverses, and they read -0.707j and +0.707j. A measurement in the 0/1 basis, the one measure reads in, uses each amplitude's squared magnitude, |a|², and a magnitude carries no phase, so both ideal shares stay at one half.
These counts cannot tell the two states apart.
Which reading Musiq, Regime Radar and Butterfly Field chose
Musiq needs both, and its mapping table says so. The measurement probability sets how strong each frequency component is, which is a counts quantity. The statevector phase sets oscillator phase and interference. The statevector amplitude sets loudness; a tally does carry the share whose square root is the amplitude's size, but not the amplitude's sign. No tally carries a phase as the circuit stands: two states with the same distribution and different phases give identical tallies, unless the circuit rotates the phase into the measured basis first, as the second Hadamard did in Course 2's interference lesson.
Quantum Regime Radar ships three scoring paths in one file. An exact statevector overlap ranks all five regimes offline with no shots. A sampler path runs the same comparison on simulation or hardware. The IonQ path transpiles to the native gate set. The Radar uses the exact path to produce the ranking and spends the single hardware job verifying one row of it, with shot-noise error bars on the measured value.
Quantum Butterfly Field splits its work into two tracks. An exact statevector simulation runs live on every visit in a serverless function and drives the animation, because per-layer purities and pairwise entanglement are state quantities. The damage-and-healing fidelities, which measure how completely the damaged butterfly's state is recovered, come from recorded IonQ Forte runs, replayed from a library.
Four things a tally does that a return value does not
- A tally changes almost every run. Even the same circuit on the same backend gives a different tally on the next press, so a test that asserts an exact tally will fail intermittently.
- Some shots read the wrong answer, and nothing marks them. On real hardware and on a noise-model simulator, the wrong shots sit in your tally alongside the right ones.
- Nothing throws when the answer is wrong. A circuit with a bug in it returns a well-formed tally, and so does a circuit that ran on a degraded machine. Your decode step turns either into a number, and your application uses it. You have to write any check on the tally yourself.
- A tally costs shots, and more shots give more precision. The uncertainty on a measured share is the standard error, and it shrinks with the square root of the number of shots. At 1,000 shots a measured share lands within about ±0.028 of a true share of 0.300, 95% of the time. To halve the window you run four times as many shots.
Each row of the table quadruples the shots and halves the window:
| shots | 95% window on a 0.300 share |
|---|---|
| 250 | ±0.057 |
| 1,000 | ±0.028 |
| 4,000 | ±0.014 |
| 16,000 | ±0.007 |
The same circuit, pressed twice
Quantum Garden hard-codes seed = 42, so its circuit is identical on every press. We pressed the project twice on the IonQ Aria 1 simulator, IonQ's simulator with the Aria 1 noise model, on 22 September 2026, and changed nothing in between.
press 1: {'00001': 13, '00011': 15, '01001': 7, '01101': 24, '11101': 10}
press 2: {'00001': 16, '00011': 17, '00101': 8, '01001': 7, '01101': 24}
Two of the four shared outcomes changed count, 13 to 16 and 15 to 17, and two stayed at 7 and 24. The two presses also do not agree on which outcomes exist: 11101 is in the first and absent from the second, and 00101 is in the second and absent from the first.
Neither line adds up to 100: the first holds 69 shots and the second 72, so nearly a third of the data is missing from both.
The listing's own main causes both differences: it takes excludeLowProbabilityValues=True and lowProbabilityThreshold=0.05, then drops every outcome that got five shots or fewer. An outcome near the threshold clears the threshold in one press and misses in the next, so the outcome appears and disappears. The missing shots, 31 in the first press and 28 in the second, are the outcomes main discarded.
The filter is a decode-step decision, made for a good reason: at 100 shots across 32 possible outcomes, the rare ones are indistinguishable from noise, so a plant built from them would reflect noise. The filter does not show in the output, though, and it causes the two presses to disagree.
Assignment: press the same circuit twice
- Open
/u/AmberPincar/quantum-garden. - Press Run on Qollab, choose IonQ Aria 1 (25q) under Remotely Run Simulators, and press Run.
- Write down the
Counts for 100 shots:line exactly. - Press Run on Qollab again, choose the same backend, and press Run.
- Write down the second line, and add up the shots in each.
- Work out why two presses of an unchanged circuit disagree about which outcomes exist.
Solution
Nothing changed between the presses. seed = 42 is in the listing, so the circuit is identical and both tallies are samples of one distribution.
The counts differ because a tally is a sample. The outcome list differs because main drops anything with five shots or fewer out of 100, and an outcome near that threshold crosses it in one press and not the next.
Your shots will not add up to 100 for the same reason. Ours came to 69 and 72.
More shots make the two presses agree more closely, and changing the shot count needs a fork, because main pins it at 100. Four times as many shots halve the window on every share. More shots do not make the outcomes under 5% appear, because the threshold is a share of the shots and rises with them, but they do make an outcome near the threshold less likely to cross it by chance, which is what made 11101 and 00101 appear in one press and not the other.
Takeaway
If your application can work from a distribution, it can run on hardware, because every backend returns a tally. Amplitudes and phases themselves come only from a simulator, which caps the qubit count. A tally is a sample that changes almost every run, and nothing in it marks a wrong shot, so your code has to check it.
Lesson 3 keeps the circuit behind three steps, so the rest of your program handles only ordinary values.
Stay in the loop.
Get the latest tutorials, demos, and project showcases straight to your inbox. No noise, just the good stuff.
On this page
- 1Why hardware cannot hand you a statevector
- 2Read one circuit both ways
- 3Assignment: move the phase and see which reading changes
- 4Which reading Musiq, Regime Radar and Butterfly Field chose
- 5Four things a tally does that a return value does not
- 6The same circuit, pressed twice
- 7Assignment: press the same circuit twice
- 8Takeaway
