Metadata-Version: 2.4
Name: celestial-rhapsody
Version: 0.1.1
Summary: Configurable N-body gravitational simulation: input file in, animation out.
Author-email: Jam Sadiq <jamlucky.qau@gmail.com>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/jam-sadiq/celestial-rhapsody
Project-URL: Documentation, https://jam-sadiq.github.io/celestial-rhapsody
Keywords: n-body,gravity,simulation,orbits,animation
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.22
Requires-Dist: matplotlib>=3.5
Requires-Dist: pillow>=9.0
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx>=7; extra == "docs"
Requires-Dist: furo; extra == "docs"
Dynamic: license-file

# Celestial Rhapsody

A multi-body gravitational simulation, configured entirely through an input
file. You give it initial masses, positions and velocities, and it gives you an
animation of the orbits.

![Three-body orbit](https://raw.githubusercontent.com/jam-sadiq/celestial-rhapsody/main/docs/source/_static/three_body.gif)

## Install

```bash
pip install git+https://github.com/jam-sadiq/celestial-rhapsody.git
```

or, from a copy of this folder: `pip install .`

## Quick start

```bash
nbody run examples/three_body.json        # -> examples/three_body.gif
```

A minimal input file:

```json
{
  "G": 1.0,
  "dt": 0.01,
  "final_time": 10,
  "bodies": [
    {"name": "Star",   "mass": 1.0,   "position": [0, 0], "velocity": [0, 0]},
    {"name": "Planet", "mass": 0.001, "position": [1, 0], "velocity": [0, 1]}
  ]
}
```

The original `.txt` format (`[Global]` / `[Planet]` sections) also works. See
`examples/three_body.txt`.

From Python:

```python
from celestial_rhapsody import load_system, simulate, animate

trajectory = simulate(load_system("examples/three_body.json"), method="rk4")
animate(trajectory, "three_body.gif")
```

## Documentation

Installation guide, tutorial, input format and API reference:
**https://jam-sadiq.github.io/celestial-rhapsody**

To build it locally:

```bash
pip install -e ".[docs]"
cd docs && make html      # open docs/build/html/index.html
```

## Development

```bash
pip install -e ".[test]"
pytest
```

## Authors

Jam Sadiq, in collaboration with  Valeria Monserrat Aceituno Salinas, and Aditya Swardiana

## License

BSD 3-Clause. See [LICENSE.txt](https://github.com/jam-sadiq/celestial-rhapsody/blob/main/LICENSE.txt).
