Examples

Example circuits for better understanding of the components, channels and protocols. Each example is a complete circuit that can be run in AnuQarana IDE or imported into the Circuit Builder.

A note on rates and dead time

If a circuit registers fewer counts than the source emitted and you cannot explain it optically, check the detector recovery time against the laser period. The detector is blind for

mean_response_time + jitter·N(0,1) + dead_time

after each click. With the constructor defaults (dead_time=10e-9, mean_response_time=1e-9) that is about 11 ns, so a laser above roughly 90 MHz starts losing counts to dead time alone. The examples here use dead_time=1e-9, mean_response_time=0 at freq=1e8 for exactly this reason.

Detector.failed_current_time counts the photons rejected this way, so you can confirm the diagnosis rather than guess it:

print(D1.total_recived, D1.failed_current_time, D1.actual_clicked)

Choosing a runtime

The number of non-empty pulses drives both statistics and cost:

\[N_\text{pulses} \approx T \cdot f \cdot (1 - e^{-\mu})\]

For \(T = 10^{-4}\) s, \(f = 10^8\) Hz and \(\mu = 0.1\) that is about 950 - enough to see a ratio to a few per cent, and a few seconds of wall-clock time. Scale runtime rather than freq when you want more statistics; a higher repetition rate buys the same pulses but risks running into dead time.