Noise
Noise channels and trajectory sampling
21/21 passed in 7528ms
| Test | What it does | Result |
|---|---|---|
test_accepts_legal_rates | The rate bounds are not over-tight: p = 0, p = 1 and the equal-thirds split are legal channels whose branch weights sum to 1. | ✅ pass |
test_bitflip_rate | X_ERROR(p) flips |0> with empirical frequency about p. | ✅ pass |
test_certain_rates | X_ERROR(0) never flips |0> and X_ERROR(1) always does. | ✅ pass |
test_expect_decays | Dephasing at p = 0.5 drives <X> from +1 to 0. | ✅ pass |
test_full_depolarize_randomizes | DEPOLARIZE1(0.75) on |0> gives a ~50:50 Z outcome: X and Y flip it, I and Z do not. | ✅ pass |
test_refusals | Bad arguments raise ValueError naming the problem: rates outside [0, 1] or summing past 1, wrong vector lengths or labels, non-CP damping, bias on a 2-qubit channel, wrong target counts, a mis-sized observable, and record sampling of non-Pauli noise. | ✅ pass |
test_clifford_rotation_is_exact | RZ(pi/2) is the Clifford S (gamma = 1), so <Y> on |+> is exactly 1. | ✅ pass |
test_half_turns_are_pauli | A half turn is the axis Pauli and a full turn the identity, so both report is_pauli; a quarter turn (S) and a generic angle do not. | ✅ pass |
test_reference_agrees | H, RZ(pi), H, M reads |1>: the noiseless reference and the trajectories run the same deterministic Z, so the records match the dense amplitude and the detector rate matches the DEM. | ✅ pass |
test_rotations_match_exact | Importance sampling reproduces the exact <X>, <Y> of RZ(theta)|+> and <Z>, <Y> of RX(theta)|0>, at Clifford, generic and wasteful angles. | ✅ pass |
test_amplitude_branches | AMPLITUDE_DAMP(p) branches are identity, Z and reset at q_I = ((1-p) + sqrt(1-p))/2, q_Z = ((1-p) - sqrt(1-p))/2 < 0 and q_R = p, with gamma = sqrt(1-p) + p. | ✅ pass |
test_damping_matches_exact | Damping estimates match the exact Bloch map, <Z> on |1> -> tau - mu and <X> on |+> -> lam, for amplitude damping and a positive-regime GeneralizedDamping. | ✅ pass |
test_signed_fast_path | An amplitude-damping memory lowers to the Rust signed sampler (reset is opcode 9), and its importance weights average to 1, as a trace-preserving mix must. | ✅ pass |
test_beats_flat_variance | Stratifying spreads less than flat sampling where the observable depends only on the fault count. | ✅ pass |
test_matches_importance_coherent | Under a coherent RZ plus depolarizing, stratified and flat importance sampling agree (both unbiased). | ✅ pass |
test_unbiased_dephasing | Stratified <X..X> matches the exact (1-2p)^n for independent dephasing. | ✅ pass |
test_bias_axes | bias_split puts the heavy rate on the axis it is told to, and eta = 0.5 is depolarizing on all three. | ✅ pass |
test_bias_duality | A biased surface-code memory is self-dual: swapping bias_axis and memory together (X <-> Z) gives the same detector error model. | ✅ pass |
test_correlated_pair_fault | A ZZ-only PAULI_CHANNEL_2 reaches the DEM as ONE error flipping both qubits' detectors, which no product of single-qubit channels can express. | ✅ pass |
test_isotropic_default | A bare scalar is the isotropic channel: DEPOLARIZE1 and PAULI_CHANNEL_1 spread p evenly over X, Y, Z, and DEPOLARIZE2 and PAULI_CHANNEL_2 over the 15 pairs. | ✅ pass |
test_pair_rates | A {label: rate} dict puts each rate on the Pauli it names, every unlisted one at zero, and its label width sets the arity. | ✅ pass |