2025-03-21 14:13:06 +01:00
2025-03-21 14:13:06 +01:00
2023-01-30 11:20:53 +01:00
2023-01-30 11:20:53 +01:00
2024-11-28 12:19:06 +01:00
2024-12-12 18:03:04 +01:00

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

  1. Instanciate a galsec object
from galaxy_ninja import Galsec

data = your_loader(path)
galsec = Galsec(data, copy=False)
  1. 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"])
Description
No description provided
Readme 96 KiB
Languages
Python 100%