Retrieving DMO subhalo parent

Alexandres Lazar
  • 3
  • 26 Dec '16

I'm having a bit of trouble in taking steps for retrieving the Parent halo through this iteration.

First, I retrieve the particle data with my self defined base paths. It all works

halofields = ['GroupVel','Group_M_Crit200','Group_M_Crit500','Group_R_Crit200','GroupNsubs',
          'GroupMass','Group_M_TopHat200', 'Group_R_TopHat200','GroupPos','GroupFirstSub']
halos = il.groupcat.loadHalos(basePath1,135,fields=halofields)

subfields = ['SubhaloMass','SubhaloSpin','SubhaloParent','SubhaloVelDisp','SubhaloVel',\
         'SubhaloVmax','SubhaloGrNr','SubhaloPos','SubhaloVmax', 'SubhaloParent']
sub = il.groupcat.loadSubhalos(basePath1,135,fields=subfields)


## Dark Matter Only fields
halofieldsDM = ['GroupVel','Group_M_Crit200','Group_M_Crit500','Group_R_Crit200','GroupNsubs',\
           'GroupMass','Group_M_TopHat200', 'Group_R_TopHat200','GroupPos','GroupFirstSub']
halosDM = il.groupcat.loadHalos(basePath1DM,135,fields=halofieldsDM)


subfieldsDM = ['SubhaloMass','SubhaloSpin','SubhaloParent','SubhaloVelDisp','SubhaloVel',\
         'SubhaloVmax','SubhaloGrNr','SubhaloPos','SubhaloVmax', 'SubhaloParent']
subDM = il.groupcat.loadSubhalos(basePath1DM,135,fields=subfieldsDM)


# h5py module command to open Dark matter matching indexing
f = h5py.File('/users/alexandres/Illustris/Illustris_1_Matching/subhalo_matching_to_dark.hdf5','r')
DarkInd = f['Snap_135_SubhaloIndexDark'][()]
f.close

I then export the halo indexes for the mass range I want to analyze. I do this for both the Hydrodynamical and DMO runs.

Mmin = 8e+11
Mmax = 2.4e+12
h0  = 0.704

mask = (
        ( halos['Group_M_TopHat200'] > Mmin*h0/1e+10 ) & ( halos['Group_M_TopHat200'] < Mmax*h0/1e+10  )
        ).nonzero()[0]
maskDM = (
        ( halosDM['Group_M_TopHat200'] > Mmin*h0/1e+10 ) & ( halosDM['Group_M_TopHat200'] < Mmax*h0/1e+10  )
        ).nonzero()[0]

There were some values that appeared wrong when doing further analysis. So I just indexed those out.

remove_indices = [261,389,409, 525, 592, 695, 739, 831, 882, 1211]
mask = [i for j, i in enumerate(mask) if j not in remove_indices]

I then use the dark matter to match file

# The indexing of the these MW halos most massive subhalo (Which is the Host)
firstSub = halos['GroupFirstSub'][mask]
firstSub = firstSub.astype('int32')
# The indexing of the halos 'true' subhalo
secondSub = firstSub+1

# From the indexing into the Hydrodynamical simulation, the dark matter matching module
# is then used to corresping to the 'most massive' subhalos
firstSubD = DarkInd[ firstSub ]
# This is just to remove the elements that have the values of zero
# Values with 0 means their is no corresponding DM ran subhalo to match the Hydro simulatiom
w1 = np.where(firstSubD >= 0 )

firstSubD = firstSubD[w1]
secondSubD = firstSubD + 1

So then now, I retrieve the mass values for the hydro run easily by using the mask variable defined above

MW_Mass =  np.float32(mask) * 1e+10/h0
sHost_Mass =  sub['SubhaloMass'][firstSub] * 1e+10/h0
sat_Mass =  sub['SubhaloMass'][secondSub] * 1e+10/h0

But if I wanted to retrieve the halo mass for the dark halo fields using SubhaloParent field, this is were i'm running into some problems.

sHost_MassD = subDM['SubhaloMass'][firstSubD] * 1e+10/h0
sat_MassD = subDM['SubhaloMass'][secondSubD]  * 1e+10/h0

DarkParent = subDM['SubhaloParent']
ParentHostD = DarkParent.astype('int32')
ParentDark = DarkParent[firstSubD]
MW_MassD = halosDM['Group_M_Crit200'][DarkParent]

>>> [ 19555.98046875  19555.98046875  19555.98046875 ...,  19555.98046875
  19555.98046875  19555.98046875]

This returns the same values over and over again. Anyway to fix this?

Apologize as well for making this post an Announcement instead of a question.

Dylan Nelson
  • 8 Jan '17

Hi Alexandres,

I think you maybe want to use SubhaloGrNr instead of SubhaloParent. The former gives a group/fof index, while the later gives a subhalo/subfind index. And, note that in Illustris in almost every case SubhaloParent of a satellite points to its central, while SubhaloParent of a central points to itself. The purpose of this field is to encode the hierarchical result of Subfind (e.g. subhalos of subhalos of subhalos) which is rare in Illustris.

More typically, we use SubhaloGrNr to get the SO quantities like Group_M_Crit200 like

halos = il.groupcat.loadHalos(basePath1,135,fields=halofields)
sub = il.groupcat.loadSubhalos(basePath1,135,fields=subfields)

sub_ind = 1234
parent_halo_ind = sub['SubhaloGrNr'][sub_ind]
parent_halo_m200 = halos['Group_M_Crit200'][parent_halo_ind]
Alexandres Lazar
  • 16 Jan '17

Thank you, Dylan!

  • Page 1 of 1