mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-23 03:18:03 +00:00
392 lines
1,012 KiB
Text
392 lines
1,012 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"%matplotlib inline\n",
|
||
|
"\n",
|
||
|
"from h5py import File\n",
|
||
|
"from astropy.cosmology import FlatLambdaCDM\n",
|
||
|
"import csiborgtools\n",
|
||
|
"\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with File(\"/mnt/users/hdesmond/BORG_final/mcmc_7444.h5\", 'r') as f:\n",
|
||
|
"# with File(\"/mnt/extraspace/rstiskalek/BORG_STOPYRA_2023/mcmc_17417.h5\") as f:\n",
|
||
|
" density_borg = f[\"scalars/BORG_final_density\"][:]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with File(\"/mnt/extraspace/rstiskalek/csiborg1/sph_ramses_07444_1024.hdf5\", 'r') as f:\n",
|
||
|
" density_csiborg = f[\"density\"][:]\n",
|
||
|
" # print(f.keys())"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"Omega_m = 0.307\n",
|
||
|
"cosmo = FlatLambdaCDM(Om0=Omega_m, H0=100)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"density_csiborg /= np.mean(density_csiborg)\n",
|
||
|
"density_csiborg -= 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/tmp/ipykernel_16448/1347191498.py:2: RuntimeWarning: divide by zero encountered in log10\n",
|
||
|
" axs[0].imshow(np.log10(density_borg[:,128, :] + 1))\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAAGRCAYAAABfSZMVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9x69tW5beB/6mW2abY69595mIlxGZTCNRmQJNNqqA6hBQowoo9tgjwT7ZyUaBRKFIEGqwmmxQgP4FQuqopw47KiMVq0SRyUymjQzz7DXHbrPcNNUYc669z41IlbLyIUMR3AO4uPees81ac00zvjG+8Q2VUkqc7GQnO9nJTnayk53sZCc72cnQP+0LONnJTnayk53sZCc72clOdrL/tdgJIJ3sZCc72clOdrKTnexkJztZthNAOtnJTnayk53sZCc72clOdrJsJ4B0spOd7GQnO9nJTnayk53sZNlOAOlkJzvZyU52spOd7GQnO9nJsp0A0slOdrKTnexkJzvZyU52spNlOwGkk53sZCc72clOdrKTnexkJ8t2AkgnO9nJTnayk53sZCc72clOlu0EkE52spOd7GQnO9nJTnayk50s2wkgnexkJzvZyU52spOd7GQnO1m2E0A62clOdrKTnSzbf/Ff/Bd8+umnNE3Db/7mb/Kv/tW/+mlf0slOdrKTnewv2H6qAOl0EJ3sZCc72cn+12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xUqhF4LIduGwTjQqsUke1fOTdtKKaKurlI1/tz5iyU3jV7vle3dJdWXYfWtrriav1wMJNvNkYwNN1FdO2QleBejGxaAba2vHmccU0Wgk8fKhYXXS01YQz4NM
|
||
|
"text/plain": [
|
||
|
"<Figure size 1000x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plt.subplots(1, 2, figsize=(10,5))\n",
|
||
|
"axs[0].imshow(np.log10(density_borg[:,128, :] + 1))\n",
|
||
|
"axs[1].imshow(np.log10((density_csiborg.T)[:, 512, :] + 1))\n",
|
||
|
"\n",
|
||
|
"axs[0].scatter([128], [128], c='r', s=15, marker='x')\n",
|
||
|
"axs[1].scatter([512], [512], c='r', s=15, marker='x')\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"(84.92296662181516, 85.20374456447004)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 19,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"(density_csiborg.sum() / (677.7)**3 * 1e-9), (Omega_m * cosmo.critical_density(0).to(\"Msun/kpc3\").value)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"import readgadget\n",
|
||
|
"\n",
|
||
|
"snapshot = \"/mnt/users/rstiskalek/csiborgtools/data/chain_17417/chain_17417/ic/ic.dat\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"ptype = [1] #[1](CDM), [2](neutrinos) or [1,2](CDM+neutrinos)\n",
|
||
|
"\n",
|
||
|
"# read header\n",
|
||
|
"header = readgadget.header(snapshot)\n",
|
||
|
"BoxSize = header.boxsize #Mpc/h\n",
|
||
|
"Nall = header.nall #Total number of particles\n",
|
||
|
"Masses = header.massarr*1e10 #Masses of the particles in Msun/h\n",
|
||
|
"Omega_m = header.omega_m #value of Omega_m\n",
|
||
|
"Omega_l = header.omega_l #value of Omega_l\n",
|
||
|
"h = header.hubble #value of h\n",
|
||
|
"redshift = header.redshift #redshift of the snapshot\n",
|
||
|
"Hubble = 100.0*np.sqrt(Omega_m*(1.0+redshift)**3+Omega_l)#Value of H(z) in km/s/(Mpc/h)\n",
|
||
|
"\n",
|
||
|
"# read positions, velocities and IDs of the particles\n",
|
||
|
"pos = readgadget.read_block(snapshot, \"POS \", ptype) #positions in Mpc/h\n",
|
||
|
"vel = readgadget.read_block(snapshot, \"VEL \", ptype) #peculiar velocities in km/s\n",
|
||
|
"# ids = readgadget.read_block(snapshot, \"ID \", ptype)-1 #IDs starting from 0\n",
|
||
|
"cosmo = FlatLambdaCDM(Om0=Omega_m, H0=100)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 29,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"OBS LOC [338.3 338.3 338.3]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# obs_vel = np.array([-262.69592, 326.13116, -122.10088]).astype(np.float32)\n",
|
||
|
"obs_vel = np.zeros(3, dtype=np.float32) * 0\n",
|
||
|
"obs_loc = np.ones(3) * BoxSize / 2\n",
|
||
|
"print(\"OBS LOC \", obs_loc)\n",
|
||
|
"rsp_pos = csiborgtools.utils.real2redshift(pos, vel, obs_loc, obs_vel, BoxSize, True).astype(np.float32)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
"Using CIC mass assignment scheme\n",
|
||
|
"Time taken = 0.534 seconds\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"Using CIC mass assignment scheme\n",
|
||
|
"Time taken = 0.495 seconds\n",
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import MAS_library as MASL\n",
|
||
|
"\n",
|
||
|
"# number of particles\n",
|
||
|
"Np = 256**3\n",
|
||
|
"\n",
|
||
|
"# density field parameters\n",
|
||
|
"grid = 256 #the 3D field will have grid x grid x grid voxels\n",
|
||
|
"MAS = 'CIC' #mass-assigment scheme\n",
|
||
|
"verbose = True #print information on progress\n",
|
||
|
"\n",
|
||
|
"# particle positions in 3D\n",
|
||
|
"\n",
|
||
|
"# define 3D density field\n",
|
||
|
"delta = np.zeros((grid,grid,grid), dtype=np.float32)\n",
|
||
|
"delta_rsp = np.zeros((grid,grid,grid), dtype=np.float32)\n",
|
||
|
"\n",
|
||
|
"# construct 3D density field\n",
|
||
|
"MASL.MA(pos, delta, BoxSize, MAS, verbose=verbose,)\n",
|
||
|
"MASL.MA(rsp_pos, delta_rsp, BoxSize, MAS, verbose=verbose,)\n",
|
||
|
"\n",
|
||
|
"cell_length = BoxSize/grid\n",
|
||
|
"\n",
|
||
|
"delta = delta.T\n",
|
||
|
"delta *= Masses[1]\n",
|
||
|
"delta /= (cell_length * 1000)**3\n",
|
||
|
"\n",
|
||
|
"delta_rsp = delta_rsp.T\n",
|
||
|
"delta_rsp *= Masses[1]\n",
|
||
|
"delta_rsp /= (cell_length * 1000)**3"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 31,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"REAL 86.33655 86.34164473617794\n",
|
||
|
"RSP 86.33636 86.34164473617794\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(\"REAL \", delta.mean() , (cosmo.critical_density(0).to(\"Msun/kpc3\").value * Omega_m))\n",
|
||
|
"print(\"RSP \", delta_rsp.mean() , (cosmo.critical_density(0).to(\"Msun/kpc3\").value * Omega_m))\n",
|
||
|
"\n",
|
||
|
"delta /= (cosmo.critical_density(0).to(\"Msun/kpc3\").value * Omega_m)\n",
|
||
|
"delta -= 1\n",
|
||
|
"\n",
|
||
|
"delta_rsp /= (cosmo.critical_density(0).to(\"Msun/kpc3\").value * Omega_m)\n",
|
||
|
"delta_rsp -= 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 32,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0QAAAGQCAYAAACOKaA+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9Sa9lSZYein3LbLenuY034ZmRldWxXr1HCk8kwKYAQQI0IMCBJpxx+MB5cVIj1oQER5xyQP4IDjQVOCngSRBEiAApARKpeqzKquwiI9zD/Xan253Z0mAts21733MbDw9Wvsg8BgTi+r3n7G3btjWr+b5vETMzTu3UTu3UTu3UTu3UT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5OMGrpRg5fQ+/26sTqQEEQ6C6FkeRd0COuAdRXYOI4KmNjieZHGAHz72M214CAcE4JluAsgy+kOdwpEbVCRL28NmEDLbzwLtr1MjiOcA9QGUhc8OWwOsXoEMLNBKAYnViuOsAmNm5NGupMcAADgPIdbDFAjh7Ad7t4P1uDGylTQ0uMjQ1gnXbl3ubMViTGk5kQDaDQQ70rTwTLEA2MWYIdLuDcQCtc2Cxhj/08P1h7L4tQFkh5ykAoIWHA5MB5nZk+LcL19dzjWZjlBpZ0VjDESOLknvotQYaHRm9KbORNRHvl1zCYTznglNCFkz6PrxPvqcGrg/ORAZaLiUQOgzgppV1W8h48PdfIXt7BT4cxFHpBzA7uW4YkOCcGitOQvhL18NkZXQ0YQh8kD1WxksCJqYsgcMgj0cFUBajDXPMKKVkbDyAluX5THnfKeUwPjz2c9OADoMEbDoNTEHnps4pqkp5FmujMxTtAe/VVmPAeHDv9YVk+o5DHxKoFAMYGNj1MJU
|
||
|
"text/plain": [
|
||
|
"<Figure size 1000x500 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plt.subplots(1, 2, figsize=(10,5))\n",
|
||
|
"axs[0].imshow(delta_rsp[:,:,128])\n",
|
||
|
"axs[1].imshow(density_borg[:, :, 128])\n",
|
||
|
"\n",
|
||
|
"for ax in axs:\n",
|
||
|
" ax.scatter([128], [128], c='r', s=15, marker='x')\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 33,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/mnt/users/rstiskalek/csiborgtools/venv_csiborg/lib/python3.11/site-packages/numpy/core/fromnumeric.py:3464: RuntimeWarning: Mean of empty slice.\n",
|
||
|
" return _methods._mean(a, axis=axis, dtype=dtype,\n",
|
||
|
"/mnt/users/rstiskalek/csiborgtools/venv_csiborg/lib/python3.11/site-packages/numpy/core/_methods.py:192: RuntimeWarning: invalid value encountered in divide\n",
|
||
|
" ret = ret.dtype.type(ret / rcount)\n",
|
||
|
"/mnt/users/rstiskalek/csiborgtools/venv_csiborg/lib/python3.11/site-packages/numpy/core/_methods.py:192: RuntimeWarning: invalid value encountered in scalar divide\n",
|
||
|
" ret = ret.dtype.type(ret / rcount)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"y_csiborg = []\n",
|
||
|
"y_csiborg_rsp = []\n",
|
||
|
"y_borg = []\n",
|
||
|
"\n",
|
||
|
"dks = range(0, 128 + 1)\n",
|
||
|
"for dk in dks:\n",
|
||
|
" kmin = 128 - dk\n",
|
||
|
" kmax = 128 + dk\n",
|
||
|
"\n",
|
||
|
" y_csiborg.append(np.mean(delta[kmin:kmax, kmin:kmax, kmin:kmax]))\n",
|
||
|
" y_csiborg_rsp.append(np.mean(delta_rsp[kmin:kmax, kmin:kmax, kmin:kmax]))\n",
|
||
|
" y_borg.append(np.mean(density_borg[kmin:kmax, kmin:kmax, kmin:kmax]))\n",
|
||
|
"\n",
|
||
|
"y_csiborg = np.array(y_csiborg)\n",
|
||
|
"y_borg = np.array(y_borg)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 37,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAAHKCAYAAADFHNWHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAACZ1klEQVR4nOzdd3gUVdvA4d9sT+8hhSQktNBLIEiTqlRREFFExYaK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P/wwI0eOxM3NzZFMlKWsZGP69On07duXnJwcfvrpJxYsWIBGU3zUwIVjcnJyim13dXV13Gb/+++/8+abb1b52rp3787ixYspKipiz549/PTTT7z77ruMHTuW3bt307Zt20rXdSHOyrwW/x6jZTKZWLZsGWBvAQwPD6dp06ZlxgyUmzg2a9aMzz//HJvNRlxcHK+++iopKSmOhOWC33//nZSUFKKjozl69Khj+4ABA/juu+94/fXXS/x/VNYjjzzCypUr+frrr0u02jk5OVFYWFjimIKCAsf+0rz55pt8/vnnvPzyy467Sv8tLCzMMZZr/Pjx3HfffQwePJhDhw5Jt59odCShEuIyptFoGDBgADNnzuTIkSO0adOGXbt2UVhYWGa33969e9Hr9bRs2bLY9g4dOji6FG+44Qby8vKYNGkSffr0ISQkBIDIyEiAEmOddDqd49jTp09f0jUZDAa6d+9O9+7dadWqFXfddReLFi3i+eefr3Q
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"dks_phys = np.array(dks) * (BoxSize/ 256)\n",
|
||
|
"\n",
|
||
|
"plt.figure()\n",
|
||
|
"# plt.title(\"Enclosed overdensity within a cube of side length $2 L$ centered at the origin.\", fontsize=10)\n",
|
||
|
"plt.title(\"BORG_STOPYRA_2023\")\n",
|
||
|
"plt.plot(dks_phys, y_csiborg, label=\"MUSIC\")\n",
|
||
|
"plt.plot(dks_phys, y_csiborg_rsp, label=\"MUSIC (RSP)\")\n",
|
||
|
"plt.plot(dks_phys, y_borg, label=\"BORG (RSP)\", ls=\"--\")\n",
|
||
|
"plt.xlabel(r\"$L ~ [\\mathrm{Mpc}/\\mathrm{h}]$\")\n",
|
||
|
"plt.ylabel(r\"$\\delta_r$\")\n",
|
||
|
"plt.axhline(0, color=\"black\", linestyle=\"--\")\n",
|
||
|
"plt.legend()\n",
|
||
|
"plt.ylim(-0.2, 0.1)\n",
|
||
|
"plt.savefig(\"../plots/MUSIC_BORG_STOPYRA_comparisong.png\", dpi=300)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"a"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "venv_csiborg",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.11.4"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|