Hot to obtain Subhalo ID from group catalog and offsets

Sophia Nasr
  • 9 May


I was wondering how I could find the subhalo ID for a specific subhalo using either the group catalog files, or the offset files? In the documentation it looks like there are IDs for only the most massive halos, but not the subhalos, unless I missed it. So I thought since the offsets are the files that contain subhalo ID information, I thought doing il.groupcat.LoadSingle() would be what I'd want to do, however to use that I already need to know the subhalo ID I want. (I am using the scripts downloaded from the repository, by the way)

Basically my aim using the halo catalog files is to find subhalos that match specific requirements (for example, subhalos within certain distances of each other and having a specific mass), and once I find ones that do match these requirements, I want their subhalo ID so that I can use that to download those specific cutouts from the snapshot. I thought this would be listed in the halo catalog subfind subhalos, but I am not seeing the relevant field; there is one that tells me which parent halo the subhalo belongs to, but that's not what I want. Can someone clarify how I'm to find the subhalo ID in either the group catalog or the offsets?

Sophia Nasr

Allow me to rephrase my question: There are 4371211 subhalo cutouts in the snapshot I'm looking at via its group catalog. But there are 4731664 items in each subhalo field. Then, the item number =! subhalo ID for the cutout I require, so my question is, how do I get the subhalo ID I need? I did try to load the offset field 'Subhalo/Sublink/SubhaloID', but it wouldn't open, says it cannot find the field (using the same method I used to try to open that field, I was able to access the field 'FileOffsets/Subhalo', so I'm not sure if the subhalo ID field just didn't download/doesn't exist?), so any help would be great. Thank you!

Sophia Nasr
  • 10 May

Hello, just wondering if anyone has seen this yet that can help? I'm sure it's something small I'm missing, but I've not found the solution nevertheless, which makes it a big hurdle in my research. I don't know many people who work on Illustris (TNG specifically) and I'm the only one in my research group working on these, so I am a bit confined in who I can ask questions once I've tried things that should work in theory, but don't. Thanks again!

Dylan Nelson
  • 11 May

Hi Sophia,

There are 4371211 subhalos for TNG100-1 at z=0, I'm not sure what the other number refers to? Every Subhalo* field has this same shape.

The most important thing is that "subhalo ID" is the same as "subhalo index", i.e. the number, from 0 to 4371210, which indexes these arrays. For instance, to search on stellar mass:

In [1]: import illustris_python as il

In [2]: basePath = 'sims.TNG/L75n1820TNG/output/'

In [3]: mstar_log_msun = np.log10(il.groupcat.loadSubhalos(basePath,99,fields=['SubhaloMassType'])[:,4] * 1e10 / 0.66
   ...: 74)
/u/dnelson/.local/bin/ipython:1: RuntimeWarning: divide by zero encountered in log10

In [4]: mstar_log_msun.shape
Out[4]: (4371211,)

In [5]: np.nanmax(mstar_log_msun)
Out[5]: 12.575315

In [6]: np.nanmin(mstar_log_msun)
Out[6]: -inf

In [7]: subhalo_ids = np.where( (mstar_log_msun>10.4) & (mstar_log_msun<10.6) )

In [8]: subhalo_ids[0].shape
Out[8]: (1245,)

In [9]: subhalo_ids[0][0:10]
Out[9]: array([24, 28, 29, 36, 39, 40, 43, 46, 47, 49])

The first "subhalo ID" satisfying this mass search is 24. This can be used to download a cutout. Or to load its full information e.g.

In [10]: sub = il.groupcat.loadSingle(basePath,99,subhaloID=24)

In [11]: sub
{'SubhaloBHMass': 0.008128543,
 'SubhaloBHMdot': 0.0010499045,
 'SubhaloBfldDisk': 8.475275,
 'SubhaloBfldHalo': 1.0999386,
 'SubhaloCM': array([  585.44226, 24719.033  , 17184.287  ], dtype=float32),
 'SubhaloFlag': True,
 'SubhaloGasMetalFractions': array([7.2396249e-01, 2.5638935e-01, 2.1427695e-03, 6.6202728e-04,
        9.8527502e-03, 3.3893082e-03, 9.6256199e-04, 8.6484879e-04,
        1.1815714e-03, 5.9233262e-04], dtype=float32),
 'SubhaloGasMetalFractionsHalfRad': array([0.7152401 , 0.2589319 , 0.00287304, 0.00088761, 0.01280903,
        0.00445932, 0.00125958, 0.00113162, 0.00161627, 0.0007915 ],
 'SubhaloGasMetalFractionsMaxRad': array([7.1945930e-01, 2.5777426e-01, 2.5143821e-03, 7.7669526e-04,
        1.1333603e-02, 3.9271889e-03, 1.1117813e-03, 9.9992589e-04,
        1.4078962e-03, 6.9494679e-04], dtype=float32),
 'SubhaloGasMetalFractionsSfr': array([7.3006213e-01, 2.5418824e-01, 1.6852522e-03, 5.1873364e-04,
        7.9855705e-03, 2.7185911e-03, 7.7548850e-04, 6.9448986e-04,
        9.0618804e-04, 4.6530817e-04], dtype=float32),
 'SubhaloGasMetalFractionsSfrWeighted': array([7.2644997e-01, 2.5528347e-01, 1.9773163e-03, 6.0540269e-04,
        9.2137242e-03, 3.1606012e-03, 8.9880824e-04, 8.0192555e-04,
        1.0675460e-03, 5.4124580e-04], dtype=float32),
 'SubhaloGasMetallicity': 0.01964817,
 'SubhaloGasMetallicityHalfRad': 0.025827957,
 'SubhaloGasMetallicityMaxRad': 0.02276642,
 'SubhaloGasMetallicitySfr': 0.015749622,
 'SubhaloGasMetallicitySfrWeighted': 0.01826657,
 'SubhaloGrNr': 0,
 'SubhaloHalfmassRad': 28.76091,
 'SubhaloHalfmassRadType': array([19.807215, 32.64307 ,  0.      ,  0.      ,  2.484108,  0.      ],
 'SubhaloIDMostbound': 122526499375,
 'SubhaloLen': 133045,
 'SubhaloLenType': array([34984, 68536,     0,     0, 29524,     1], dtype=int32),
 'SubhaloMass': 40.53191,
 'SubhaloMassInHalfRad': 2.1214354,
 'SubhaloMassInHalfRadType': array([0.09697636, 1.0328883 , 0.        , 0.        , 0.9834423 ,
        0.00812854], dtype=float32),
 'SubhaloMassInMaxRad': 3.0897603,
 'SubhaloMassInMaxRadType': array([0.1725032 , 1.6481723 , 0.        , 0.        , 1.2609563 ,
        0.00812854], dtype=float32),
 'SubhaloMassInRad': 4.329911,
 'SubhaloMassInRadType': array([0.3218091 , 2.4934924 , 0.        , 0.        , 1.5064813 ,
        0.00812854], dtype=float32),
 'SubhaloMassType': array([3.9068375e+00, 3.4650040e+01, 0.0000000e+00, 0.0000000e+00,
        1.9669050e+00, 8.1285434e-03], dtype=float32),
 'SubhaloParent': 1,
 'SubhaloPos': array([  582.1424, 24719.973 , 17184.432 ], dtype=float32),
 'SubhaloSFR': 3.5962365,
 'SubhaloSFRinHalfRad': 0.9958085,
 'SubhaloSFRinMaxRad': 1.4145631,
 'SubhaloSFRinRad': 2.038714,
 'SubhaloSpin': array([-360.2236  ,   46.575974, -484.9286  ], dtype=float32),
 'SubhaloStarMetalFractions': array([7.23485589e-01, 2.52191603e-01, 2.57599796e-03, 7.74417887e-04,
        1.25766415e-02, 4.20991005e-03, 1.21306337e-03, 1.06269389e-03,
        1.23839290e-03, 6.71708316e-04], dtype=float32),
 'SubhaloStarMetalFractionsHalfRad': array([0.7176426 , 0.25330436, 0.00311173, 0.00093203, 0.01495007,
        0.00503645, 0.00144689, 0.00126514, 0.00150481, 0.0008059 ],
 'SubhaloStarMetalFractionsMaxRad': array([0.72080773, 0.25267342, 0.00282351, 0.00084719, 0.01368212,
        0.00459334, 0.00132177, 0.00115677, 0.00136049, 0.00073367],
 'SubhaloStarMetallicity': 0.024322826,
 'SubhaloStarMetallicityHalfRad': 0.029053012,
 'SubhaloStarMetallicityMaxRad': 0.026518859,
 'SubhaloStellarPhotometrics': array([-20.840212, -20.65798 , -21.084932, -23.585106, -20.943235,
        -21.293907, -21.516504, -21.700047], dtype=float32),
 'SubhaloStellarPhotometricsMassInRad': 1.716366,
 'SubhaloStellarPhotometricsRad': 5.639388,
 'SubhaloVel': array([-640.4456 ,  649.0894 ,  355.42957], dtype=float32),
 'SubhaloVelDisp': 100.41863,
 'SubhaloVmax': 194.34198,
 'SubhaloVmaxRad': 3.5192401,
 'SubhaloWindMass': 0.0}

Note that this is a satellite, not a central, subhalo.

Sophia Nasr
  • 1
  • 13 May

Hi Dylan,

I now understand what I was doing wrong. I forgot to change the redshift at which I was looking, which of course leads to errors because by today, many mergers have happened! But also, your example script is very helpful for how I can look at the properties of the subhalo I want to look at, thank you very much!!

  • Page 1 of 1