Hi! If I have a given halo with a halo ID of 34 (a random number) at the 99th snapshot (z=0), how can I get the halo ID of the top 5 closest haloes of the given halo 34 at 99th snapshot?
I know that I could iterate the whole haloes of z=0. But there are 10247012 haloes of z=0 in TNG50-1, which is so large a number.
Dylan Nelson
24 Feb
You can calculate the distance from halo 34 to all other halos, sort these distances, and select the five smallest.
If you want to do this just for one halo (as above), then this is fast.
If you want to find the closest halo to -every- halo, you could use a tree search to speed up the calculation.
Hi! If I have a given halo with a halo ID of 34 (a random number) at the 99th snapshot (z=0), how can I get the halo ID of the top 5 closest haloes of the given halo 34 at 99th snapshot?
I know that I could iterate the whole haloes of z=0. But there are 10247012 haloes of z=0 in TNG50-1, which is so large a number.
You can calculate the distance from halo 34 to all other halos, sort these distances, and select the five smallest.
If you want to do this just for one halo (as above), then this is fast.
If you want to find the closest halo to -every- halo, you could use a tree search to speed up the calculation.
Many thanks!