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 "Multi-View Multi-Person 3D Pose Estimation with Plane Sweep Stereo"

Multi-View Multi-Person 3D Pose Estimation with Plane Sweep Stereo This repository includes the source code for our CVPR 2021 paper on multi-view mult

Jiahao Lin 66 Jan 4, 2023
Few-shot NLP benchmark for unified, rigorous eval

FLEX FLEX is a benchmark and framework for unified, rigorous few-shot NLP evaluation. FLEX enables: First-class NLP support Support for meta-training

AI2 85 Dec 3, 2022
Read and write layered TIFF ImageSourceData and ImageResources tags

Read and write layered TIFF ImageSourceData and ImageResources tags Psdtags is a Python library to read and write the Adobe Photoshop(r) specific Imag

Christoph Gohlke 4 Feb 5, 2022
Sudoku solver - A sudoku solver with python

sudoku_solver A sudoku solver What is Sudoku? Sudoku (Japanese: 数独, romanized: s

Sikai Lu 0 May 22, 2022
Simple Linear 2nd ODE Solver GUI - A 2nd constant coefficient linear ODE solver with simple GUI using euler's method

Simple_Linear_2nd_ODE_Solver_GUI Description It is a 2nd constant coefficient li

:) 4 Feb 5, 2022
LVI-SAM: Tightly-coupled Lidar-Visual-Inertial Odometry via Smoothing and Mapping

LVI-SAM This repository contains code for a lidar-visual-inertial odometry and mapping system, which combines the advantages of LIO-SAM and Vins-Mono

Tixiao Shan 1.1k Dec 27, 2022
GndNet: Fast ground plane estimation and point cloud segmentation for autonomous vehicles using deep neural networks.

GndNet: Fast Ground plane Estimation and Point Cloud Segmentation for Autonomous Vehicles. Authors: Anshul Paigwar, Ozgur Erkent, David Sierra Gonzale

Anshul Paigwar 114 Dec 29, 2022
Code for "Layered Neural Rendering for Retiming People in Video."

Layered Neural Rendering in PyTorch This repository contains training code for the examples in the SIGGRAPH Asia 2020 paper "Layered Neural Rendering

Google 154 Dec 16, 2022
git《Learning Pairwise Inter-Plane Relations for Piecewise Planar Reconstruction》(ECCV 2020) GitHub:

Learning Pairwise Inter-Plane Relations for Piecewise Planar Reconstruction Code for the ECCV 2020 paper by Yiming Qian and Yasutaka Furukawa Getting

null 37 Dec 4, 2022