Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bahremsd authored Feb 5, 2025
1 parent e858ab2 commit dff67bb
Showing 1 changed file with 46 additions and 76 deletions.
122 changes: 46 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,89 +24,36 @@

## Introduction

## Documentation

## Usage

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/docs/images/thin_film_example.png" alt="usage_example">
</div>

## Database

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/docs/images/SiO2_nk_plot.png" alt="database_example_sio2">
</div>

## Benchmarks

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/benchmarks/layer_size_exp_results/layer_size_figure.png" alt="layer_size_exp">
</div>

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/benchmarks/vmap_array_length_exp_results/vmap_array_length_figure.png" alt="vmap_array_length_exp">
</div>

## Installation

## License

## Credits

## Contact and Support














`tmmax` is a highly optimized Python library for simulating the optical properties of multilayer thin films using the Transfer Matrix Method (TMM). This library leverages the power of **JAX**, a modern numerical computing library, to deliver high-performance computations, automatic differentiation, and seamless GPU/TPU acceleration. By exploiting JAX’s vectorized operations and just-in-time (JIT) compilation, `tmmax` achieves unprecedented efficiency and speed in modeling complex multilayer systems.


## **Advantages**


- **Speed**: JAX's JIT compilation accelerates TMM calculations, enabling large-scale simulations to run in a fraction of the time compared to traditional methods.
- **Vectorization**: `tmmax` supports vectorized calculations for reflectance and transmittance over multiple wavelengths and angles of incidence, enhancing efficiency during parameter sweeps.
- **Automatic Differentiation**: With JAX's automatic differentiation, `tmmax` can compute gradients efficiently, facilitating the optimization of thin film designs.
- **GPU/TPU Support**: `tmmax` can offload computations to GPUs or TPUs, making it ideal for resource-intensive optical simulations.


## **Benchmarks**

`tmmax` is a high-performance computational library designed for efficient calculation of optical properties in multilayer thin-film structures. Engineered to serve as a Swiss Army knife tool for thin-film optics research, `tmmax` integrates a comprehensive suite of advanced numerical methods. At its core, `tmmax` leverages JAX to enable just-in-time (JIT) compilation, vectorized operations, and XLA (Accelerated Linear Algebra) optimizations, dramatically accelerating the evaluation of optical responses in multilayer coatings. By exploiting these capabilities, `tmmax` achieves exceptional computational speed, making it the optimal choice for modeling and analyzing complex systems.

![image](benchmarks/layer_size_experiment/execution_time_vs_layers.png)
Originally architected for CPU-based execution to ensure accessibility and scalability across diverse hardware configurations, `tmmax` seamlessly extends its computational efficiency to GPU and TPU platforms, thanks to JAX’s unified execution model. This adaptability ensures that high-performance simulations can be executed efficiently across a range of computing environments without modifying the core implementation. Moreover, `tmmax` natively supports automatic differentiation (AD) through JAX’s powerful autograd framework, allowing users to compute analytical gradients of optical properties with respect to arbitrary system parameters. This capability makes it particularly well-suited for gradient-based inverse design, machine learning-assisted optimization, and parameter estimation in photonic applications, providing a direct pathway to next-generation thin-film engineering.


The benchmark comparison demonstrates a significant computational efficiency gain when using the `tmmax` package over the widely used `tmm` library, especially for simulations involving a large number of layers. As the number of layers increases, the execution time for `tmm` scales linearly, demonstrating a performance bottleneck, while `tmmax` exhibits near-constant execution time beyond a small initial rise, suggesting superior handling of computational complexity. (Despite the increasing number of layers, both the wavelength array and theta array lengths were kept constant at 20, ensuring the results purely reflect the scaling behavior with respect to the number of layers.)


![image](benchmarks/wavelength_arr_experiment/execution_time_vs_wavelength_array_length.png)

## Documentation

![image](benchmarks/angle_arr_experiment/tmm_execution_time_vs_angle_length.png)
## Usage

```python
from tmmax.tmm import tmm

## **Installation**
# Define your multilayer stack and simulation parameters

You can install `tmmax` via PyPI:
material_list = ["Air", ... , "SiO2", ...]
thickness_list = jnp.array(...)
wavelength_arr = jnp.array(...)
angle_of_incidences = jnp.array(...)
polarization = 's' # or 'p'

```bash
pip3 install tmmax
result = tmm(material_list = material_list,
thickness_list = thickness_list,
wavelength_arr = wavelength_arr,
angle_of_incidences = angle_of_incidences,
polarization = polarization)
```

## **Usage**

Here is a basic example of how to use `tmmax`:
<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/docs/images/thin_film_example.png" alt="usage_example">
</div>

```python
from tmmax.tmm import tmm
Expand All @@ -126,13 +73,33 @@ result = tmm(material_list = material_list,
polarization = polarization)
```

For detailed usage instructions, refer to the documentation and examples provided in the repository.
## Database

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/docs/images/SiO2_nk_plot.png" alt="database_example_sio2">
</div>

## How to Cite This Repository
## Benchmarks

If you use or reference any of the templates provided in this repository, please cite it as follows:
<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/benchmarks/layer_size_exp_results/layer_size_figure.png" alt="layer_size_exp">
</div>

<div align="center">
<img src="https://github.com/bahremsd/tmmax/blob/master/benchmarks/vmap_array_length_exp_results/vmap_array_length_figure.png" alt="vmap_array_length_exp">
</div>

## Installation

You can install `tmmax` via PyPI:

```bash
pip3 install tmmax
```

## License

## Credits

```bibtex
@software{tmmax,
Expand All @@ -143,3 +110,6 @@ If you use or reference any of the templates provided in this repository, please
year = {2024}
}
```

## Contact and Support

0 comments on commit dff67bb

Please sign in to comment.