Hot to obtain Subhalo ID from group catalog and offsets
Sophia Nasr
9 May '19
Hello,
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?
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 '19
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 '19
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
#!/u/dnelson/.local/envs/dylan3/bin/python
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.
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!!
Hello,
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?
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!
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!
Hi Sophia,
There are
4371211
subhalos for TNG100-1 at z=0, I'm not sure what the other number refers to? EverySubhalo*
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:
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.Note that this is a satellite, not a central, subhalo.
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!!