IPython Notebook & Astrophysical Simulations02 Dec 2014
I recently gave a tutorial on aspects of the IPython Notebook at work. As we are dealing with various astrophysical simulation codes, the session was geared to loading and processing their output formats. The notebooks along with a descriptions of what we get from the codes are linked here.
- Genga: Loading Text & HDF5 Files, Simple Plots
- Pymses: Loading Ramses AMR Data, 2D, 3D Plots
- Pynbody: Loading Pkdgrav2 Particle Data
Genga: Loading Text & HDF5 Files, Simple Plots
We use Genga to follow the evolution of planetary systems. The code can deal with at most 2048 massive bodies, which is small enough to get away with text outputs. In post-processing, we generate a much larger set of data from the outputs (Keplerian elements and precomputed orbital ellipses), such that text files become impractical. We instead use the hierarchical, self-describing HDF5 format. The IPython Notebook shows how to open text and HDF5 files as well as introduce basic plotting commands.
Pymses: Loading Ramses AMR Data, 2D, 3D Plots
Ramses is a massively parallel multi-purpose astrophysical simulation code. We use it to perform comsological simulations, star and galaxy formation, as well as accretion disk physics. Owing to its complexity, Ramses has a complicated output format based on Fortran binary files. In this notebook, we show how to load basic Ramses hydrodynamics data into Python using Pymses. Note that the rabbit hole is very deep, and we’re only scratching the surface here.
Pynbody: Loading Pkdgrav2 Particle Data
Pkdgrav2 is an extremely efficient, massively parallel, dark matter simulation code. The code can tackle simulations with billions of particles, which are difficult to store, read, and post-process in a timely fashion. Here, Pynbody is a reader of choice. It loads particle data on the fly, so that only the particles in regions of interest have to be read from the disk. Again, we’re only scratching the surface of what Pynbody and Pkdgrav2 can do, and refer to the official documentation for more depth.