getting started in Readme.md

This commit is contained in:
2024-12-12 18:03:04 +01:00
parent f2e6929abb
commit ea02323e93

View File

@@ -1,3 +1,90 @@
# Galaxy Ninja
A useful binning and computation tool for numerical simulations
A efficient binning and computation tool for numerical simulations
Galaxy ninja uses `numba` for fast processing of huge simulation dataset.
## Download
The easiest way to get Galaxy Ninja is to clone this repository
```
git clone https://git.brucy.fr/noe/galaxy_ninja.git
```
## Install
Assuming `pip` is available on your system, just run
``` pip install . ```
in the downloaded folder.
## Getting started
### Load data
The first step is to write a loader for your simulation dataset.
A loader is a python function that for a given simulation snapshot returns a dictionnary with the following structure:
```python
gas:
position (Ngas, 3) [kpc], centered
volume (Ngas) [pc^3]
velocity (Ngas, 3) [km/s]
mass (Ngas) [Msun]
stars:
position (Nstar, 3) [kpc], centered
velocity (Nstar, 3) [km/s]
mass (Nstar) [Msun]
birth_time (Nstar) [Myr]
dm:
position (Ngas, 3) [kpc], centered
velocity (Ngas, 3) [km/s]
mass (Ngas) [Msun]
maps:
extent (xmin, xmax, ymin, ymax) Coordinates of the edges of the map, centered
gas_coldens (Nx, Ny) [Msun/pc^2], map of column densityructure:
```
Example loaders for Ramses and Arepo are provided.
### Compute binned quantities
1. Instanciate a galsec object
```python
from galaxy_ninja import Galsec
data = your_loader(path)
galsec = Galsec(data, copy=False)
```
2. Choose your binning method.
Pre-set binning methods includes radial rings, sectors and cartesian binning.
```python
rings = galex.rings_analysis(
delta_r=0.1 * u.kpc,
rmax=30 * u.kpc,
zmin=-4 * u.kpc,
zmax=4 * u.kpc,
)
```
### Access averaged binned quantities
Example for a velocity curve:
```python
import matplotlib.pyplot as plt
plt.plot(rings["gas"]["r"], sectors["gas"]["velphi"])
```