Inconsistencies between particle/halo coordinates?
Christopher Marsden
12 Mar '21
Hi. If I compare subhalo particle coordinates with subhalo catalog coordinates e.g.:
subhalo_id = [953771]
tree = il.sublink.loadTree(basePath, 99, subhalo_ids, fields=['SnapNum', 'SubfindID'], onlyMPB=True)
for j, snapnum in enumerate(tree['SnapNum']): # Look back through the tree
SubfindID = tree['SubfindID'][j]
catalog_data = il.groupcat.loadSingle(basePath, snapnum, subhaloID=SubfindID)
particle_data = il.snapshot.loadSubhalo(basePath, snapnum, SubfindID, 'stars', fields=['Coordinates', 'Velocities', 'Masses'])
# Now, compare the particle coordinate data and the catalog_data['SubhaloCM']
Over one axis (in this case x), I get (apologies for the poor quality of the plot):
The blue dot represents the x location of the catalog_data subhalo centre of mass. This should surely be centred on the stellar particles, or at least be much close?
Is there some difference in coordinate system that I am unaware of coming into play here?
Dylan Nelson
13 Mar '21
This should be due to the periodic boundaries, see e.g. this older thread.
This does not explain the issue here. Having corrected for the box size (coordinates modulo boxsize/2), the plot is the same:
Are you sure I am comparing the same haloes here? Could this be an instance of the halo at a different time, especially considering it is so close?
Dylan Nelson
14 Mar '21
What simulation / basePath?
Christopher Marsden
14 Mar '21
basePath = '../sims.TNG/TNG300-1/output/'
It's possible I've made a simple mistake somewhere...
Christopher Marsden
15 Mar '21
I believe I've fixed the problem here. I'm not sure what I was doing wrong, but the centre of masses seem consistent now, when plotted against the snapshot number. Full code to produce this follows. Some error checking was required as some snapshots don't seem to return the keys. I hope this can help sombody.
Thanks for the follow-up, I suspect a (snapshot) mismatch between different arrays. Whenever you're appending things onto a python list, good to be very careful about how things are kept in sync. As you point out, a given merger tree does not need to contain all snapshot number in sequential order (some could be skipped). Also, a given subhalo does not need to have any stars, so you could check the return of loadSubhalo as you do or with the count attribute.
Hi. If I compare subhalo particle coordinates with subhalo catalog coordinates e.g.:
Over one axis (in this case x), I get (apologies for the poor quality of the plot):
The blue dot represents the x location of the catalog_data subhalo centre of mass. This should surely be centred on the stellar particles, or at least be much close?
Is there some difference in coordinate system that I am unaware of coming into play here?
This should be due to the periodic boundaries, see e.g. this older thread.
This does not explain the issue here. Having corrected for the box size (coordinates modulo boxsize/2), the plot is the same:
Are you sure I am comparing the same haloes here? Could this be an instance of the halo at a different time, especially considering it is so close?
What simulation / basePath?
basePath = '../sims.TNG/TNG300-1/output/'
It's possible I've made a simple mistake somewhere...
I believe I've fixed the problem here. I'm not sure what I was doing wrong, but the centre of masses seem consistent now, when plotted against the snapshot number. Full code to produce this follows. Some error checking was required as some snapshots don't seem to return the keys. I hope this can help sombody.
Thanks for the follow-up, I suspect a (snapshot) mismatch between different arrays. Whenever you're appending things onto a python list, good to be very careful about how things are kept in sync. As you point out, a given merger tree does not need to contain all snapshot number in sequential order (some could be skipped). Also, a given subhalo does not need to have any stars, so you could check the return of
loadSubhalo
as you do or with thecount
attribute.