Live, Show and Run Functions

A guide to using the live and show functions included with axtools.

In this guide, you'll learn to:

  • Test and watch simulations with the run function

  • Statically display preloaded simulations with show

  • Watch preloaded simulations in real-time with live

  • Understand the differences between run, live, and show

  • Edit template files to manipulate display output

run

The run function loads and shows a simulation at the same time.

import axinite.tools as axtools

args = axtools.read("example.tmpl.ax")
axtools.run(args, axtools.vpython_frontend(args, "run"))

show

The show function statically shows a loaded simulation. It takes the AxiniteArgs object and displays the system.

import axinite.tools as axtools 

args = axtools.read("example.ax")
axtools.show(args, axtools.plotly_frontend(args, "show"))

live

The live function shows a loaded simulation in real-time.

import axinite.tools as axtools

args = axtools.read("example.ax")
axtools.live(args, axtools.vpython_frontend(args, "live"))

live vs show vs run

Both the live and show functions display loaded simulation files. The run function is generally slower, however, because it computes and shows the simulation simultaneously. Using run is great for quick testing to see if you got the simulation parameters right. live is fun to use for experimenting and playing around, but for scientific purposes, use show.

Manipulating the Display

There are 3 attributes that can be added to simulation files that affect the output display:

  • "radius_multiplier": Global radius multiplier for all bodies in the system.

  • "rate": The rate at which the simulation is presented (frame every 1/rate a second).

  • "retain": How many points on the trails should be rendered by default.

In addition, you can specify 4 body attributes:

  • "light": Whether a light should be placed at the position of the body.

  • "color": The color of the body.

  • "radius_multiplier": The multiplier on the radius (in addition to the global one.

  • "retain": How many points on the trail the body should retain.

Last updated