mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 17:28:02 +00:00
2b938c112c
* Add more comments * Add flow paths * Simplify paths * Update default arguemnts * Update paths * Update param names * Update some of scipts for reading files * Add the Mike method option * Update plotting * Update fnames * Simplify things * Make more default options * Add print * Update * Downsample CF4 * Update numpyro selection * Add selection fitting nb * Add coeffs * Update script * Add nb * Add label * Increase number of steps * Update default params * Add more labels * Improve file name * Update nb * Fix little bug * Remove import * Update scales * Update labels * Add script * Update script * Add more * Add more labels * Add script * Add submit * Update spacing * Update submit scrips * Update script * Update defaults * Update defaults * Update nb * Update test * Update imports * Add script * Add support for Indranil void * Add a dipole * Update nb * Update submit * Update Om0 * Add final * Update default params * Fix bug * Add option to fix to LG frame * Add Vext label * Add Vext label * Update script * Rm fixed LG * rm LG stuff * Update script * Update bulk flow plotting * Update nb * Add no field option * Update defaults * Update nb * Update script * Update nb * Update nb * Add names to plots * Update nb * Update plot * Add more latex names * Update default * Update nb * Update np * Add plane slicing * Add nb with slices * Update nb * Update script * Upddate nb * Update nb
14 KiB
14 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]: