Releases: AI4Optics/DiffTMM
Releases · AI4Optics/DiffTMM
v0.2.0 — Real materials + incoherent solver
Highlights
This release adds two major capabilities on top of the v0.1.2 anisotropic / isotropic solvers — real materials and incoherent layers — both fully autograd-friendly.
Real materials (wavelength-dependent dispersion)
New Material class with bundled catalogs:
- Sellmeier glasses — CDGM, SCHOTT, MISC, PLASTIC AGF catalogs (hundreds of optical glasses).
- Linear-interp n+k tables —
thin_film_materials.jsonfor common thin-film materials (SiO₂, TiO₂, Ag, …). - Solvers now accept
str/float/complex/Materialinterchangeably inmat_in,mat_out,mat_ls. FilmSolver(anisotropic 4×4) accepts(mat_x, mat_y, mat_z)tuples for per-axis dispersion.
from difftmm import IsotropicFilmSolver
solver = IsotropicFilmSolver(
mat_in="air", mat_out="N-BK7",
mat_ls=["TiO2", "SiO2"],
thickness_ls=[0.06, 0.10],
)
ts, tp, rs, rp = solver.simulate(theta=angles, wvln=[0.45, 0.55, 0.65])IncoherentIsotropicFilmSolver (intensity TMM)
Marks each interior layer coherent ('c') or incoherent ('i') so thick substrates don't produce non-physical Fabry-Perot ripples. Matches tmm_numpy.inc_tmm and is fully differentiable.
solver = IncoherentIsotropicFilmSolver(
mat_in=1.0, mat_out=1.0,
mat_ls=[2.40, 1.52],
c_list=["c", "i"], # TiO2 coherent, 1mm glass incoherent
thickness_ls=[0.100, 1000.0],
)
Rs, Rp, Ts, Tp = solver.simulate(theta=theta, wvln=wvln)New example notebooks
3_real_materials.ipynb— Material class, AR coating with TiO₂/SiO₂ on N-BK7, Kretschmann SPR with silver.4_incoherent_film.ipynb— coherent vs incoherent reflectance on a 1 mm substrate, plus a gradient-descent demo that converges to the analytical λ/(4n) AR optimum.
Tests
54 passing (36 material + 18 incoherent).
Install
pip install difftmm==0.2.0