Skip to main content

JaxLayerLumos: A JAX-based Differentiable Optical and Radio Frequency Simulator for Multilayer Structures

DOI DOI PyPI - Python Version GitHub Release License: MIT Code style: black Documentation Status

Overview

JaxLayerLumos is open-source transfer-matrix method (TMM) software designed for scientists, engineers, and researchers in optics and photonics. It provides a powerful yet intuitive interface for calculating the reflection and transmission (RT) of light through multi-layer optical structures. By inputting the refractive index, thickness of each layer, and the frequency vector, users can analyze how light interacts with layered materials, including the option to adjust for incidence angles. Our mission is to offer a lightweight, flexible, and fast alternative to commercial software, enabling users to perform complex optical simulations with ease. JaxLayerLumos is built with performance and usability in mind, facilitating the exploration of optical phenomena in research and development settings.

Features

  • Lightweight and Efficient: Optimized for performance, JaxLayerLumos ensures rapid calculations without the overhead of large-scale commercial software.
  • Gradient Calculation: Calculates the gradients over any variables involved in RT, powered by JAX.
  • Flexibility: Accommodates a wide range of materials and structures by allowing users to specify complex refractive indices, layer thicknesses, and frequency vectors.
  • Angle of Incidence Support: Expands simulation capabilities to include angled light incidence, providing more detailed analysis for advanced optical designs.
  • Open Source and Community-Driven: Encourages contributions and feedback from the community, ensuring continuous improvement and innovation.
  • Comprehensive Material Database: Includes a growing database of materials with their optical properties, streamlining the simulation setup process.

Installation

JaxLayerLumos can be easily installed by the following command using the PyPI repository.

pip install jaxlayerlumos

Alternatively, JaxLayerLumos can be installed from source.

pip install .

In addition, we support three installation modes, dev, benchmarking, and examples, where dev is defined for installing the packages required for development and software testing, benchmarking is for installing the packages required for benchmarking against different TMM software programs, and examples is needed for running the examples included in the examples directory. One of these modes can be used by commanding pip install .[dev], pip install .[benchmarking], or pip install .[examples].

Examples

A collection of examples in the examples directory exhibits various use cases and capabilities of our software. We provide the following examples:

  1. Reflection Spectra over Wavelengths Varying Incidence Angles
  2. Color Conversion
  3. Color Exploration with Thin-Film Structures
  4. Gradient Computation
  5. Effective Medium Approximation Across a Partially Graded Interface
  6. Graded Layers with Selected Interfaces
  7. Visualization of Light Sources
  8. Plotting of Optical Constants
  9. Thin-Film Structure Optimization with Bayesian Optimization
  10. Thin-Film Structure Optimization with DoG Optimizer
  11. Reflection Spectra over Frequencies for Radar Design
  12. Analysis of Solar Cells
  13. Transmission Spectra over Wavelengths Varying Thicknesses
  14. Triple Junction Solar Cells

Comparison of TMM Packages

We compare Ansys Optics, TMM-Fast, and tmm to our software.

Feature Ansys Optics (stackrt) TMM-Fast (PyTorch/NumPy) tmm (Pure Python) JaxLayerLumos (JAX)
Lightweight ❌ Bulky ✅ ✅ ✅
Speed ❌ Slow ✅ Fast ❌ Slow 🟨 Moderate
Gradient Support ❌ ✅ ❌ ✅
GPU Support ❌ ✅ ❌ ✅
TPU Support$^1$ ❌ ❌ ❌ ✅
Position-Dependent Absorption ❌ ❌ ✅ ✅
Optical Simulations ✅ ✅ ✅ ✅
Infrared Simulations 🟨 Limited 🟨 Limited ❌ ✅
Radio Wave Simulations 🟨 Limited ❌ ❌ ✅ Handles magnetic materials
Open Source ❌ Commercial ✅ MIT ✅ BSD-3-Clause ✅ MIT

$^1$ Because TPUs are optimized for low-precision computation, their simulation results may show reduced numerical precision.

Benchmarking against Other Software

