mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 22:48:02 +00:00
a65e3cb15b
* Add imports * Add field LOS paths * Add basic flow model * Edit script * Add nb * Add nb * Update nb * Add some docs * Add RA reading * Add imoprts * Updates to the flow model * Update script * Bring back A2 * Update imports * Update imports * Add Carrick to ICs * Add Carrick boxsize * Add Carrick and fix minor bugs * Add Carrick box * Update script * Edit imports * Add fixed flow! * Update omega_m and add it * Update nb * Update nb * Update nb * Remove old print statements * Update params * Add thinning of chains * Add import * Add flow validation script * Add submit script * Add ksmooth * Update nb * Update params * Update script * Update string * Move where distributions are defined * Add density bias parameter * Add lognorm mean * Update scripts * Update script
4 KiB
4 KiB
In [1]:
import sys
import numpy as np
import matplotlib.pyplot as plt
import joblib
# Local packages
try:
import csiborgtools
except ModuleNotFoundError:
print("not found")
sys.path.append("../")
import csiborgtools
%matplotlib notebook
%load_ext autoreload
%autoreload 2
In [2]:
cat0 = csiborgtools.read.ClumpsCatalogue(7468)
catxs = [csiborgtools.read.ClumpsCatalogue(nsim) for nsim in (7588, 8020, 8452, 8836)]
reader = csiborgtools.read.NPairsOverlap(cat0, catxs, max_dist=150 / 0.705)
In [10]:
xs = reader.summed_overlap(from_smoothed=True)
ks = xs[:, 0] > 0.5
fig, axs = plt.subplots(ncols=3, sharey=True, figsize=[1.5 * 6.4, 4.8 * 0.75])
fig.subplots_adjust(wspace=0)
fig.suptitle("Overlap with three other simulations")
for i in range(3):
axs[i].scatter(reader.cat0("totpartmass", ks), xs[ks, i], s=1)
axs[i].set_xscale("log")
axs[i].set_xlabel(r"$M_{\rm tot} ~ [M_\odot]$")
axs[0].set_ylabel(r"Summed overlap $\sum_{b} \mathcal{O}^{\alpha \beta}_{a b}$")
plt.tight_layout()
plt.savefig("../plots/summed_overlap.png", dpi=300)
fig.show()
In [11]:
ks = xs[:, 0] > 0.5
fig, axs = plt.subplots(ncols=3, figsize=[1.5 * 6.4, 4.8 * 0.75])
axs[0].scatter(reader.cat0("totpartmass", ks), np.mean(xs[ks, :], axis=1), s=1)
axs[1].scatter(reader.cat0("totpartmass", ks), np.std(xs[ks, :], axis=1), s=1)
axs[2].scatter(np.mean(xs[ks, :], axis=1), np.std(xs[ks, :], axis=1), s=1)
for i in range(2):
axs[i].set_xscale("log")
axs[i].set_xlabel(r"$M_{\rm tot} ~ [M_\odot]$")
axs[0].set_ylabel(r"Realisation mean of $\sum_{b} \mathcal{O}^{\alpha \beta}_{a b}$")
axs[1].set_ylabel(r"Realisation std of $\sum_{b} \mathcal{O}^{\alpha \beta}_{a b}$")
axs[2].set_xlabel(r"Realisation mean of $\sum_{b} \mathcal{O}^{\alpha \beta}_{a b}$")
axs[2].set_ylabel(r"Realisation std of $\sum_{b} \mathcal{O}^{\alpha \beta}_{a b}$")
plt.tight_layout()
plt.savefig("../plots/averaged_summed_overlap.png", dpi=300)
fig.show()
In [20]:
mu, std, mu_full, std_full = reader.counterpart_mass(from_smoothed=True, overlap_threshold=0.01,
return_full=True)
probmatch = 1 - reader.prob_nomatch(from_smoothed=True)
In [23]:
t = np.linspace(1e12, 5e15)
fig, axs = plt.subplots(ncols=3, figsize=[1.5 * 6.4, 4.8 * 0.75])
axs[0].scatter(reader.cat0("totpartmass"), mu_full[:, 0], c=probmatch[:, 0], s=5 * probmatch[:, 0],
rasterized=True)
axs[1].scatter(reader.cat0("totpartmass"), mu, s=5 * np.mean(probmatch, axis=1), c=3 * np.mean(probmatch, axis=1))
axs[1].plot(t, t, c="red", ls="--")
axs[2].scatter(reader.cat0("totpartmass"), std / mu, s=5 * np.mean(probmatch, axis=1), c=3 * np.mean(probmatch, axis=1))
for i in range(3):
axs[i].set_xlabel(r"$M_{\rm tot} ~ [M_\odot]$")
axs[i].set_xscale("log")
axs[i].set_yscale("log")
axs[0].set_ylabel(r"$\langle M_{\rm tot} \rangle ~ [M_\odot]$")
axs[0].set_title(r"$1 \rightarrow 1$ (col. by match prob.)")
axs[1].set_ylabel(r"$\langle M_{\rm tot} \rangle ~ [M_\odot]$")
axs[1].set_title(r"$1\rightarrow 4$ (col. by <match prob.>)")
axs[2].set_ylabel(r"$\delta(M_{\rm tot}) / \langle M_{\rm tot} \rangle$")
axs[2].set_title(r"$1\rightarrow 4$ (col. by <match prob.>)")
fig.tight_layout()
fig.savefig("../plots/exp_mass.png", dpi=300)
fig.show()
In [46]:
xs = reader.summed_overlap(from_smoothed=False)
ys = reader.summed_overlap(from_smoothed=True)
t = np.linspace(0, 1, 100)
fig, axs = plt.subplots(ncols=4, figsize=(6.4 * 3, 4.8), sharey=True)
fig.subplots_adjust(wspace=0)
for i in range(4):
axs[i].hexbin(xs[:, i], ys[:, i], mincnt=1, bins="log", gridsize=30)
axs[i].plot(t, t, c="red", ls="--")
axs[i].set_xlabel("Original summed overlap")
axs[0].set_ylabel("Smoothed summer overlap")
fig.suptitle("Matching one simulation to four others")
plt.tight_layout(w_pad=0)
fig.savefig("../plots/ovelap_comp.png", dpi=450)
fig.show()