Command line

Installing the package adds the command nbody. python -m celestial_rhapsody does the same thing.

nbody run

Simulate a system and save an animation.

nbody run INPUT [-o OUTPUT] [--method {euler,rk2,rk4}] [--every N]
                [--fps N] [--trail N] [--dt X] [--final-time T]

Option

Description

INPUT

Input file, .json or .txt (see Input format)

-o, --output

Output file, .gif or .mp4. Default: input name with .gif

--method

Integrator: rk4 (default), rk2 or euler

--every N

Keep one frame every N steps (default 2). Higher gives a smaller file

--fps N

Frames per second (default 30)

--trail N

Trail length in frames. Default is the full path; 0 gives none

--dt X

Override dt from the file

--final-time T

Override final_time from the file

Examples:

nbody run system.json                          # -> system.gif
nbody run system.json -o movie.mp4 --fps 60    # needs ffmpeg
nbody run system.json --final-time 1 --every 1 # quick preview
nbody run system.json --trail 40               # short comet-like trails

nbody check

Validate an input file and print a one-line summary, without simulating.

nbody check system.json

Exit codes

The command exits with 0 on success and 1 on any error (missing file, invalid input, unsupported output). This makes it easy to use in shell scripts.