csiborgtools/notebooks/flow/flow_mapping.ipynb
Richard Stiskalek ee222cd010
Fix overlap runs (#125)
* Update nb

* Update script

* Update script

* Rename

* Update script

* Update script

* Remove warning

* Ignore minors when extracting MAH

* Fix paths bug

* Move notebooks

* Move files

* Rename and delete things

* Rename file

* Move file

* Rename things

* Remove old print statement

* Add basic MAH plot

* Add random MAH path

* Output snapshot numbers

* Add MAH random extraction

* Fix redshift bug

* Edit script

* Add extracting random MAH

* Little updates

* Add CB2 redshift

* Add some caching

* Add diagnostic plots

* Add caching

* Minor updates

* Update nb

* Update notebook

* Update script

* Add Sorce randoms

* Add CB2 varysmall

* Update nb

* Update nb

* Update nb

* Use catalogue HMF

* Move definition of radec2galactic

* Update nb

* Update import

* Update import

* Add galatic coords to catalogues

* Update nb
2024-04-08 11:23:21 +02:00

46 KiB

In [1]:
import numpy as np
import matplotlib.pyplot as plt
import joblib
from glob import glob
from tqdm import tqdm
try:
    import csiborgtools
except ModuleNotFoundError:
    print("not found")
    import sys
    sys.path.append("../")
    import csiborgtools


%matplotlib notebook
%load_ext autoreload
%autoreload 2
not found
In [13]:
knnreader = csiborgtools.read.kNNCDFReader()

auto_files = glob("/mnt/extraspace/rstiskalek/csiborg/knn/auto/*")
ks = [0, 3, 7]
rs, cdf, mass_thresholds = knnreader.read(auto_files, ks, rmin=0.1)
100%|██████████| 101/101 [00:02<00:00, 38.07it/s]
In [14]:
mu = np.mean(cdf, axis=0)
std = np.std(cdf, axis=0)


cols = plt.rcParams["axes.prop_cycle"].by_key()["color"]
fig, axs = plt.subplots(ncols=3, figsize=(6.4 * 1.5, 4.8 * 0.75))

for ki, k in enumerate(ks):
    for n in list(range(3))[::-1]:
        label = r"$\log M_{{\rm tot}} / M_\odot \geq {}$".format(np.log10(mass_thresholds[n]))
        axs[ki].fill_between(rs, 1 - std[n, ki, :] / mu[n, ki, :], 1 + std[n, ki, :] / mu[n, ki, :],
                             color=cols[n], label=label)

    axs[ki].set_title(r"$k \leq {}$".format(k))
    axs[ki].axvline(2.65 / 0.705, c="red", ls="--", label="BORG constrained scale", alpha=0.5)
    axs[ki].set_xscale("log")
    axs[ki].set_xlabel(r"$r~\left[\mathrm{Mpc}\right]$")    
    
axs[0].set_ylabel(r"CDF ratio to mean")
axs[0].legend(frameon=False)

plt.tight_layout(w_pad=0)
fig.savefig("../plots/knn_auto.png", dpi=450)
fig.show()
No description has been provided for this image
In [16]:
knnreader = csiborgtools.read.kNNCDFReader()

cross_files = glob("/mnt/extraspace/rstiskalek/csiborg/knn/cross/knncdf_9004*")

cross_files = knnreader.cross_files(7444, "/mnt/extraspace/rstiskalek/csiborg/knn/cross/")

ks = [0, 3, 7]
rs, corr, mass_thresholds = knnreader.read(cross_files, ks, rmin=1)
100%|██████████| 100/100 [00:02<00:00, 42.21it/s]
In [17]:
cols = plt.rcParams["axes.prop_cycle"].by_key()["color"]


fig, axs = plt.subplots(ncols=3, figsize=(6.4 * 1.5, 4.8 * 0.75))
for ki, k in enumerate(ks):
    for n in range(3):
        for i in range(35):
            axs[ki].plot(rs, corr[i, n, ki, :], c=cols[n], lw=0.5)

        axs[ki].plot(rs, np.median(corr[:, n, ki, :], axis=0), c=cols[n],
                     label=r"$\log M_{{\rm tot}} / M_\odot \geq {}$".format(np.log10(mass_thresholds[n])))

    
    axs[ki].axvline(2.65 / 0.705, c="red", ls="--", label="BORG constrained scale", alpha=0.5)
    axs[ki].set_xscale("log")
    axs[ki].set_title(r"$k \leq {}$".format(k))
    axs[ki].set_xlabel(r"$r~\left[\mathrm{Mpc}\right]$")
    
axs[0].legend(frameon=False)
plt.tight_layout()
fig.savefig("../plots/knn_cross.png", dpi=450)
fig.show()
No description has been provided for this image
In [ ]:

In [ ]:

In [ ]: