1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00

consider periodicity for distance in output

This commit is contained in:
Lukas Winkler 2023-01-04 16:54:38 +01:00
parent 8bd68acfad
commit db1d66122c
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -328,13 +328,11 @@ def compare_halo_resolutions(
halo_data = pd.concat(
[ref_halo.add_prefix("ref_"), comp_halo.add_prefix("comp_")]
)
distance = (
linalg.norm(
np.array([ref_halo.X, ref_halo.Y, ref_halo.Z])
- np.array([comp_halo.X, comp_halo.Y, comp_halo.Z])
)
/ ref_halo.R_200crit
)
dx = np.array([ref_halo.X, ref_halo.Y, ref_halo.Z]) - np.array([comp_halo.X, comp_halo.Y, comp_halo.Z])
dx[dx > half_box] -= box_size
dx[dx < -half_box] += box_size
distance = linalg.norm(dx) / ref_halo.R_200crit
halo_data["distance"] = distance
halo_data["match"] = best_halo_match
halo_data["num_skipped_for_mass"] = num_skipped_for_mass