Using '' to extract non-Illustris hdf5

Alexandres Lazar
  • 2
  • 30 Jun '17


I am trying to see if is usable for other simulation snapshot files that used gadget.

I download a sample data link from with the data file called "snapshot_028_z000p000" that used gadget eagle.

I began by renaming the hdf5 files to snap_028.N.hdf5 where N is the different broken up files. Then I tried to load the files by forming a base path:

import h5py
import illustris_python as il
import numpy as np

fname = '/users/alexandres/file/snapshot_028/' # This is the filepath the leads to the folder that has all the hdf5 files

fields = ['Masses']
dm_mass = il.snapshot.loadSubset(fname,28,"dm", fields=fields);

This returns the error:

Traceback (most recent call last):
  File "/Users/alexandres/Thesis/Scripts/", line 56, in <module>
    dm_mass = il.snapshot.loadSubset(fname,28,"dm", fields=fields);
  File "/Users/alexandres/Thesis/Scripts/illustris_python/", line 45, in loadSubset
    with h5py.File(snapPath(basePath,snapNum),'r') as f:
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_hl/", line 272, in __init__
    fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_hl/", line 92, in make_fid
    fid =, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2687)
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2645)
  File "h5py/h5f.pyx", line 76, in (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/h5f.c:1933)
IOError: Unable to open file (Unable to open file: name = '/users/alexandres/file/snapshot_028/snapdir_028/snap_028.0.hdf5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

From what I am reading, there is not snap directory for this, if my understanding from the IOError line is correct. Similarly, this h5py file has a different Header compared to what we find in Illustris ( For example, this has 'PartType0' instead of gas.

I know I would have to change the module provided by the example scripts to accommodate to accommodate different hdf5's, but what else would I would have to change for this to work?

Dylan Nelson
  • 3 Jul '17

Hi Alexandres,

I suspect this will work fine, the only problem is your path, should be:

fname = '/users/alexandres/file/'

Note this will work with loadSubset() but I don't think with the loadHalo() or loadSubhalo() functions, since this snapshot is not "group ordered" like Illustris.

Alexandres Lazar
  • 3 Jul '17

Thank you for the reply, Dylan.

I edited the file path you recommended where users --> alexandres --> file where the snapshot folder is located, but when I change that, I am returned with this error:

IOError: Unable to open file (Unable to open file: name = '/users/alexandres/file//snapdir_028/snap_028.0.hdf5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

Any idea why? Here is the folder where the snapshot is located:

Screen Shot 2017-07-03 at 5.16.50 PM.png

Dylan Nelson
  • 4 Jul '17

Looks like just snapdir_028 vs snapshot_028.

  • Page 1 of 1