Quickstart

A tutorial for getting started with axtools.

In this tutorial, you will:

  • Create your own planetary system

  • Load and dump the system data to file

  • View your system in action

Template Files

Template files are written in JSON format. You will need to specify a name, limit, delta, and a beginning timestep (0). axtools uses template files to hold the structure of a system until it's computed. They're essentially starter values that axinite will later use to load the system.

Here's an example template file:

{
    "name": "example-system",
    "limit": "365d",
    "delta": "1hr",
    "t": 0,
    "rate": 60,
    "bodies": [
        {
            "name": "Earth",
            "mass": 5.972e24,
            "radius": 6.371e6,
            "r": {"x": 0, "y": 0, "z": 0},
            "v": {"x": 0, "y": 0, "z": 0}
        },
        {
            "name": "Moon",
            "mass": 7.342e22,
            "radius": 1.737e6,
            "r": {"x": 3.844e8, "y": 0, "z": 0},
            "v": {"x": 0, "y": 1.022e3, "z": 0}
        }
    ]
}

For any time value like limit, delta, or t, you can use the suffixes min, hr, d, and yr.

Each body can also take a color string and a light boolean.

Write your own system and store it in "SYSTEM_NAME.tmpl.ax".

Using the axtools module

axtools comes included with:

pip install axinite

You can read the file using:

import axtinite.tools as axtools
args = axtools.read("SYSTEM_NAME.tmpl.ax")

The args object holds the data axinite needs to load the system. If your computer is high-end, you can load and show it at the same time with:

axtools.run(args, axtools.vpython_frontend(args, "run"))

Otherwise, you can preload it then display it with:

bodies = axtools.load(args, "SYSTEM_NAME.ax")
axtools.show(args, axtools.plotly_frontend(args, "show")) # If you want a static display
axtools.live(args, axtools.vpython_frontend(args, "live")) # If you want a live display

Last updated