mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 17:28:02 +00:00
43ebf660ee
* Update priors * Update submit * Update README * Relax width of calibration priors * Relax width of calibration priors * Update smooth scales * Update settings * Update README * Update submit * Add names * Update nb * Fix bug * Update script * Move files * Small bug fix * Add script * Add script * Add script * Add more power * Update script * Quick fix * Rm blank line * Update nb * Update nb * Update nb
52 KiB
52 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]: