Efficient electromagnetic solver based on rigorous coupled-wave analysis for 3D and 2D multi-layered structures with in-plane periodicity

Overview

logo

Inkstone simulates the electromagnetic properties of 3D and 2D multi-layered structures with in-plane periodicity, such as gratings, photonic-crystal slabs, metasurfaces, vertical-cavity or photonic-crystal surface-emitting lasers (VCSEL, PCSEL), (patterned) solar cells, nano-antennas, and more.

Internally, Inkstone implements rigorous coupled-wave analysis (RCWA), a. k. a. Fourier Modal Method (FMM).

Inkstone can calculate:

  • the reflection, transmission, and absorption of the structure
  • the total and by-order power fluxes of the propagating and the evanescent waves in each layer
  • electric and magnetic field amplitudes at any locations in the structure,
  • band-structures based on the determinant of the scattering matrix of the structure.

Features of Inkstone:

  • It supports efficient and flexible parameter-scanning. You can change part of your structure such as the shapes and sizes of some patterns, or some material parameters. Inkstone only recalculates the modified parts and produces the final results efficiently.
  • It allows both tensorial permittivities and tensorial permeabilities, such as in anisotropic, magneto-optical, or gyromagnetic materials.
  • It can calculate the determinant of the scattering matrix on the complex frequency plane.
  • Pre-defined shapes of patterns can be used, including rectangular, parallelogram, disk, ellipse, 1D, and polygons. Closed-form Fourier transforms and corrections for Gibbs phenomena are implemented.
  • It is fully 3D.
  • It is written in pure python, with heavy-lifting done in numpy and scipy.

Quick Start

Installation:

$ pip install inkstone

Or,

$ git clone git://github.com/alexysong/inkstone
$ pip install .

Usage

The examples folder contains various self-explaining examples to get you started.

Dependencies

  • python 3.6+
  • numpy
  • scipy

Units, conventions, and definitions

Unit system

We adopt a natural unit system, where vacuum permittivity, permeability, and light speed are $\varepsilon_0=\mu_0=c_0=1$.

Sign convention

Sign conventions in electromagnetic waves:

$$e^{i(kx-\omega t)}$$

where $k$ is the wavevector, $x$ is spatial location, $\omega$ is frequency, $t$ is time.

By this convention, a permittivity of $\varepsilon_r + i\varepsilon_i$ with $\varepsilon_i>0$ means material loss, and $\varepsilon_i<0$ means material gain.

Coordinates and incident angles

drawing

(Inkstone, Incident $\bm{k}$ on stacked periodic nano electromagnetic structures.)

Citing

If you find Inkstone useful for your research, we would apprecite you citing our paper. For your convenience, you can use the following BibTex entry:

@article{song2018broadband,
  title={Broadband Control of Topological Nodes in Electromagnetic Fields},
  author={Song, Alex Y and Catrysse, Peter B and Fan, Shanhui},
  journal={Physical review letters},
  volume={120},
  number={19},
  pages={193903},
  year={2018},
  publisher={American Physical Society}
}
You might also like...
Code for
Code for "Unsupervised Layered Image Decomposition into Object Prototypes" paper

DTI-Sprites Pytorch implementation of "Unsupervised Layered Image Decomposition into Object Prototypes" paper Check out our paper and webpage for deta

Codes for TS-CAM: Token Semantic Coupled Attention Map for Weakly Supervised Object Localization.
Codes for TS-CAM: Token Semantic Coupled Attention Map for Weakly Supervised Object Localization.

TS-CAM: Token Semantic Coupled Attention Map for Weakly SupervisedObject Localization This is the official implementaion of paper TS-CAM: Token Semant

