An n-body simulator
Project description
Neural Body N-Body Simulator
An n-body simulator powered by a neural network.
Neural Body is an n-body simulator currently as an alpha demonstration of substituting calculations for planetary motion with a neural network. Currently, the neural networks can predict the position of Mars or Pluto given the rest of the positions in the planetary system.
The eventual goal is to replace the physics simulator that calculates the positions of other bodies to feed the neural network completely with neural networks that take in an acceleration vector on each body along with a desired simulation time step and perform the integration necessary to calculate the displacement of the body.
Considerable time was put into training the first version of the neural network which was a simple, 2 layer, feedforward neural network with 300 nodes per layer that performed multiple-output regression on the x, y, z coordinates of the body being predicted. Input to the network was the position of every other body in the system at each time step of a previously run simulation.
Below is a Google Colab notebook that shows the output of a training run for the neural network that predicts Mars' position. Code that generated the training data and performed preprocessing is not included. Data file is also not included. The link is purely to view code, learning curves, and results.
Table of Contents
Installation
Requirements
- Compatible debian-based Linux distro. Ubuntu 20.04 Preferred.
- Python 3.8 or higher.
- PyGame 2.0.0.dev10 or higher.
- TensorFlow 2.2.0
- Pandas 1.0.5
- Numpy 1.19.0
All dependencies above except for Python 3.8 should install when
pip install
is run.
Setup
- Download
neural_body-0.1.0.tar.gz
from thedist
directory. - Navigate to local folder where download is located.
- Use
pip install neural_body
- Use the
neural_body
command to run the simulator.
Usage
This selection includes an overview of all menu buttons and functionality of the simulator.
Pause / Play
The simulation can be paused at any point.
Toggle View
The simulation view can be toggled from overhead to side view.
Adjust Speed
The simulation can be sped up or slowed down.
New Simulation
The initial state of all bodies in the system are contained in CSV files packaged with the simulator. Whichever planet is designated as the "satellite" tells the simulator which neural network to use for planetary motion prediction. This early demo can only predict the motion of Mars or Pluto given the positions of the other planets in the system. In later releases, the neural network will be updated to accommodate predicting the motion of any body.
Current Config File Options:
- mars_sim_config.csv
- pluto_sim_config.csv
Is NASA Right?
If you disagree with NASA, you can bring Pluto back as a planet.
Show Planet Key
Hovering over this option displays a color coded key of all planets in the system.
Travel to a Day
Selecting this option allows the user to rewind or fast forward the simulation by entering the day they would like to jump to. There is a heavy delay for fast forwarding as the simulator right now must inefficiently calculate every frame between the current day and the day you entered. Negative time values will be treated as reverting back to 0 day.
Documentation
To view the documentation online, go to the following URL:
Neural Body Sphinx Documentation
Documentation for the source compiled with Sphinx is included in the neural-body/0_demo-sim/docs/_build/html/
folder. You will need to download and host yourself by running python3 -m http.server --directory _build/html
Team
The AstroGators formed as a result of the "CIS4930 - Performant Python Programming" course at the University of Florida.
Team members include:
- Nathaniel Edgar
- Craig Boger
- Gary Jones
- Cory Robertson
- Andrew Sowinski
The Github repo for this initial demonstration is located at: https://github.com/nedgar76/neural-body/tree/demo-sim/0_demo-sim
License
- MIT license
- Copyright 2020 ©
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.