From dff67bb0c393afb6cc852759faa6075340645f9a Mon Sep 17 00:00:00 2001 From: Bahrem Serhat Danis <99296854+bahremsd@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:24:10 +0300 Subject: [PATCH] Update README.md --- README.md | 122 ++++++++++++++++++++---------------------------------- 1 file changed, 46 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index e53866e..8e96973 100644 --- a/README.md +++ b/README.md @@ -24,89 +24,36 @@ ## Introduction -## Documentation - -## Usage - -
- usage_example -
- -## Database - -
- database_example_sio2 -
- -## Benchmarks - -
- layer_size_exp -
- -
- vmap_array_length_exp -
- -## 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`: +
+ usage_example +
```python from tmmax.tmm import tmm @@ -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 +
+ database_example_sio2 +
-## How to Cite This Repository +## Benchmarks -If you use or reference any of the templates provided in this repository, please cite it as follows: +
+ layer_size_exp +
+
+ vmap_array_length_exp +
+ +## Installation + +You can install `tmmax` via PyPI: + +```bash +pip3 install tmmax +``` + +## License + +## Credits ```bibtex @software{tmmax, @@ -143,3 +110,6 @@ If you use or reference any of the templates provided in this repository, please year = {2024} } ``` + +## Contact and Support +