[ICCV'21] PlaneTR: Structure-Guided Transformers for 3D Plane Recovery
[ICCV'21] PlaneTR: Structure-Guided Transformers for 3D Plane Recovery

PlaneTR: Structure-Guided Transformers for 3D Plane Recovery This is the official implementation of our ICCV 2021 paper News There maybe some bugs in

PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

 Layered Neural Atlases for Consistent Video Editing
Layered Neural Atlases for Consistent Video Editing

Layered Neural Atlases for Consistent Video Editing Project Page | Paper This repository contains an implementation for the SIGGRAPH Asia 2021 paper L

Dynamical movement primitives (DMPs), probabilistic movement primitives (ProMPs), spatially coupled bimanual DMPs.
Dynamical movement primitives (DMPs), probabilistic movement primitives (ProMPs), spatially coupled bimanual DMPs.

Movement Primitives Movement primitives are a common group of policy representations in robotics. There are many different types and variations. This

ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system
ObjectDrawer-ToolBox: a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system

ObjectDrawer-ToolBox is a graphical image annotation tool to generate ground plane masks for a 3D object reconstruction system, Object Drawer.

HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events globally on daily to subseasonal timescales.

HeatNet HeatNet is a python package that provides tools to build, train and evaluate neural networks designed to predict extreme heat wave events glob

NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling
NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling

NU-Wave: A Diffusion Probabilistic Model for Neural Audio Upsampling For Official repo of NU-Wave: A Diffusion Probabilistic Model for Neural Audio Up

Comments
  • Unable to verify Fresnel equations

    Unable to verify Fresnel equations

    Thank you for your transparent and usable Python port of S4.

    To verify that the code works correctly, I attempted to reproduce the Fresnel equations using a simple two layer model -- the first layer with n=1, and the second with n=1.5. I have been unable to get this to work in Inkstone, but I did get it to work with an equivalent code for Phoebe-P S4 . Attached are the codes I used for both Inkstone, fresnel_inkstone_te.py (which doesn't work); and S4, Fresnel_S4_TE.py (working).

    In inkstone, when I use angle = np.linspace(0, 90, 91) , I get the error: /inkstone/params.py:525: RuntimeWarning: Vacuum propagation constant 0 encountered. Possibly Wood's anomaly. warn("Vacuum propagation constant 0 encountered. Possibly Wood's anomaly.", RuntimeWarning)

    When I use angle = np.linspace(1, 90, 90) , I get the error: Traceback (most recent call last): File "fresnel_inkstone_te.py", line 71, in glapf, glapb = s.GetPowerFlux('gla') File "/inkstone/simulator.py", line 1204, in GetPowerFlux self.solve() File "/inkstone/simulator.py", line 890, in solve self._calc_sm() File "/inkstone/simulator.py", line 704, in _calc_sm s = next(ll[-1] for ll in self.csms if ll[-1][1] == n_layers-2) StopIteration

    If between the "air" air and "gla" glass layers, I add an intermediate layer: s.AddLayer(name='gla-int', thickness=1, material_background='glass')

    and still keep angle = np.linspace(1, 90, 90) then I get the error

    /.local/lib/python3.9/site-packages/inkstone/layer.py:545: RuntimeWarning: divide by zero encountered in divide vh = -1j * p @ v / w[:, None, :] /.local/lib/python3.9/site-packages/inkstone/layer.py:545: RuntimeWarning: invalid value encountered in divide vh = -1j * p @ v / w[:, None, :] Traceback (most recent call last): File "/inkstone/Fresnel_Inkstone/fresnel_inkstone_te.py", line 72, in glapf, glapb = s.GetPowerFlux('gla') File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 1204, in GetPowerFlux self.solve() File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 890, in solve self._calc_sm() File "/.local/lib/python3.9/site-packages/inkstone/simulator.py", line 682, in _calc_sm ll[ilm].solve() File "/.local/lib/python3.9/site-packages/inkstone/layer.py", line 702, in solve self._calc_im() File "/.local/lib/python3.9/site-packages/inkstone/layer.py", line 652, in _calc_im al0, bl0 = im(self.phil, self.psil, self.pr.phi0, self.pr.psi0, self._phil_is_idt) File "/.local/lib/python3.9/site-packages/inkstone/im.py", line 36, in im term2 = sla.solve(psi1, psi2) File "/.local/lib/python3.9/site-packages/scipy/linalg/_basic.py", line 140, in solve a1 = atleast_2d(_asarray_validated(a, check_finite=check_finite)) File "/.local/lib/python3.9/site-packages/scipy/_lib/_util.py", line 287, in _asarray_validated a = toarray(a) File "/.local/lib/python3.9/site-packages/numpy/lib/function_base.py", line 627, in asarray_chkfinite raise ValueError( ValueError: array must not contain infs or NaNs

    opened by matt8s 0
  • IndexError when calling

    IndexError when calling "ReconstructLayer"

    Hi,

    I'm trying to visualize the epsilon profile of the patterned layer named "slab" in the example file "phc_slab_circ_hole_spectrum.py", using ReconstructLayer (as defined on line 309 of simulator.py).

    I'm not entirely sure about the correct usage of ReconstructLayer but I'm just doing: s.ReconstructLayer('slab', 100, 100) or s.ReconstructLayer('slab') (since nx and ny both seem to default to 101). In both cases, I get the error:

    Traceback (most recent call last):
      File "phc_slab_circ_hole_spectrum.py", line 32, in <module>
        s.ReconstructLayer('slab')
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/inkstone/simulator.py", line 337, in ReconstructLayer
        result = self.layers[name].reconstruct(nx, ny)
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/inkstone/layer.py", line 395, in reconstruct
        for em in [fft.ifftshift(self.epsi_fs, axes=(0, 1)), fft.ifftshift(self.epsi_inv_fs, axes=(0, 1)), fft.ifftshift(self.mu_fs, axes=(0, 1)), fft.ifftshift(self.mu_inv_fs, axes=(0, 1))]]
      File "<__array_function__ internals>", line 6, in ifftshift
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/numpy/fft/helper.py", line 121, in ifftshift
        shift = [-(x.shape[ax] // 2) for ax in axes]
      File "/home/sachin/miniconda3/lib/python3.7/site-packages/numpy/fft/helper.py", line 121, in <listcomp>
        shift = [-(x.shape[ax] // 2) for ax in axes]
    IndexError: tuple index out of range
    

    Could you please help me with this?

    Thanks!

    opened by sachin4594 0
Releases(v0.2.4-alpha)
Owner
Alex Song
Senior Lecturer at the University of Sydney. Research interests include nanophotonics, topological materials, non-Hermicity, quantum optics, and sustainability.
Alex Song
Code for the ECCV2020 paper "A Differentiable Recurrent Surface for Asynchronous Event-Based Data"

A Differentiable Recurrent Surface for Asynchronous Event-Based Data Code for the ECCV2020 paper "A Differentiable Recurrent Surface for Asynchronous

Marco Cannici 21 Oct 05, 2022
Codes for ACL-IJCNLP 2021 Paper "Zero-shot Fact Verification by Claim Generation"

Zero-shot-Fact-Verification-by-Claim-Generation This repository contains code and models for the paper: Zero-shot Fact Verification by Claim Generatio

Liangming Pan 47 Jan 01, 2023
Ludwig is a toolbox that allows to train and evaluate deep learning models without the need to write code.

Translated in 🇰🇷 Korean/ Ludwig is a toolbox that allows users to train and test deep learning models without the need to write code. It is built on

Ludwig 8.7k Jan 05, 2023
FasterAI: A library to make smaller and faster models with FastAI.

Fasterai fasterai is a library created to make neural network smaller and faster. It essentially relies on common compression techniques for networks

Nathan Hubens 193 Jan 01, 2023
Efficient Training of Audio Transformers with Patchout

PaSST: Efficient Training of Audio Transformers with Patchout This is the implementation for Efficient Training of Audio Transformers with Patchout Pa

165 Dec 26, 2022
Emotion classification of online comments based on RNN

emotion_classification Emotion classification of online comments based on RNN, the accuracy of the model in the test set reaches 99% data: Large Movie

1 Nov 23, 2021
U-Net for GBM

My Final Year Project(FYP) In National University of Singapore(NUS) You need Pytorch(stable 1.9.1) Both cuda version and cpu version are OK File Str

PinkR1ver 1 Oct 27, 2021
Centroid-UNet is deep neural network model to detect centroids from satellite images.

Centroid UNet - Locating Object Centroids in Aerial/Serial Images Introduction Centroid-UNet is deep neural network model to detect centroids from Aer

GIC-AIT 19 Dec 08, 2022
A deep learning tabular classification architecture inspired by TabTransformer with integrated gated multilayer perceptron.

The GatedTabTransformer. A deep learning tabular classification architecture inspired by TabTransformer with integrated gated multilayer perceptron. C

Radi Cho 60 Dec 15, 2022
The official implementation of the Hybrid Self-Attention NEAT algorithm

PUREPLES - Pure Python Library for ES-HyperNEAT About This is a library of evolutionary algorithms with a focus on neuroevolution, implemented in pure

Adrian Westh 91 Dec 12, 2022
Reinfore learning tool box, contains trpo, a3c algorithm for continous action space

RL_toolbox all the algorithm is running on pycharm IDE, or the package loss error may exist. implemented algorithm: trpo a3c a3c:for continous action

yupei.wu 44 Oct 10, 2022
GLNet for Memory-Efficient Segmentation of Ultra-High Resolution Images

GLNet for Memory-Efficient Segmentation of Ultra-High Resolution Images Collaborative Global-Local Networks for Memory-Efficient Segmentation of Ultra-

VITA 298 Dec 12, 2022
Text Extraction Formulation + Feedback Loop for state-of-the-art WSD (EMNLP 2021)

ConSeC is a novel approach to Word Sense Disambiguation (WSD), accepted at EMNLP 2021. It frames WSD as a text extraction task and features a feedback loop strategy that allows the disambiguation of

Sapienza NLP group 36 Dec 13, 2022
Matching python environment code for Lux AI 2021 Kaggle competition, and a gym interface for RL models.

Lux AI 2021 python game engine and gym This is a replica of the Lux AI 2021 game ported directly over to python. It also sets up a classic Reinforceme

Geoff McDonald 74 Nov 03, 2022
This is the repo of the manuscript "Dual-branch Attention-In-Attention Transformer for speech enhancement"

DB-AIAT: A Dual-branch attention-in-attention transformer for single-channel SE

Guochen Yu 68 Dec 16, 2022
Diverse Object-Scene Compositions For Zero-Shot Action Recognition

Diverse Object-Scene Compositions For Zero-Shot Action Recognition This repository contains the source code for the use of object-scene compositions f

7 Sep 21, 2022
💡 Type hints for Numpy

Type hints with dynamic checks for Numpy! (❒) Installation pip install nptyping (❒) Usage (❒) NDArray nptyping.NDArray lets you define the shape and

Ramon Hagenaars 377 Dec 28, 2022
Code for the paper "MASTER: Multi-Aspect Non-local Network for Scene Text Recognition" (Pattern Recognition 2021)

MASTER-PyTorch PyTorch reimplementation of "MASTER: Multi-Aspect Non-local Network for Scene Text Recognition" (Pattern Recognition 2021). This projec

Wenwen Yu 255 Dec 29, 2022
(CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic

ClassSR (CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic Paper Authors: Xiangtao Kong, Hengyuan

Xiangtao Kong 308 Jan 05, 2023
Контрольная работа по математическим методам машинного обучения

ML-MathMethods-Test Контрольная работа по математическим методам машинного обучения. Вычисление основных статистик, диаграмм и графиков, проверка разл

Stas Ivanovskii 1 Jan 06, 2022