1.9 KiB
1.9 KiB
Galaxy Ninja
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:
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
- Instanciate a galsec object
from galaxy_ninja import Galsec
data = your_loader(path)
galsec = Galsec(data, copy=False)
- Choose your binning method. Pre-set binning methods includes radial rings, sectors and cartesian binning.
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:
import matplotlib.pyplot as plt
plt.plot(rings["gas"]["r"], sectors["gas"]["velphi"])