rcwa


Namercwa JSON
Version 1.0.48 PyPI version JSON
download
home_pagehttps://github.com/edmundsj/RCWA
SummaryPython Implementation of Rigorous Coupled Wave Analysis
upload_time2023-05-19 04:20:26
maintainer
docs_urlNone
authorJordan Edmunds
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            [![Build](https://github.com/edmundsj/rcwa/actions/workflows/build.yml/badge.svg)](https://github.com/edmundsj/rcwa/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/edmundsj/rcwa/branch/master/graph/badge.svg?token=UDJ1TUESG3)](https://codecov.io/gh/edmundsj/rcwa) [![docs](https://github.com/edmundsj/rcwa/actions/workflows/build-docs.yml/badge.svg)](https://github.com/edmundsj/rcwa/actions/workflows/build-docs.yml) [![PyPI version](https://badge.fury.io/py/rcwa.svg)](https://badge.fury.io/py/rcwa) [![DOI](https://zenodo.org/badge/236611452.svg)](https://zenodo.org/badge/latestdoi/236611452)

What this package can do
===========================
- Calculate reflectance, transmittance, and scattering parameters from stacks of planar thin films
- Simulate diffraction efficiencies, scattering matrices from 1D diffraction gratings
- Simulate diffraction efficiencies, scattering matrices from 2D photonic crystals


Getting Started
================
Installation
--------------
The recommended way to install this software is with `pip`:

```
pip install rcwa
```

And that's it! 

Hello World Program
----------------------
To see a simple example, run:

```
python -m rcwa.examples.bragg_mirror
```

This should run an example with a 10-layer bragg mirror (also known as a [dielectric mirror](https://en.wikipedia.org/wiki/Dielectric_mirror)), which can have very high reflectance near its design wavelength, and output the reflectance as a function of wavelength, as seen below:

![Bragg Mirror Plot](/images/rcwa_example_plot.png)


Features
==========
- Implements 1D Transfer Matrix Method for homogenous layers
- Implements full rectangular 2D RCWA for periodic layers
- Huge material database for n/k values in optical range built-in based on [refractiveindex.info](https://refractiveindex.info/), including metals, plastics, glass, and ceramics
- Easy to use class-based syntax 
- Integrated parameter sweeps of any simulation parameter: geometry, materials, wavelength, angle of incidence, etc.
- Compute reflection and transmission spectra at arbitrary incidence and polarization
- Compute spectroscopic ellipsometry curves
- Compute reflected power, transmitted power, and S-parameters
- Large, fast-to-run test suite
- Extremely fast narrowband, rigorously correct simulations well suited for resonant devices
- Built-in convergence testing 

Example Uses
==============
- Compute reflected and transmitted power from a thin film stack
- Determine resonant frequency of a VCSEL
- Determine reflectance of a bragg mirror, on or off-axis
- Find diffraction efficiencies for a 1D or 2D diffraction grating
- Compute reflected power from a metallic mirror

Examples
============
All examples are in the `examples/` directory in your locally installed `rcwa` package, or in `rcwa/examples/` on this repository.

Reflection off Dispersive Materials
---------------------------------------

The below example demonstrates the reflection spectra you get reflecting off a bare surface of silicon, using the built-in materials database.

```
from rcwa import Material, Layer, LayerStack, Source, Solver, Plotter

import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
startWavelength = 0.25
stopWavelength = 0.8
stepWavelength = 0.001

# Setup the source
source = Source(wavelength=startWavelength)

# Setup the materials and geometry
si = Material(name='Si')

# Setup the interface
reflectionLayer = Layer(n=1) # Free space
transmissionLayer = Layer(material=si)
stack = LayerStack(incident_layer=reflectionLayer, transmission_layer=transmissionLayer)

# Setup the solver
TMMSolver = Solver(stack, source, (1, 1))

# Setup and run the sweep
wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
        stepWavelength)
results = TMMSolver.solve(wavelength=wavelengths)
results.plot(x='wavelength', y='RTot', show=True)
```
![Dispersive Si Plot](/images/si_dispersive.png)

Source Wavelength / Angle Sweeps
----------------------------------
```
import numpy as np
from rcwa import Material, Layer, LayerStack, Source, Solver, Plotter

# Setup the source
startWavelength = 0.25
stopWavelength = 0.8
stepWavelength = 0.02
wavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,
        stepWavelength)
thetas = np.linspace(0, np.pi/4,10)

source = Source(wavelength=startWavelength)

thin_film = Layer(thickness=0.1, n=2)
substrate = Layer(n=4)
stack = LayerStack(thick_film, transmission_layer=substrate)

solver = Solver(stack, source)

results = solver.solve(wavelength=wavelengths, theta=thetas)
results.plot(x='wavelength', y='RTot', show=True)

```
![Reflectance vs Wavelength with varying angle](/images/wavelength_angle_sweep.png)

Geometry Sweeps
-------------------------------------------------------------------------------
Here, we set up a simulation with a rectangular grating on a substrate with a relative permittivity of 9, and a wavelength of 0.5 units (microns, meters, whatever you like!). This can be found in the `grating_sweep.py` example. In this example we are sweeping the thickness, but we could have swept the period or refractive index or permittivity.

```
from rcwa import Source, Layer, LayerStack, Crystal, Solver, RectangularGrating
import numpy as np
from matplotlib import pyplot as plt

reflection_layer = Layer(er=1.0, ur=1.0)
transmission_layer = Layer(er=9.0, ur=1.0)

wavelength = 0.5
source = Source(wavelength=wavelength)

N_harmonics = 11

grating_layer = RectangularGrating(period=2, thickness=0.5, n=4, n_void=1, nx=500)
layer_stack = LayerStack(grating_layer, incident_layer=reflection_layer, transmission_layer=transmission_layer)

solver_1d = Solver(layer_stack, source, N_harmonics)
results = solver_1d.solve((grating_layer, {'thickness': np.linspace(0.3, 0.5, 100)}))

results.plot(x='thickness', y='RTot', show=True)
```
![Reflectance vs Thickness](/images/reflectance_vs_thickness.png)

Documentation
================
This  project is documented on [Github Pages](https://edmundsj.github.io/rcwa/). For additional information, including downloading examples, you can view this project on [github](https://github.com/edmundsj/RCWA). 

Author: Jordan Edmunds, UC Irvine Alumnus, UC Berkeley Ph.D. Student

Date Started: 2020/01/05

Frequently Asked Questions
=============================
Q: How do I tell the solver to use the Transfer Matrix Method or Rigorous Coupled Wave Analysis?
A: Don't worry, it will figure it out for you.

License
=========
This project is distributed under the [MIT license](https://mit-license.org/).

Dependencies
=============
Dependencies are comprehensively covered by the setup.py file, and the most
recent set of dependencies can be found there. Currently, this requires numpy,
scipy, pandas, matplotlib, and pyyaml. The documentation is built using Sphinx
and hosted on readthedocs.io.

Acknowledgements / References
===============================
This work is based primarily on a set of lectures and associated course
material by Professor [Raymond Rumpf](http://emlab.utep.edu/team.htm)  at
the University of Texas, El Paso. 

[1] Rakić, Aleksandar D., Aleksandra B. Djurišić, Jovan M. Elazar, and Marian L. Majewski. "Optical properties of metallic films for vertical-cavity optoelectronic devices." Applied optics 37, no. 22 (1998): 5271-5283.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/edmundsj/RCWA",
    "name": "rcwa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jordan Edmunds",
    "author_email": "jordan.e@berkeley.edu",
    "download_url": "https://files.pythonhosted.org/packages/85/ee/1e467333281ca1c55e486a75f35fd95dd3636df6db67ba20ad52e36201a7/rcwa-1.0.48.tar.gz",
    "platform": null,
    "description": "[![Build](https://github.com/edmundsj/rcwa/actions/workflows/build.yml/badge.svg)](https://github.com/edmundsj/rcwa/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/edmundsj/rcwa/branch/master/graph/badge.svg?token=UDJ1TUESG3)](https://codecov.io/gh/edmundsj/rcwa) [![docs](https://github.com/edmundsj/rcwa/actions/workflows/build-docs.yml/badge.svg)](https://github.com/edmundsj/rcwa/actions/workflows/build-docs.yml) [![PyPI version](https://badge.fury.io/py/rcwa.svg)](https://badge.fury.io/py/rcwa) [![DOI](https://zenodo.org/badge/236611452.svg)](https://zenodo.org/badge/latestdoi/236611452)\n\nWhat this package can do\n===========================\n- Calculate reflectance, transmittance, and scattering parameters from stacks of planar thin films\n- Simulate diffraction efficiencies, scattering matrices from 1D diffraction gratings\n- Simulate diffraction efficiencies, scattering matrices from 2D photonic crystals\n\n\nGetting Started\n================\nInstallation\n--------------\nThe recommended way to install this software is with `pip`:\n\n```\npip install rcwa\n```\n\nAnd that's it! \n\nHello World Program\n----------------------\nTo see a simple example, run:\n\n```\npython -m rcwa.examples.bragg_mirror\n```\n\nThis should run an example with a 10-layer bragg mirror (also known as a [dielectric mirror](https://en.wikipedia.org/wiki/Dielectric_mirror)), which can have very high reflectance near its design wavelength, and output the reflectance as a function of wavelength, as seen below:\n\n![Bragg Mirror Plot](/images/rcwa_example_plot.png)\n\n\nFeatures\n==========\n- Implements 1D Transfer Matrix Method for homogenous layers\n- Implements full rectangular 2D RCWA for periodic layers\n- Huge material database for n/k values in optical range built-in based on [refractiveindex.info](https://refractiveindex.info/), including metals, plastics, glass, and ceramics\n- Easy to use class-based syntax \n- Integrated parameter sweeps of any simulation parameter: geometry, materials, wavelength, angle of incidence, etc.\n- Compute reflection and transmission spectra at arbitrary incidence and polarization\n- Compute spectroscopic ellipsometry curves\n- Compute reflected power, transmitted power, and S-parameters\n- Large, fast-to-run test suite\n- Extremely fast narrowband, rigorously correct simulations well suited for resonant devices\n- Built-in convergence testing \n\nExample Uses\n==============\n- Compute reflected and transmitted power from a thin film stack\n- Determine resonant frequency of a VCSEL\n- Determine reflectance of a bragg mirror, on or off-axis\n- Find diffraction efficiencies for a 1D or 2D diffraction grating\n- Compute reflected power from a metallic mirror\n\nExamples\n============\nAll examples are in the `examples/` directory in your locally installed `rcwa` package, or in `rcwa/examples/` on this repository.\n\nReflection off Dispersive Materials\n---------------------------------------\n\nThe below example demonstrates the reflection spectra you get reflecting off a bare surface of silicon, using the built-in materials database.\n\n```\nfrom rcwa import Material, Layer, LayerStack, Source, Solver, Plotter\n\nimport numpy as np\nimport pandas as pd\nfrom matplotlib import pyplot as plt\nstartWavelength = 0.25\nstopWavelength = 0.8\nstepWavelength = 0.001\n\n# Setup the source\nsource = Source(wavelength=startWavelength)\n\n# Setup the materials and geometry\nsi = Material(name='Si')\n\n# Setup the interface\nreflectionLayer = Layer(n=1) # Free space\ntransmissionLayer = Layer(material=si)\nstack = LayerStack(incident_layer=reflectionLayer, transmission_layer=transmissionLayer)\n\n# Setup the solver\nTMMSolver = Solver(stack, source, (1, 1))\n\n# Setup and run the sweep\nwavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,\n        stepWavelength)\nresults = TMMSolver.solve(wavelength=wavelengths)\nresults.plot(x='wavelength', y='RTot', show=True)\n```\n![Dispersive Si Plot](/images/si_dispersive.png)\n\nSource Wavelength / Angle Sweeps\n----------------------------------\n```\nimport numpy as np\nfrom rcwa import Material, Layer, LayerStack, Source, Solver, Plotter\n\n# Setup the source\nstartWavelength = 0.25\nstopWavelength = 0.8\nstepWavelength = 0.02\nwavelengths = np.arange(startWavelength, stopWavelength + stepWavelength,\n        stepWavelength)\nthetas = np.linspace(0, np.pi/4,10)\n\nsource = Source(wavelength=startWavelength)\n\nthin_film = Layer(thickness=0.1, n=2)\nsubstrate = Layer(n=4)\nstack = LayerStack(thick_film, transmission_layer=substrate)\n\nsolver = Solver(stack, source)\n\nresults = solver.solve(wavelength=wavelengths, theta=thetas)\nresults.plot(x='wavelength', y='RTot', show=True)\n\n```\n![Reflectance vs Wavelength with varying angle](/images/wavelength_angle_sweep.png)\n\nGeometry Sweeps\n-------------------------------------------------------------------------------\nHere, we set up a simulation with a rectangular grating on a substrate with a relative permittivity of 9, and a wavelength of 0.5 units (microns, meters, whatever you like!). This can be found in the `grating_sweep.py` example. In this example we are sweeping the thickness, but we could have swept the period or refractive index or permittivity.\n\n```\nfrom rcwa import Source, Layer, LayerStack, Crystal, Solver, RectangularGrating\nimport numpy as np\nfrom matplotlib import pyplot as plt\n\nreflection_layer = Layer(er=1.0, ur=1.0)\ntransmission_layer = Layer(er=9.0, ur=1.0)\n\nwavelength = 0.5\nsource = Source(wavelength=wavelength)\n\nN_harmonics = 11\n\ngrating_layer = RectangularGrating(period=2, thickness=0.5, n=4, n_void=1, nx=500)\nlayer_stack = LayerStack(grating_layer, incident_layer=reflection_layer, transmission_layer=transmission_layer)\n\nsolver_1d = Solver(layer_stack, source, N_harmonics)\nresults = solver_1d.solve((grating_layer, {'thickness': np.linspace(0.3, 0.5, 100)}))\n\nresults.plot(x='thickness', y='RTot', show=True)\n```\n![Reflectance vs Thickness](/images/reflectance_vs_thickness.png)\n\nDocumentation\n================\nThis  project is documented on [Github Pages](https://edmundsj.github.io/rcwa/). For additional information, including downloading examples, you can view this project on [github](https://github.com/edmundsj/RCWA). \n\nAuthor: Jordan Edmunds, UC Irvine Alumnus, UC Berkeley Ph.D. Student\n\nDate Started: 2020/01/05\n\nFrequently Asked Questions\n=============================\nQ: How do I tell the solver to use the Transfer Matrix Method or Rigorous Coupled Wave Analysis?\nA: Don't worry, it will figure it out for you.\n\nLicense\n=========\nThis project is distributed under the [MIT license](https://mit-license.org/).\n\nDependencies\n=============\nDependencies are comprehensively covered by the setup.py file, and the most\nrecent set of dependencies can be found there. Currently, this requires numpy,\nscipy, pandas, matplotlib, and pyyaml. The documentation is built using Sphinx\nand hosted on readthedocs.io.\n\nAcknowledgements / References\n===============================\nThis work is based primarily on a set of lectures and associated course\nmaterial by Professor [Raymond Rumpf](http://emlab.utep.edu/team.htm)  at\nthe University of Texas, El Paso. \n\n[1] Raki\u0107, Aleksandar D., Aleksandra B. Djuri\u0161i\u0107, Jovan M. Elazar, and Marian L. Majewski. \"Optical properties of metallic films for vertical-cavity optoelectronic devices.\" Applied optics 37, no. 22 (1998): 5271-5283.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Implementation of Rigorous Coupled Wave Analysis",
    "version": "1.0.48",
    "project_urls": {
        "Homepage": "https://github.com/edmundsj/RCWA"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "87de0a17c02ec366cd678f38ac05436e85dd09e0003621cd20e4ce980e69992b",
                "md5": "40a22befcfd0b0b2f129f2b8123bcdbc",
                "sha256": "915d9f7c7d91045c1f73f8cff54aeb1d5c0fdd010ce5a79ebbadf25502c2bee8"
            },
            "downloads": -1,
            "filename": "rcwa-1.0.48-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "40a22befcfd0b0b2f129f2b8123bcdbc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4621041,
            "upload_time": "2023-05-19T04:20:23",
            "upload_time_iso_8601": "2023-05-19T04:20:23.479267Z",
            "url": "https://files.pythonhosted.org/packages/87/de/0a17c02ec366cd678f38ac05436e85dd09e0003621cd20e4ce980e69992b/rcwa-1.0.48-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85ee1e467333281ca1c55e486a75f35fd95dd3636df6db67ba20ad52e36201a7",
                "md5": "e905772199fd6fbe39636ebda207037a",
                "sha256": "74ef6062acc04ef411011b963d16224537fcf912e2cb771f6f4b58de0300ac1b"
            },
            "downloads": -1,
            "filename": "rcwa-1.0.48.tar.gz",
            "has_sig": false,
            "md5_digest": "e905772199fd6fbe39636ebda207037a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8325680,
            "upload_time": "2023-05-19T04:20:26",
            "upload_time_iso_8601": "2023-05-19T04:20:26.551011Z",
            "url": "https://files.pythonhosted.org/packages/85/ee/1e467333281ca1c55e486a75f35fd95dd3636df6db67ba20ad52e36201a7/rcwa-1.0.48.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-19 04:20:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "edmundsj",
    "github_project": "RCWA",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "lcname": "rcwa"
}
        
Elapsed time: 0.16321s