PyStratify against tmmax

← Verification · Thin films · Plane wave
Reference
tmmax (JAX transfer matrix, float32)
Kind
code: another group's code
Calculated
R, T of five stacks (single layers, two layers, a 5-pair mirror, metal-dielectric) × 3 wavelengths × 3 angles × s, p
Agreement
2e-6 (float32; observed ≤ 4.2e-7). tmmax 1.1.4 is wrong for two or more coherent layers (up to 0.79 in R): its scan step builds a (2, 2, 1) array that matmul broadcasts — reported upstream (#45) and fixed on tmmax's main 2026-02-11, unreleased on PyPI; with the step fixed it agrees, shipped multilayers are shown, not asserted
100 nm of n = 2.1 in air, normal incidence: R against tmmax (JAX, float32) as shipped tmmax computes in single precision (its scan carries complex64), so agreement stops near 1e-7; single layers are asserted as shipped, to 2e-6.
40050060070080090000.10.20.30.4λ [nm]R
R, PyStratify R, tmmax 1.1.4 as shipped
Hover to read values.
  • largest |R − R_tmmax| (float32): 1.48×10⁻⁷
  • PyStratify the lines, the reference the circles
A five-pair quarter-wave mirror (n = 2.35 / 1.46) on glass, normal incidence: R against tmmax, as shipped and with its scan step fixed tmmax 1.1.4, the version on PyPI, is wrong for two or more layers: its scan step broadcasts the 2×2 matrices as a stack of column vectors (reported upstream, bahremsd/tmmax #44, #45; fixed on its main branch, not released). With the step rebuilt (tmmax_films.py) it agrees to float32; as shipped it is off by up to 0.79. The test asserts the fixed step on multilayers.
40050060070080090000.20.40.60.81λ [nm]R
R, PyStratify R, tmmax 1.1.4 with the scan step fixed R, tmmax 1.1.4 as shipped
Hover to read values.
  • largest |R − R_tmmax| (fixed step, float32): 1.12×10⁻⁶
  • PyStratify the lines, the reference the circles

Run it yourself: tmmax_films.py · test_tmmax_films.py · figures.py · TMMAX_FILMS.md on GitHub, PyStratify 97e52a9