mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-23 03:28:03 +00:00
420 KiB
420 KiB
In [1]:
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
try:
import csiborgtools
except ModuleNotFoundError:
import sys
sys.path.append("../")
import csiborgtools
import utils
%load_ext autoreload
%autoreload 2
import joblib
from os.path import join
from glob import glob
In [53]:
from astropy.cosmology import FlatLambdaCDM
In [ ]:
In [ ]:
In [54]:
cosmo = FlatLambdaCDM(H0=70.5, Om0=0.307, Tcmb0=2.728)
In [60]:
x = cosmo.Om0 - 1
18*np.pi**2 + 82 * x - 39 * x**2
Out[60]:
In [ ]:
In [ ]:
In [2]:
Nsim = 9844
simpath = csiborgtools.io.get_sim_path(Nsim)
Nsnap = 1016
In [40]:
fname = join(utils.dumpdir, "ramses_out_{}_{}.npy".format(str(Nsim).zfill(5), str(Nsnap).zfill(5)))
In [41]:
data = np.load(fname)
In [49]:
plt.figure()
plt.scatter(data["logRs"], data["rho0"], s=2.5, rasterized=True)
plt.yscale("log")
plt.ylabel(r"$\rho_0$")
plt.xlabel(r"$\log R_{\rm s}$")
# plt.savefig("../plots/rho0.png", dpi=450)
plt.show()
In [44]:
data["rho0"]
Out[44]:
In [ ]:
In [ ]:
In [24]:
out = csiborgtools.io.combine_splits(utils.Nsplits, Nsim, Nsnap, utils.dumpdir, )
In [27]:
out.dtype.names
Out[27]:
In [36]:
plt.figure()
plt.scatter(out["mass_cl"], out["logRs"], s=3, rasterized=True)
# t = np.logspace(-8, -4, 1000)
# plt.plot(t, t, c="red", ls="--")
# plt.yscale("log")
plt.xscale("log")
plt.xlabel("mass_cl")
# plt.ylabel("summed mass of all particles")
plt.savefig("../plots/mass.png", dpi=400)
plt.show()
In [ ]:
In [22]:
mask = np.isin(out["index"], arr["index"])
In [23]:
mask
Out[23]:
In [ ]:
In [ ]:
np.where()
In [ ]:
In [16]:
Out[16]:
In [ ]:
In [ ]:
In [ ]:
# clump_ids = csiborgtools.io.read_clumpid(Nsnap, simpath)
# clumps = csiborgtools.io.read_clumps(Nsnap, simpath, )
# particles = csiborgtools.io.read_particle(["x", "y", "z", "M", "level"], Nsnap, simpath)
# clump_ids, particles = csiborgtools.io.drop_zero_indx(clump_ids, particles)
# with_particles = csiborgtools.fits.clump_with_particles(clump_ids, clumps)
# clumps = clumps[with_particles]
In [ ]:
f = join(utils.dumpdir, "ramses_out_09844_01016_123.npy")
f = np.load(f)
In [ ]:
plt.figure()
plt.hist(f["logRs"], bins="auto")
plt.show()
In [ ]: