mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 20:38:02 +00:00
779f2e76ac
* Update redshift reading * Add helio to CMB redshift * Update imports * Update nb * Run for Quijote * Add script * Update * Update .gitignore * Update imports * Add Peery estimator * Add bulk flow scripts * Update typs * Add comment * Add blank space * Update submission script * Update description * Add barriers * Update nb * Update nb * Rename script * Move to old * Update imports * Add nb * Update script * Fix catalogue key * Update script * Update submit * Update comment * Update .gitignore * Update nb * Update for stationary obsrevers * Update submission * Add nb * Add better verbose control * Update nb * Update submit * Update nb * Add SN errors * Add draft of the script * Update verbosity flags * Add submission script * Debug script * Quickfix * Remove comment * Update nb * Update submission * Update nb * Processed UPGLADE
12 KiB
12 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]: