Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
Feb 28, 2018
Mar 4, 2018
Mar 2, 2018

Scatter Net     
  (\   /)         
  - -O- -         
  (/   \)         

Scatter Net

An example repository of using machine learning to solve a physics problem. Based on the work presented in, Nanophotonic Particle Simulation and Inverse Design Using Artificial Neural Networks ( This repository is specifically designed for solving inverse design problems, particularly surrounding photonics and optics.

Geting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. This example will also generate Table I in the paper, and Figure 2,3, and 4.


To run the Matlab code, Matlab will need to be installed. For this code, we used Matlab R2017a. Note that the project can be done without Matlab, but comparisons of speed and data generation cannot be done unless Matlab is installed.

This codebase is based on Python 2.7, and the pip packages used are shown in the requirements.txt file. To run this on AWS, use AMI ami-52bb0c32, and a p2.xlarge instance.


  1. Copy the github repo to your computer, and install the pip requirements.
git clone
cd ScatterNet
pip install -r requirements.txt
  1. Option 1: Fetch the data
cd data
  1. Option 2: View and Generate the data
  1. Option 1: Fetch the models
cd results
  1. Option 2: Train the models (Table I)
  1. Compare spetrums (Figure 2)
  1. Perform Inverse Design (Figure 3)
  1. Perform Optimization (Figure 4)


ScatteringNet_Matlab: This is the matlab code repository, intended to be run on a cluster or a high performance computer. Depends on matlab.

ScatteringNet_Tensorflow: This is the tensorflow/python repository, intended to be run on a computer with a GPU and tensorflow capabilities.


  1. scatter_0_generate_spectrum
    Pick the settings for your data in the scatter_0_generate_spectrum.
  2. scatter_1_plot_sample
    Run the scatter_1_plot_sample to get an idea of what the data looks like. Make sure the data set is hollistics enough/has interesting features within it. Save these graphs, so you have an idea of what the data looks like. is your friend. Use the script to pull the data locally from the server.
  3. scatter_2_generate_train
    Once you have that, run the scatter_2_generate_train on a cluster I recommend first changing the settings, then pushing it to the server.
  4. scatter_net_1_train
    Once you have the data, run the scatter_net_1_train to train the neural network on a GPU. Graph the loss.
  5. scatter_net_2_compareSpects
    Once you have the trained neural network, run the to sample some spects and see what they are. Run to see what these spectrums look like.
  6. scatter_3_generate_single_test
    Pick a spectrum, generate the data, move it over to the other repository.
  7. scatter_net_3_matchSpect
    See how it matches the spectrum.
  8. scatter_4_graph_geometry
    See how it did
    Pick an optimal figure of merit, and then run this.
  10. scatter_5_graph_desired
    Graph the desired on top.



This project is licensed under the MIT License - see the file for details


  • Hat tip to anyone who's code was used
  • Inspiration
  • etc

Scatter Net     
  (\   /)         
  - -O- -         
  (/   \)         

MIT Department of Physics. All rights reserved. Version 1.0 - 06/10/2017 Produced and used by John Peurifoy. Assistance and guidance provided by: Li Jing, Yichen Shen, and Yi Yang. Updates and code fixes provided by Samuel Kim. A product of a collaboration between Max Tegmark's and Marin Soljacic's group. Originally created 04/24/2017


Code for all work presented in Nanophotonic Particle Simulation and Inverse Design Using Artificial Neural Networks




No releases published


No packages published