FockBasics
Truncated number-basis construction, validation and truncation
8/8 passed in 78ms
| Test | What it does | Result |
|---|---|---|
test_axis_uniform | A non-uniform axis is refused on p as on x, and |1> scores 0.4262 on an even grid. | ✅ pass |
test_fock_ladder | |n> carries all its population on level n, with mean photon number n, purity 1, parity (-1)^n and nothing discarded. | ✅ pass |
test_kernel_range | A coherent state at x = 28 in 512 levels peaks at 1/pi with no NaN, and the Wigner kernel stays finite out to radius 150. | ✅ pass |
test_matrix_validated | from_matrix refuses non-Hermitian, non-unit-trace, negative-eigenvalue and non-square matrices, and the cutoff, level index, GKP squeezing and axis slots go the same way. | ✅ pass |
test_spectrum_settles | The 512-level thermal entropy is g(nbar) to 1e-6 in under 5 s, with the spectrum still non-negative. | ✅ pass |
test_states_physical | Every constructor returns a physical state, the pure ones at purity 1 and a lossy thermal state below it. | ✅ pass |
test_truncation_fires | An 18-photon coherent state reads truncated at cutoffs 8 and 20 and clean at 60, and tail() fires on a state displaced against its ceiling that discarded() calls clean. | ✅ pass |
test_vacuum_peaks | The vacuum Wigner peaks at 1/pi and its Husimi at 1/(2 pi) under dx dp, both integrating to 1. | ✅ pass |