Skip to main content

Neural Inverse Design of Nanostructures (NIDN)

Documentation Status GitHub Workflow Status (branch) GitHub last commit GitHub PyPI - Python Version GitHub contributors GitHub issues GitHub pull requests

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Neural Inverse Design of Nanostructures (NIDN) is a Python project by the Advanced Concepts Team of ESA. The goal of the project is to enable inverse design of stacks of nanostructures, metamaterials, photonic crystals, etc., using neural networks in PyTorch. As forward models, it supports rigorous coupled-wave analysis and a finite-difference time-domain solver. There is an accompanying paper about to be published.

Scheme

Neural Inverse Design of Nanostructures with PyTorch
Explore the docs »

View Example notebook · Report Bug · Request Feature

Built With

This project is based on:

  • grcwa which was modified to include PyTorch support to allow neural network training.
  • fdtd which was modified to allow training neural networks with it and match the setup of NIDN

For more details than provided with NIDN on the forward models please refer to their docs. The adaptations of there code are in the folders nidn/trcwa/ and nidn/fdtd/.

Below you can see results of an exemplary optimization of a three-uniform-layer material to design a 1150nm filter.

Exemplary optimization of a three-uniform-layer material to design a 1150nm filter. | width=300 Exemplary optimization of a three-uniform-layer material to design a 1150nm filter. | width=300

Getting Started

This is a brief guide how to set up NIDN.

Installation

The easiest way is to pip install NIDN via

pip install nidn.

Alternatively, to use the latest code from this repo git clone the repository and make sure you have all the requirements installed.

To set up a conda environment for the project run conda env create -f environment.yml.

This will create a conda environment called nidn for it.

If you just want to install the module in your current environment you can run

pip install . in the root folder where the setup.py is located.

While NIDN does support GPU utilization there are only modest performance benefits to it at time of writing.

Test

After cloning the repository, developers can check the functionality of NIDN by running the following command in the nidn/tests directory:

pytest

Usage

Config

NIDN uses a central config file which is passed through the entire program. The default config parameters can be seen here. Practical usage of the config files is demonstrated in the included Jupyter notebook.

Use Case 1: Forward Model Simulation

This serves to compute the spectral characteristics of a material. The Jupyter notebooks Forward_Model_Simulation_with_FDTD.ipynb and Forward_Model_Simulation_with_RCWA.ipynb demonstrate this use case.

Use Case 2: Inverse Design of Nanostructures

This is the case you aim to design a material matching some target spectral characteristics. A thorough explanation is given in the Jupyter notebooks Inverse_Material_Design_with_FDTD.ipynb and Inverse_Material_Design_with_RCWA.ipynb.

Logging & Docs

To change the logging verbosity call nidn.setLogLevel(level) where level is one of TRACE,DEBUG,INFO,WARN and ERROR.

Detailed docs of NIDN are online can be built with sphinx. To do so, make sure sphinx is installed and run make html in the docs folder to get a local html version of the docs. readthedocs support may follow.

Supported Materials

If you try to design a material with the classification approach (see mentioned notebooks for more details), all materials in the materials folder will be utilized. You can manually add other materials there using data from, e.g., refractiveindex.info.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

The project is open to community contributions. Feel free to open an issue or write us an email if you would like to discuss a problem or idea first.

If you want to contribute, please

  1. Fork the project on GitHub.
  2. Get the most up-to-date code by following this quick guide for installing nidn from source:
    1. Get miniconda or similar
    2. Clone the repo
    git clone https://github.com/esa/nidn.git
    
    1. With the default configuration PyTorch with CUDA support is installed. If this should not happen, comment out cudatoolkit in the environment.yml.
    2. Set up the environment. This creates a conda environment called nidn and installs the required dependencies.
    conda env create -f environment.yml
    conda activate nidn
    

Once the installation is done, you are ready to contribute. Please note that PRs should be created from and into the main branch.

  1. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  2. Commit your Changes (git commit -m 'Add some AmazingFeature')
  3. Push to the Branch (git push origin feature/AmazingFeature)
  4. Open a Pull Request on the main branch.

and we will have a look at your contribution as soon as we can.

Furthermore, please make sure that your PR passes all automated tests. Review will only happen after that. Only PRs created on the main branch with all tests passing will be considered.

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contact

Created by ESA's Advanced Concepts Team

  • Pablo Gómez - pablo.gomez at esa.int

Project Link: https://github.com/esa/nidn

Metadata

Release files for nidn 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nidn 0.1.1
File Size Uploaded Provenance Actions
nidn-0.1.1.tar.gz 160.1 kB Without provenance Details for nidn-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nidn 0.1.1
File Interpreter ABI Platform Actions
nidn-0.1.1-py3-none-any.whl Python 3 none any Details for nidn-0.1.1-py3-none-any.whl

Total release size: 340.4 kB

Release files / nidn-0.1.1.tar.gz

Download URL nidn-0.1.1.tar.gz
Size 160.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8bbdc0ea512f524fa6c5bc9940e29f0f987283a6a120dbc5227f08c8f0e6aa8f
BLAKE2b-256 checksum
How to use checksums
7cc92508f41d053815c4375f460da28f0e770a6271738b2e899bb93ff2ccb975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / nidn-0.1.1-py3-none-any.whl

Download URL nidn-0.1.1-py3-none-any.whl
Size 180.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2def07153de16e779dd725f860d146bd5fcc0804b6dc99262e8291aa4bf9490
BLAKE2b-256 checksum
How to use checksums
cc5a4dfe017c5fa0e89b8ad89f6ad5759d32195440dd74a980212d356826ec44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Security for nidn 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page