We benchmark JaxLayerLumos against other software. Detailed benchmarking results can be found in COMPARISONS.md. These comparisons include the results of Ansys Optics, TMM-Fast, and tmm.

To obtain these results, you should install additional required packages. Before installing the packages, you should install PyTorch first. In particular, if you need the CPU version of PyTorch, you can install it using the following command.

pip install torch --index-url https://download.pytorch.org/whl/cpu

For details, you can refer to the official PyTorch instruction. Then, the required packages can be installed by the following command.

pip install .[benchmarking]

Finally, you can run the benchmarking code compare_methods.py in the benchmarking directory.

Software Testing and Test Automation

We provide a variety of test files in the tests directory. Before running the test files, the required packages should be installed by using pip install .[dev]. They can be run by commanding pytest tests/. Moreover, these test files are automatically tested via GitHub Actions, of which the configuration is defined in .github/workflows/pytest.yml.

Supported Materials

Materials supported by our software are described in MATERIALS.md.

JaxLayerLumos includes a growing library of materials, which are specified using either complex refractive indices or complex permittivities and permeabilities, which can be sourced from the literature or specified by users based on experimental data. When only complex refractive indices are provided, magnetic effects are assumed to be negligible, and the relative permeability is set to unity ($\mu_{r,j} = 1$), an assumption typically valid at optical frequencies. In the RF and microwave regimes, the electromagnetic properties of metals are derived from their electrical conductivity and magnetic susceptibility, while dielectrics are generally modeled with constant permittivity and negligible loss.

Contributing Guidelines

To contribute, please read CONTRIBUTING.md for our guidelines on issues, enhancements, and pull requests. Follow the outlined standards to keep the project consistent and collaborative.

Declaration of Large Language Model Usage

This project was initiated before large language models were incorporated into its development workflow. They are now actively used to support code revision, feature development, software maintenance, and text editing in this repository. In particular, we use Codex as an AI coding tool.

Citation

@article{LiM2025joss,
    author={Li, Mingxuan and Kim, Jungtaek and Leu, Paul W.},
    title={{JaxLayerLumos}: A {JAX}-based Differentiable Optical and Radio Frequency Simulator for Multilayer Structures},
    journal={Journal of Open Source Software},
    volume={10},
    number={114},
    pages={8572},
    year={2025}
}

Contributors

The Journal of Open Source Software paper author list is fixed at publication. This section recognizes software contributions to the project.

Contributor Role
Mingxuan Li Core contributor
Jungtaek Kim Core contributor
Paul W. Leu Core contributor
Boyi Sun Software contributor

For the full commit history, see the GitHub contributors graph.

License

JaxLayerLumos is released under the MIT License, promoting open and unrestricted access to software for academic and commercial use.

Acknowledgments

Metadata

Release files for jaxlayerlumos 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jaxlayerlumos 0.3.5
File Size Uploaded Provenance Actions
jaxlayerlumos-0.3.5.tar.gz 8.1 MB Without provenance Details for jaxlayerlumos-0.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for jaxlayerlumos 0.3.5
File Interpreter ABI Platform Actions
jaxlayerlumos-0.3.5-py3-none-any.whl Python 3 none any Details for jaxlayerlumos-0.3.5-py3-none-any.whl

Total release size: 8.6 MB

Release files / jaxlayerlumos-0.3.5.tar.gz

Download URL jaxlayerlumos-0.3.5.tar.gz
Size 8.1 MB
Tags Source
SHA-256 checksum
How to use checksums
c99dfc877cc400f44867b39388990012aa1b4fe5178548088b646f8074f85260
BLAKE2b-256 checksum
How to use checksums
98c7af51a8d2808f225e5ce1096de919ea5044d6c1ce9d01b07459b28061e4db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / jaxlayerlumos-0.3.5-py3-none-any.whl

Download URL jaxlayerlumos-0.3.5-py3-none-any.whl
Size 484.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f79cfccc439eb70826e2c8d78377585d80de8cbae714530db81e83065782af4f
BLAKE2b-256 checksum
How to use checksums
2487e5cfe5ace9ca05986fd7233223798e6473c816cdb67978980dadae1dc05d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for jaxlayerlumos 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page