Code-specific loaders

Pynbody uses a number of different modules behind the scenes to take care of loading files in different formats. Unfortunately not all of these have the same capabilities; see below.

Filetype

Can load?

Partial loading?

Can save?

Array-level save?

Notes

Tipsy

Yes

Yes

Yes

Yes

Gadget

Yes

No 1

Yes

Yes

GadgetHDF

Yes

No 1

No

No

2

Ramses

Yes

No 1

No

No

3, 4

NChilada

Yes

Yes

No

No

GrafIC

Yes

Yes

No

No

5

1(1,2,3)

Currently these modules do not support the standard partial loading mechanism. However they do allow you to load only certain CPU outputs. For instance if you wish to load CPU 3 data only, in Gadget or GadgetHDF, you simply ask to load the specific file my_snapshot.003 instead of the imaginary file my_snapshot. In Ramses, you add cpus=[3] to your load command, e.g. pynbody.load('output_00080', cpus=[3]).

2

Requires the h5py python module. You can determine whether you have this by typing import h5py into python. If you don’t get an error, you have it. If you don’t have it, see here <http://www.h5py.org>

3

Ramses gas cells are loaded and converted into gas particles, one at the centre of each maximally refined cell. You can ask to generate the particles at a higher level of refinement by passing in a maxlevel argument. For example, pynbody.load('output_00080', maxlevel=10) will place gas particles at refinement level 10 or (numerically) lower.

4

Ramses loading is enormously speeded up if you enable the parallel loading facility, which splits the task of loading the multiple files and decoding the awkward format across multiple processes. To do this, you need to install the posix_ipc module which should be as simple as typing easy_install posix_ipc into your shell. See also important notes on Parallel ramses reader support.

5

These are initial conditions generated by Bertschinger’s GrafIC or Prunet et al’s MPGrafIC.

The end-user rarely needs to worry about the implementation of different loaders, as all types of simulations are loaded with pynbody.load() and the type is determined automatically.

tipsy

Implements classes and functions for handling tipsy files. You rarely need to access this module directly as it will be invoked automatically via pynbody.load.

Input:

filename: file name string

Optional Keywords:

paramfile: string specifying the parameter file to load. If not specified, the loader will look for a file *.param in the current and parent directories.

gadget

Implements classes and functions for handling gadget files; you rarely need to access this module directly as it will be invoked automatically via pynbody.load.

gadgethdf

Implementation of backend reader for GadgetHDF files by Andrew Pontzen.

The gadget array names are mapped into pynbody array mes according to the mappings given by the config.ini section [gadgethdf-name-mapping].

The gadget particle groups are mapped into pynbody families according to the mappings specified by the config.ini section [gadgethdf-type-mapping]. This can be many-to-one (many gadget particle types mapping into one pynbody family), but only datasets which are common to all gadget types will be available from pynbody.

Spanned files are supported. To load a range of files snap.0, snap.1, … snap.n, pass the filename ‘snap’. If you pass snap.0, only that particular file will be loaded.

nchilada

Implements classes and functions for handling nchilada files. You rarely need to access this module directly as it will be invoked automatically via pynbody.load.

ramses

Implements classes and functions for handling RAMSES files. AMR cells are loaded as particles. You rarely need to access this module directly as it will be invoked automatically via pynbody.load.

For a complete demo on how to use RAMSES outputs with pynbody, look at the ipython notebook demo

grafic

Support for loading grafIC files