Python script for cutouts from the Group Catalog Search?

Karen Olsen
  • 4
  • 23 Aug '16


I'm completely new to the format of illustris snapshots. I selected a subhalo with Group Catalog Search and downloaded it as 'cutout_0.hdf5', but now I'm having trouble running the python scripts available. Is there a tutorial out there on how to read data from cutouts? Treating it as a subhalo or a snapshot as described here, does not seem to work.

For example, saving the cutout in snapdir_045/snap_045.0.hdf5 and loading with:

gas_mass = il.snapshot.loadSubset(basePath,45,'gas',fields=['Masses'])

gives me this error:

illustris_python/ in getNumPart(header)
nPart = np.zeros( nTypes, dtype=np.int64 )
for j in range(nTypes):
nPart[j] = header['NumPart_Total'][j] | (header['NumPart_Total_HighWord'][j] << 32)

return nPart

KeyError: 'NumPart_Total'

UPDATE: Problem kind of solved. I wrote my own python code to read in the data from the hdf5 file, checking units with the Nelson+15 paper. But where is gas temperature? Is it possible to convert from internal energy (given in (km/s)^2 per unit mass) to temperature?

Thanks, Karen

Dylan Nelson
  • 8 Sep '16

Hi Karen,

As you say, for a cutout, easiest to just load directly with h5py as:

cutout = h5py.File('snapdir_045/cutout_0.hdf5','r')
gas_mass = cutout['PartType0']['Masses'][()]

As for gas temperature, this rather annoying calculation is described in the FAQ page.


  • Page 1 of 1