csiborgtools/notebooks/perseus.ipynb
Richard Stiskalek eb8d070fff
CSiBORG FoF switch (#75)
* Add moving FoF membership files

* add FoF membership path

* Add notes where its PHEW

* Add FoF catalogue path

* Correct typo

* Add more functionalities

* Make work with halo IDs from FoF

* Edit print statement

* Fix copy bug

* copy

* Add FoF catalogue reading

* Clean up script

* Fix typo

* Little edits

* Fix naming convention

* Rename key

* Remove loading substructure particles

* Rename CSiBORG Cat

* Rename clumps cat

* Rename cat

* Remove misplaced import

* Switch to halos

* rm import

* structfit of only halos

* Add FoF halo reading

* Add a short comment

* Fix __getitem__ to work with int

* Fix problems

* Improve __getitem__

* Add more conversion

* Fix indexing

* Fix __getitem__ assertion

* Fix numbers

* Rename

* Fix verbosity flags

* Add full Quijote HMF option

* Add plot of Quijote only

* Add quijote full paths

* Fix the fit_init script

* Renam arg

* Update .gitignore

* add default argument name

* Change default verbosity flag

* Modernise script structure

* Fix dictionary

* Fix reading to include m200c

* Modernise script

* Add args
2023-07-24 14:10:21 +02:00

25 KiB

In [2]:
import sys
import numpy as np
import matplotlib.pyplot as plt
import scienceplots
import astroquery
from tqdm import trange, tqdm

sys.path.append("../")
import csiborgtools

%matplotlib widget 
%load_ext autoreload
%autoreload 2
In [38]:
# # Norma
cluster = {"RA": (16 + 15 / 60 + 32.8 / 60**2) * 15,
           "DEC": -60 + 54 / 60 + 30 / 60**2,
           "DIST": 67.8}

Xclust = np.array([cluster["DIST"], cluster["RA"], cluster["DEC"]]).reshape(1, -1)
In [39]:
paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)
nsims = paths.get_ics(False)
In [29]:
Xclust = np.array([cluster["DIST"], cluster["RA"], cluster["DEC"]]).reshape(1, -1)
In [33]:
matches = np.full(len(nsims), np.nan)

for ii in trange(101):
    cat = csiborgtools.read.CSiBORGHaloCatalogue(nsims[ii], paths, minmass=('M', 1e13))
    dist, ind = cat.angular_neighbours(Xclust, ang_radius=5, rad_tolerance=10)
    dist = dist[0]
    ind = ind[0]

    if ind.size > 0:
        matches[ii] = np.max(cat['M'][ind])
100%|██████████| 101/101 [00:44<00:00,  2.25it/s]
In [37]:
x = np.log10(matches[~np.isnan(matches)])


plt.figure()
plt.hist(x, bins=10)
plt.show()
Figure
No description has been provided for this image
In [ ]: