• Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Frequency-domain photonic simulation and inverse design optimization for linear and nonlinear devices

Angler

angler

angler (named for 'adjoint nonlinear gradients') is a package for simulating and optimizing optical structures.

It provides a finite-difference frequency-domain (FDFD) solver for simulating for linear and nonlinear devices in the frequency domain.

It also provides an easy to use package for adjoint-based inverse design and optimization of linear and nonlinear devices. For example, you can inverse design optical switches to transport power to different ports for different input powers:

Fields

angler is released as part of a paper Adjoint method and inverse design for nonlinear optical devices, which can be viewed here.

Installation

One can install the most stable version of angler and all of its dependencies (apart from MKL) using

pip install angler

Alternatively, to use the most current version

git clone https://github.com/fancompute/angler.git
pip install -e angler

And then this directory can be added to path to import angler, i.e.

import sys
sys.path.append('path/to/angler')

Make angler faster

The most computationally expensive operation in angler is the sparse linear system solve. This is done with scipy.sparse.linalg.spsolve() by default. If MKL is installed, angler instead uses this with a python wrapper pyMKL, which makes things significantly faster, depending on the problem. The best way to install MKL, if using anaconda, is

conda install MKL

(pyMKL does not work when MKL is pip installed.)

Examples / Quickstart

There are several jupyter notebook examples in the Notebooks/ directory.

For a good introduction, try:

Notebooks/Splitter.ipynb

For more specific applications:

Electromagnetic simulations

For modeling linear devices with our FDFD solver (no optimization), see

Notebooks/Linear_system.ipynb

For modeling nonlinear devices with FDFD (no optimization), see

Notebooks/Nonlinear_system.ipynb

Inverse design & optimization

For examples of optimizing linear devices, see

Notebooks/Splitter.ipynb
Notebooks/Accelerator.ipynb

For examples of optimizing nonlinear devices, see

Notebooks/2_port.ipynb
Notebooks/3_port.ipynb
Notebooks/T_port.ipynb

Package Structure

angler provides two main classes, Simulation and Optimization, which perform most of the functionality.

Generally, Simulation objects are used to perform FDFD simulations, and Optimization classes run inverse design and optimization algorithms over Simulations. To learn more about how angler works and how to use it, please take a look at angler/README.md for a more detailed explanation.

Tests

To run all tests:

python -m unittest discover tests

Or to run individually:

python tests/individual_test.py

Contributing

angler is under development and we welcome suggestions, pull-requests, feature-requests, etc.

If you contribute a new feature, please also write a few tests and document your changes in angler/README.md or the wiki.

Authors

angler was written by Tyler Hughes, Momchil Minkov, and Ian Williamson.

Citing

If you use angler, please cite us using

@article{Hughes2018,
author = {Hughes, Tyler W. and Minkov, Momchil and Williamson, Ian A. D. and Fan, Shanhui},
title = {Adjoint Method and Inverse Design for Nonlinear Nanophotonic Devices},
journal = {ACS Photonics},
volume = {5},
number = {12},
pages = {4781-4787},
year = {2018},
doi = {10.1021/acsphotonics.8b01522}
}

License

This project is licensed under the MIT License - see the LICENSE.md file for details. Copyright 2018 Tyler Hughes.

Acknowledgments

  • our logo was made by Nadine Gilmer :)
  • RIP Ian's contributions before the code merge
  • We made use of a lot of code snippets (and advice) from Jerry Shi

More Repositories

1

wavetorch

🌊 Numerically solving and backpropagating through the wave equation
Python
510
star
2

ceviche

🦐 Electromagnetic Simulation + Automatic Differentiation
Python
330
star
3

neuroptica

Flexible simulation package for optical neural networks
Python
205
star
4

legume

🌱 Guided-mode expansion of photonic crystal slabs
Python
102
star
5

qpga

Simulations of photonic quantum programmable gate arrays
Jupyter Notebook
100
star
6

workshop-invdesign

📐 Workshop material for optical inverse design and automatic differentiation
Jupyter Notebook
95
star
7

fdfdpy

Pure Python implementation of the finite difference frequency domain (FDFD) method for electromagnetics
Jupyter Notebook
53
star
8

ising-compiler

🍰 Compiling your code to an Ising Hamiltonian so you don't have to!
Jupyter Notebook
48
star
9

FDFD.jl

Pure Julia implementation of the finite difference frequency domain (FDFD) method for electromagnetics
Jupyter Notebook
32
star
10

Rigorous-Coupled-Wave-Analysis

Rigorous coupled wave analysis and PWEM implemented in short readable python codes
Jupyter Notebook
31
star
11

vtmm

Vectorized transfer matrix method (TMM) for computing the optical reflection and transmission of multilayer planar stacks
Python
17
star
12

simphox

Another inverse design library (wip)
Python
17
star
13

neuroptica-notebooks

Jupyter notebooks for the neuroptica simulator
Jupyter Notebook
8
star
14

Isolators_CMT

🎭 Coupled-mode theory for some modulation-based optical isolators
Jupyter Notebook
7
star
15

electro-optic-activation

This notebook contains code for the machine learning tasks in the electro-optic activation function paper
Jupyter Notebook
5
star
16

FDFDViz.jl

Visualization and plotting helper functions for FDFD.jl
Julia
4
star
17

synthetic-hamiltonians

Jupyter Notebook
3
star
18

rcwa4d

Rigorous Coupled Wave Analyses (RCWA) for layered structures with incommensurate periodicities
Jupyter Notebook
1
star
19

bilevel-inverse-design-of-optical-switch

inverse design of optical switch based on bilevel optimization inspired by meta-learning
Jupyter Notebook
1
star