CosmoToolbox is a C++ library which I have implemented for solving specific programming problems that I met while doing my research in cosmology. It is a random set of codes that I have abstracted to be reusable in a number of situations.

The following code are implemented:

  • loading snapshot files from Ramses and Gadget 1 & 2 snapshots
  • reading and writing unformatted fortran binary file
  • building and walking through KD-Trees (simple and leaf)
  • a general 1d interpolation
  • a tri-linear 3d interpolator
  • interpolating on a Delaunay tesselation
  • adaptive smoothing (Colombi, Chodorowski & Teyssier 2007, ArXiV)
  • Compute the linear growth factor for different cosmologies
  • A wrap-up around NetCDF to quickly dump large arrays and load them in Yorick (
  • a general purpose queue handler, for which the queue may only achieve a maximum length (this is useful for implementing KD-Tree)

Here is a list of the currenly available classes and/or modules (when available a link to the documentation page is included):

  • KDTree
  • Simulation loading
  • Interpolate
  • Interpolate3D
  • Cosmology (power spectrum, growth factor)
  • Adaptive smoothing
  • Yorick I/O
  • easy HDF5 array I/O
  • python bindings to read/write simulation snapshots, cosmology power spectrum, etc.

Building instructions

CosmoToolbox uses CMake for the building machinery.

Getting cosmotool

CosmoTool is in continuous development. It is available in the bitbucket repository .

(C) Guilhem Lavaux, 2014 - 2017,
Last updated: November 05, 2017