Subhalo IDs

Noah Katz
  • 6 Jul

Hello.
I was using snapshot 99 of TNG-100-2-Dark, and I encountered a problem. I could read the subhalo group catalogs without any problems. Next, I have assumed that the subhalo IDs matched the index of this subhalo catalog. Is this correct? Assuming that this is true, I tried to use this Subhalo ID to read out all the particles from the snapshot file for the specified subhalo using the following line of code:

halo = il.snapshot.loadSubhalo(basePath, 99, SubhaloID, 'dm')

However, when I ran the program, for some subhalos IDs above a certain value, I got an "index out of range" error.

Thank you for your attention,

-Noah Katz

Dylan Nelson
  • 7 Jul

Hello Noah,

The snapshot 99 of TNG100-2-Dark has "num_groups_subfind" of 757923, so this is the total number of subhalos.

What "Subhalo ID" or "subhalo IDs" do you refer to (where are they from)?

Noah Katz
  • 7 Jul

We refer to this command: halo = il.snapshot.loadSubhalo(basePath, 99, SubhaloID, 'dm')

It has the SubhaloID which inputs the parameter.

How do we find this parameter?

We assumed so far that this parameter is the index value which comes from the subhalo catalog

But I am not sure this is the correct way to identify subhaloID. And this is what I am asking.

Many thanks
Noah Katz

Dylan Nelson
  • 8 Jul

Hi Noah,

Yes the third parameter input to loadSubhalo() is what we call the "subhalo ID" or "subhalo index", these are interchangeable names. You can choose any value you want, from 0 to 757922 in this case, to load the corresponding subhalo particles.

I think by "index value which comes from the subhalo catalog" you mean, e.g.

basePath = './TNG100-2-Dark/output/'
fields = ['SubhaloMass']
subhalos = il.groupcat.loadSubhalos(basePath,99,fields=fields)

w = np.where(subhalos['SubhaloMass'] >= 100.0)[0]
subhaloID_first = w[0]

particle_data = loadSubhalo(basePath, 99, subhaloID_first, 'dm')

this is correct. Are you doing something similar? Perhaps you can post a code snippet then with the error message.

Noah Katz
  • 8 Jul

This is the error:

Traceback (most recent call last):
File "a", line 87, in
halo = il.snapshot.loadSubhalo(basePath, 99, (real_goodNums[x]), 'dm')
File "/home/noah/Research/illustris_python/snapshot.py", line 194, in loadSubhalo
subset = getSnapOffsets(basePath, snapNum, id, "Subhalo")
File "/home/noah/Research/illustris_python/snapshot.py", line 182, in getSnapOffsets
r['offsetType'] = f[type+'/SnapByType'][id, :]
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "/home/noah/anaconda3/lib/python3.7/site-packages/h5py/_hl/dataset.py", line 553, in getitem
selection = sel.select(self.shape, args, dsid=self.id)
File "/home/noah/anaconda3/lib/python3.7/site-packages/h5py/_hl/selections.py", line 94, in select
sel[args]
File "/home/noah/anaconda3/lib/python3.7/site-packages/h5py/_hl/selections.py", line 261, in getitem
start, count, step, scalar = _handle_simple(self.shape,args)
File "/home/noah/anaconda3/lib/python3.7/site-packages/h5py/_hl/selections.py", line 457, in _handle_simple
x,y,z = _translate_int(int(arg), length)
File "/home/noah/anaconda3/lib/python3.7/site-packages/h5py/_hl/selections.py", line 477, in _translate_int
raise ValueError("Index (%s) out of range (0-%s)" % (exp, length-1))
ValueError: Index (118820) out of range (0-118819)

real_goodNums is the array that contains all of the subhalo IDs I'm using. The reason there it says real_goodNums[x] is because I was using a for loop that used the variable x to read all of them.

Dylan Nelson
  • 8 Jul

Hi Noah,

I guess the question is, what is real_goodNums (where did it come from?)

Noah Katz
  • 8 Jul

It's the same as SubhaloID. It's an array of all of the indexes of the subhalos I'm using as listed in the group catalog.

Dylan Nelson
  • 8 Jul

Hi Noah,

The problem looks just like basePath got mixed up. You are trying to load from TNG100-3 instead of TNG100-2-Dark.

Noah Katz
  • 11 Jul

I tried redownloading the data, but when I did, it gave me ERROR 403: Forbidden. What should I do?

Thanks,
Noah

Noah Katz
  • 11 Jul

I tried redownloading the data, but when I did, it gave me ERROR 403: Forbidden. What should I do?

Thanks,

Noah

  • Page 1 of 1