pyoptics

Wave optics, ray optics and lithography simulation in Python.

pyoptics is a toolbox for optical simulation built on NumPy and SciPy: scalar and vectorial wave propagation, Gaussian beams and modes, thin films and polarization, imaging and aberrations, sequential ray tracing, wavefront metrology and a full lithography imaging stack. Its blocks are small and independent, so a propagator, a Zernike basis or a ray traced lens can be reused in new contexts. The numerics are checked against analytic results throughout.

Status

pyoptics is version 0.1, a research and teaching toolbox rather than a polished library. It runs on Python 3.9 to 3.13. The API may still change between versions, and there is no release on PyPI yet.

The numerics are tested against analytical results by about 900 pytest tests, which run in GitHub Actions on Python 3.9, 3.11 and 3.13 for every push and pull request. The few unfinished parts are listed in the module overview, planned work in WIP.md.

Where to start

  • Installation: build pyoptics from source into a virtual environment.

  • Modules: what each module does and how mature it is.

  • Conventions: phase signs, FFT centering and sign rules used throughout. Read this before comparing results with a textbook.

  • Examples: 43 notebooks with figures, one per topic, most of them comparing the numerics with analytic results.

  • API reference: every module, class and function.