Hello,
To get the descendent subhalos for a particular subhalo for certain snapshots I used the merger tree.
tree = il.sublink.loadTree(basePath, 99,83280, fields=['SnapNum','SubfindID'],onlyMPB=True)
for i in (72,78,84,91,99):
ind_in_tree = np.where(tree['SnapNum'] == i)
print(tree['SubfindID'][ind_in_tree])
However, the central co-ordinate of the same subhalo for each snapshot is very different, i.e
This should not be the case, since I am looking at the same subhalo per snapshot. The coordinates for the subhalo center shouldn't vary so significantly.
Am I doing something wrong?
Regards,
Nikita
Dylan Nelson
20 Nov '21
Hi Nikita,
I'm not sure what simulation you were looking at there, but I paste an example below. You can also load SubhaloPos from the tree for a positions. For the coordinates you posted, I am not sure why there are two numbers instead of three (x,y,z).
Thanks, I am running TNG 100-1 simulation and the coordinates I had posted were just (x,y).
I want to create plots showing the entire subhalo, and require the 'Coordinates' field in the Snapshots catalog for that.
To get the correct coordinates, I am using:
gas_pos = (gas['Coordinates'])*ckpc/h
sub_pos = (subhalo['SubhaloPos'])*ckpc/h
x = (gas_pos[:,0] - sub_pos[0])/kpc
y = (gas_pos[:,1] - sub_pos[1])/kpc
z = (gas_pos[:,2] - sub_pos[2])/kpc
Where x,y,z are the coordinates. However, on running this and getting the plots, the coordinates at the center of the same subhalo at different redshifts are:
I fail to understand why this is the case, particularly for snapshot 99. Kindly request you to please help with this.
Regards,
Nikita
Dylan Nelson
20 Nov '21
Hi Nikita,
Can you post a complete code example of the problem?
I am not sure what "the coordinates at the center of the same subhalo" means exactly. In TNG100-1 at snapshot 99, subhalo ID 83280 has SubhaloPos of (23867.8, 33076.1, 41411.2). If you load all the gas particles that belong to this subhalo, their positions will be at similar Coordinates.
I would suggest to simplify, to help understand if there is a problem. What about
basePath = 'sims.TNG/TNG100-1/output'
snap = 99
subhalo_id = 64
gas_pos = il.snapshot.loadSubhalo(basePath, snap, subhalo_id, 'gas', fields=['Coordinates'])
subhalo = il.groupcat.loadSingle(basePath, snap, subhaloID=subhalo_id)
sub_pos = subhalo['SubhaloPos']
# note: periodic boundaries of the simulation box need to be considered in general
dx = gas_pos[:,0] - sub_pos[0]
dy = gas_pos[:,1] - sub_pos[1]
dz = gas_pos[:,2] - sub_pos[2]
fig, ax = plt.subplots(figsize=[8,8])
ax.set_xlabel('dx [ckpc/h]')
ax.set_ylabel('dz [ckpc/h]')
ax.plot(dx, dz, '.')
Nikita Agarwal
22 Nov '21
Hi Dylan,
Thanks, I used your suggestion and checked for individual subhalos, but the problem still persists.
I shall try checking for other subhalo IDs as well.
Also, can you please clarify what you meant by the comment 'periodic boundaries of the simulation box need to be considered in general'
Hello,
To get the descendent subhalos for a particular subhalo for certain snapshots I used the merger tree.
However, the central co-ordinate of the same subhalo for each snapshot is very different, i.e
This should not be the case, since I am looking at the same subhalo per snapshot. The coordinates for the subhalo center shouldn't vary so significantly.
Am I doing something wrong?
Regards,
Nikita
Hi Nikita,
I'm not sure what simulation you were looking at there, but I paste an example below. You can also load
SubhaloPos
from the tree for a positions. For the coordinates you posted, I am not sure why there are two numbers instead of three (x,y,z).Hi Dylan,
Thanks, I am running TNG 100-1 simulation and the coordinates I had posted were just (x,y).
I want to create plots showing the entire subhalo, and require the 'Coordinates' field in the Snapshots catalog for that.
To get the correct coordinates, I am using:
Where x,y,z are the coordinates. However, on running this and getting the plots, the coordinates at the center of the same subhalo at different redshifts are:
Snapshot 99, (147.8469, 203.8065, 145)
Snapshot 91, (70.7445, 90.4545, 100)
Snapshot 84, (66.8501, 70.4983, 82)
Snapshot 78, (45.0122, 72.8373, 62)
Snapshot 72, (52.6200, 60.009, 65)
I fail to understand why this is the case, particularly for snapshot 99. Kindly request you to please help with this.
Regards,
Nikita
Hi Nikita,
Can you post a complete code example of the problem?
I am not sure what "the coordinates at the center of the same subhalo" means exactly. In TNG100-1 at snapshot 99, subhalo ID 83280 has SubhaloPos of (23867.8, 33076.1, 41411.2). If you load all the gas particles that belong to this subhalo, their positions will be at similar Coordinates.
Hi Dylan.
Below is the code:
The output for the code is as:
As you can see, the subhalo position significantly varies from z = 0.39 to z = 0
Regards,
Nikita
I would suggest to simplify, to help understand if there is a problem. What about
Hi Dylan,
Thanks, I used your suggestion and checked for individual subhalos, but the problem still persists.
I shall try checking for other subhalo IDs as well.
Also, can you please clarify what you meant by the comment 'periodic boundaries of the simulation box need to be considered in general'
Regards,
Nikita
Dear Nikita,
Please see this previous thread about the periodic box.
Otherwise, I am not sure exactly what the problem is. The code above produces the output I would expect:
Hi Dylan,
Thanks, I am getting the same plot.
Your inputs helped solve my problem.
Regards,
Nikita