View on GitHub

EMpy

ElectroMagnetic Python — Computational Electromagnetics & Photonics Suite

Transfer Matrix Method (2 × 2 & 4 × 4 Yeh–Berreman) in Python

EMpy.transfer_matrix provides exact frequency-domain transfer matrix method (TMM) solvers for planar stratified media across isotropic, dispersive, lossy, plasmonic, and arbitrarily 3D-rotated anisotropic multilayers.


Solvers & Capabilities


Quick Python Example: Quarter-Wave AR Coating on BK7 Glass

import numpy as np
import EMpy

wl0 = 550e-9
wls = np.linspace(400e-9, 800e-9, 401)
mgf2 = EMpy.materials.IsotropicMaterial("MgF2", n0=1.38)

ar_stack = EMpy.utils.Multilayer([
    EMpy.utils.Layer(EMpy.materials.Air, np.inf),
    EMpy.utils.Layer(mgf2, wl0 / (4.0 * 1.38)),
    EMpy.utils.Layer(EMpy.materials.BK7, np.inf),
])

sol = EMpy.transfer_matrix.IsotropicTransferMatrix(
    ar_stack, EMpy.utils.deg2rad(10.0)
).solve(wls)
# sol.Rs, sol.Rp, sol.Ts, sol.Tp give power reflectance & transmittance

Anti-reflection coating and TiO2/SiO2 DBR reflectance simulated with EMpy transfer matrix method

Kretschmann surface plasmon resonance ATR dip and lossy-to-lossless TIR limit


Benchmark Scripts & References

See also: Methodology & References · All Examples