question on linking tree subhaloID to subfindID

Jesse Han
  • 3
  • 1 Nov '23

I'm trying to obtain the list of subhalo satellites for a given halo in TNG50. The way that I've approached this problem is to load the merger tree of the halo (using its subfindID), and walk across the "NextSubhaloInFOFGroupID" parameter in the tree at fixed snapshot. However, I'm having trouble linking the "NextSubhaloInFOFGroupID" into its subfindID in order to load its properties.

For example, I've written the following simple code, based on the il.sublink.numMergers() function:

def get_all_subhalos(haloid):
    tree = il.sublink.loadTree(basePath,99,haloid,onlyMPB=False)
    rootID = tree['SubhaloID'][0]
    shID   = tree['NextSubhaloInFOFGroupID'][0]
    subfindIDs = []
    while shID != -1:
        shIndex = 0 + (shID - rootID)
        subfindIDs.append(tree['SubfindID'][shIndex])
        shID = tree['NextSubhaloInFOFGroupID'][shIndex]
    print(subfindIDs)

However, I'm getting that the "shIndex" is out of bounds for the tree. Am I perhaps reading in the tree in the wrong way?

Your help would be greatly appreciated. Thanks very much in advance!

Dylan Nelson
  • 1 Nov '23

Hi Jesse,

If you want the list of subhalos that are satellites of a given halo, at one snapshot, there isn't any need to use the merger trees.

You can directly generate the list of satellite subhalo IDs using "GroupFirstSub" and "GroupNsubs".

  • Page 1 of 1