ImpairmentsDetector
Click-protocol impairments and security flags
13/13 passed in 164ms
| Test | What it does | Result |
|---|---|---|
test_afterpulse_qber | Afterpulsing raises both gain and QBER (Papapanos et al. arXiv:2010.03358, Eqs. (4), (7), (8)) and at p_AP = 0 collapses onto _core.decoy_gain itself. | ✅ pass |
test_backflash_anchor | Published anchor, fitted e = 1.29%: Singh, Sharma, Singh and Prabhakar (arXiv:2502.04081) count 1598 backflashes in 18000 sifted, which backflash_leak returns as their P_b = 0.0888, and P_sec = P_sift(1 - P_b - f h(e)) at f = 1.16 reproduces their "approximately 10%" rate loss. | ✅ pass |
test_backflash_inefficiency | The house f = 1.16 (Lutkenhaus PRA 61, 052304 (2000), Table I) differs from Singh et al.'s 1.15 by exactly 0.01*h(e) and security() carries f through, a probability outside [0, 1] is refused, and at Meda et al.'s measured 6% and 9.8% (arXiv:1605.05562) the leak stays under the sift and the rate non-negative. | ✅ pass |
test_clip_refused | full_scale is 2*clip or None, and a declared clip is refused on homodyne and heterodyne alike, naming q.attacks.Saturation. | ✅ pass |
test_coherence_fringe | Cross-check, not a reproduction: at 50 MHz on a 1 GHz clock and d = 1, 2 periods, the simulated fringe is 0.98*coherence(lw, d/R) to 3e-3 and the simulated v_phase is phase_variance(lw, d/R) to 0.01. | ✅ pass |
test_dead_saturation | A non-paralysable detector saturates below 1/tau_d and a paralysable one falls past 1/tau_d, and at R tau_d = 5e-3 both lose under R^2 tau_d, the non-paralysable shedding R^3 tau_d^2 at second order and the paralysable half of it. | ✅ pass |
test_extinction_limit | The extinction QBER floor 2/(r+3) (Huang et al. arXiv:1206.6591, Eq. (5)) falls below 1e-5 by r = 1e6, reads 1.9% at 20 dB, only raises a given QBER, and refuses r = 0. | ✅ pass |
test_paralysable_paired | At zero dead time saturate returns one number on both branches, and q.Link refuses paralysable=True beside dead=0.0 by name. | ✅ pass |
test_partner_closed | Every closed-form click link refuses a partner detector, decoy_gain, sarg_gain, sarg_yield and dps_rate each taking one eta and one dark. | ✅ pass |
test_partner_fields | The partner split reads eta and dark alone, so a partner differing in dead_time or jitter is refused by field name on the sampled paths. | ✅ pass |
test_partner_split | Bob's second threshold detector reaches both sampled click engines and moves their outputs, while an equal pair is the one-detector run bit for bit. | ✅ pass |
test_security_dict | security() mirrors assemble_extra's omit-when-unknown rule, never emitting xi. | ✅ pass |
test_visibility_drift | Interference visibility is 1 at zero polarisation mismatch and falls through the 0.37 two-source floor between 11 and 69 degrees, and mean DGD goes as D sqrt(L), 1 ps over 100 km at 0.1 ps/sqrt(km). | ✅ pass |