Accessing 'Subhalo Matching To Dark'

Alexandres Lazar
  • 19 Sep '16

Downloading the 'Subhalo Matching To Dark' and creating a base path for that file, how do you access the catalog? If you use, then what do you define the snapshot number to be?

Dylan Nelson
  • 20 Sep '16

Hi Alexandres,

The supplementary catalogs can't (aren't by default) loaded with the provided scripts, but just manually, e.g.

f = h5py.File('subhalo_matching_to_dark.hdf5','r')
dark_inds = f['Snap_135_SubhaloIndexDark'][()]
Alexandres Lazar
  • 2
  • 20 Sep '16

Once again, I appreciate it, Dylan.

One quicky, for the indexing, what is wrong with the way I have it in this example?

FirstSub = (halos['GroupFirstSub'])
FirstSubD = (halos['GroupFirstSub'])[dark_inds]

h0 = 0.704 

sub_positions = (sub['SubhaloPos']/h0)[FirstSub]
dsub_positions = (sub['SubhaloPos']/h0)[FirstSubD]

This returns an index error

Dylan Nelson
  • 20 Sep '16

Actually probably exactly what we just discussed here:

so you need to filter out those halos without any subhalos (equivalently any reasonable minimum mass cut would do the trick), e.g.

halos['GroupFirstSub'] = halos['GroupFirstSub'].astype('int32')
w = np.where(halos['GroupFirstSub'] >= 0)
FirstSub = halos['GroupFirstSub'][w]
FirstSubD = dark_inds[ FirstSub ]

note also I have flipped the last line, following the description of this matching catalog: "array of integer indices, with a length equal to the number of subhalos in the full physics run. Each value in the array gives the corresponding index of the matched subhalo in the DM only run."

Alexandres Lazar
  • 20 Sep '16

And then with FirstSubD, I can apply to field of my choosing to extract those values, ie

Positions = sub['SubhaloPos'][ FirstSubD ]

Velocities = sub['SubhaloVel'][ FirstSubD ]


One final question that could raise future issues. How do you deal with values that return -1?

Dylan Nelson
  • 20 Sep '16

Yes but be careful since those are 3D fields, e.g.

Positions_Z = sub['SubhaloPos'][FirstSubD,2]
Positions = sub['SubhaloPos'][FirstSubD,:]

assuming they are shape (N,3), or flipped if (3,N), I forget which.

For values that return -1, do you mean particularly in this case? E.g., halos with no first subhalo? If you are particularly interested in low-mass halos and need the matching, you could do a matching on FoFs instead of on Subfind, but you would have to do this yourself, we don't have anything. But, these are mostly FoF halos near the minimum particle limit of 32, meaning they are really not resolved and their properties are not robust. It would make more sense to consider only FoF halos with at least >=100 particles, say.

Alexandres Lazar
  • 20 Sep '16

So I would be completely fine to still use indices of -1? Or could I just remove the indices of -1 for the particular case of indexing with Subhalo match to dark with values of the hydrodynamical run?

Dylan Nelson
  • 20 Sep '16

You must remove them, which I did above with w = np.where(halos['GroupFirstSub'] >= 0) and then using only the subset defined by w from then on.

  • Page 1 of 1