Binary IO for the cosmological Tree-SPH code Gadget
Author LudwigBoess
6 Stars
Updated Last
7 Months Ago
Started In
June 2020
Documentation Build Status License Citation
Build status The MIT License DOI


This package is a subproject of GadJet.jl and provides some basic IO functionality to work with the Smoothed-Particle Hydrodynamics code Gadget by Volker Springel.

It is taylored for working with the development version of P-Gadget3, specifically OpenGadget3 developed by Klaus Dolag and contributers. Development is focused on IO for Binary Format 2. A lot of the routines are based on IDL scripts by Klaus Dolag (not public).

If you use GadgetIO.jl in your publications please cite Böss & Valenzuela.

Please see the Documentation for details.


Reading Data

If you want to read a simulation snapshot into memory with GadJet.jl, it's as easy as this:

    data = read_snap(filename)

This will return a dictionary with the header information in data["Header"] and the blocks sorted by particle type.

As an example, this is how you would access the positions of the gas particles:


If you only want to read a specific block for a single particle type (e.g. positions of gas particles) you can use the function with a specified blockname and particle type like so:

    pos = read_snap(filename, "POS", 0)

This will return an array of the datatype of your simulation, usually Float32.

Used By Packages