mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 17:28:02 +00:00
17badf2652
* add xray reading * add import * add more comments * add data * add nb * add MCXC shortcut * add match indxs to Planck of MCXC * add import * update TODO * update readme * add famous clusters * add 2mpp_groups * shorten paths * add 2M++ groups * add import * Update TODO
523 KiB
523 KiB
Matching of haloes to clusters¶
In [144]:
import numpy as np
import matplotlib.pyplot as plt
from astropy.cosmology import FlatLambdaCDM
import pandas as pd
%load_ext autoreload
%autoreload 2
%matplotlib inline
Load in the data¶
Harry: the exact routine may not work, I had to edit the raw .txt file a little
In [124]:
cosmo = FlatLambdaCDM(H0=100, Om0=0.307)
data0 = pd.read_csv("/mnt/users/rstiskalek/csiborgtools/data/top10_pwave_coords.txt", sep='\s+')
data = {}
data["id"] = np.array([int(x.split("_")[-1]) for x in data0["halo_ID"].values])
data["l"] = data0["l[deg]"].values
data["b"] = data0["b[deg]"].values
data["dist"] = cosmo.comoving_distance(data0["z"].values).value
print(data["dist"])
data0
Out[124]:
Load in the halo catalogue¶
In [126]:
boxsize = 677.7
halos = np.load("/users/hdesmond/Mmain/Mmain_9844.npy")
names = ["id", "x", "y", "z", "M"]
halos = {k: halos[:, i] for i, k in enumerate(names)}
halos["id"] = halos["id"].astype(int)
# Coordinates are in box units. Convert to Mpc/h
for p in ("x", "y", "z"):
halos[p] = halos[p] * boxsize
halos["dist"] = np.sqrt((halos["x"] - boxsize/2)**2 + (halos["y"] - boxsize/2)**2 + (halos["z"] - boxsize/2)**2)
In [142]:
# Find which item in the catalogue matches the nth halo in the .txt file
n = 0
k = np.where(data["id"][n] == halos["id"])[0][0]
print(k)
In [143]:
data["dist"][n], halos["dist"][k]
Out[143]: