Package: nidn
Neural Inverse Design of Nanostructures (NIDN)Table of ContentsAbout The ProjectBuilt WithGetting StartedPrerequisitesInstallationTestUsageContributingLicenseContactAbout The ProjectNeural 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 supportsrigorous coupled-wave analysisand afinite-difference time-domainsolver. There is an accompanying paper about to be published.Neural Inverse Design of Nanostructures with PyTorchExplore the docs »View Example notebook·Report Bug·Request FeatureBuilt WithThis project is based on:grcwawhich was modified to includePyTorchsupport to allow neural network training.fdtdwhich was modified to allow training neural networks with it and match the setup of NIDNFor more details than provided with NIDN on the forward models please refer to their docs. The adaptations of there code are in the foldersnidn/trcwa/andnidn/fdtd/.Below you can see results of an exemplary optimization of a three-uniform-layer material to design a 1150nm filter.Getting StartedThis is a brief guide how to set up NIDN.InstallationThe easiest way is to pip install NIDN viapip install nidn.Alternatively, to use the latest code from this repogit clonethe repository and make sure you have all the requirements installed.To set up a conda environment for the project runconda env create -f environment.yml.This will create a conda environment callednidnfor it.If you just want to install the module in your current environment you can runpip install .in the root folder where thesetup.pyis located.While NIDN does support GPU utilization there are only modest performance benefits to it at time of writing.TestAfter cloning the repository, developers can check the functionality of NIDN by running the following command in thenidn/testsdirectory:pytestUsageConfigNIDN uses a central config file which is passed through the entire program. The default config parameters can be seenhere. Practical usage of the config files is demonstrated in theincluded Jupyter notebook.Use Case 1: Forward Model SimulationThis serves to compute the spectral characteristics of a material. The Jupyter notebooksForward_Model_Simulation_with_FDTD.ipynbandForward_Model_Simulation_with_RCWA.ipynbdemonstrate this use case.Use Case 2: Inverse Design of NanostructuresThis is the case you aim to design a material matching some target spectral characteristics. A thorough explanation is given in the Jupyter notebooksInverse_Material_Design_with_FDTD.ipynbandInverse_Material_Design_with_RCWA.ipynb.Logging & DocsTo change the logging verbosity callnidn.setLogLevel(level)where level is one ofTRACE,DEBUG,INFO,WARNandERROR.Detailed docs of NIDN areonlinecan be built with sphinx. To do so, make suresphinxis installed and runmake htmlin the docs folder to get a local html version of the docs. readthedocs support may follow.Supported MaterialsIf you try to design a material with theclassificationapproach (seementioned notebooksfor more details), all materials in thematerials folderwill be utilized. You can manually add other materials there using data from, e.g.,refractiveindex.info.RoadmapSee theopen issuesfor a list of proposed features (and known issues).ContributingThe project is open to community contributions. Feel free to open anissueor write us an email if you would like to discuss a problem or idea first.If you want to contribute, pleaseFork the project onGitHub.Get the most up-to-date code by following this quick guide for installing nidn from source:Getminicondaor similarClone the repogitclonehttps://github.com/esa/nidn.gitWith the default configuration PyTorch with CUDA
support is installed.
If this should not happen, comment outcudatoolkitin theenvironment.yml.Set up the environment. This creates a conda environment callednidnand installs the required dependencies.condaenvcreate-fenvironment.yml
condaactivatenidnOnce the installation is done, you are ready to contribute.
Please note that PRs should be created from and into themainbranch.Create your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull Request on themainbranch.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 themainbranch with all tests passing will be considered.LicenseDistributed under the GPL-3.0 License. SeeLICENSEfor more information.ContactCreated by ESA'sAdvanced Concepts TeamPablo Gómez -pablo.gomez at esa.intProject Link:https://github.com/esa/nidn