mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-23 00:38:03 +00:00
627 lines
91 KiB
Text
627 lines
91 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"from os.path import join\n",
|
||
|
"\n",
|
||
|
"import csiborgtools\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import numpy\n",
|
||
|
"import scienceplots # noqa\n",
|
||
|
"from cache_to_disk import cache_to_disk, delete_disk_caches_for_function # noqa\n",
|
||
|
"\n",
|
||
|
"import plt_utils\n",
|
||
|
"\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Field evaluated at radial shells"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# TODO: This is a little dodgy\n",
|
||
|
"\n",
|
||
|
"def plot_field_shells(field, MAS, grid, to_save=True):\n",
|
||
|
" folder = \"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells\"\n",
|
||
|
"\n",
|
||
|
" # with plt.style.context(\"notebook\"):\n",
|
||
|
" if True:\n",
|
||
|
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
|
||
|
" lw = plt.rcParams['lines.linewidth']\n",
|
||
|
" plt.figure()\n",
|
||
|
"\n",
|
||
|
" # CSiBORG2 main\n",
|
||
|
" fname = join(folder, f\"csiborg2_main_{field}_{MAS}_{grid}.npz\")\n",
|
||
|
" file = numpy.load(fname)\n",
|
||
|
" dist, mean = file[\"distances\"], file[\"mean\"]\n",
|
||
|
" mean /= dist\n",
|
||
|
" mean /= 70\n",
|
||
|
" for i in range(len(mean)):\n",
|
||
|
" plt.plot(dist, mean[i], c=cols[0], label=\"CSiBORG\" if i == 0 else None)\n",
|
||
|
" \n",
|
||
|
" # # BORG2\n",
|
||
|
" # fname = join(folder, f\"borg2_{field}_{MAS}_{grid}.npz\")\n",
|
||
|
" # file = numpy.load(fname)\n",
|
||
|
" # dist, mean = file[\"distances\"], file[\"mean\"]\n",
|
||
|
" # for i in range(len(mean)):\n",
|
||
|
" # plt.plot(dist, mean[i], c=cols[2], label=\"BORG\" if i == 0 else None)\n",
|
||
|
"\n",
|
||
|
" # # CSiBORG2 random\n",
|
||
|
" # fname = join(folder, f\"csiborg2_random_{field}_{MAS}_{grid}.npz\")\n",
|
||
|
" # file = numpy.load(fname)\n",
|
||
|
" # dist, mean = file[\"distances\"], file[\"mean\"]\n",
|
||
|
"\n",
|
||
|
" # mu = numpy.mean(mean, axis=0)\n",
|
||
|
" # std = numpy.std(mean, axis=0)\n",
|
||
|
"\n",
|
||
|
" # plt.fill_between(dist, mu - std, mu + std, alpha=1/3, color=cols[1])\n",
|
||
|
"\n",
|
||
|
" # for i in range(len(mean)):\n",
|
||
|
" # plt.plot(dist, mean[i], c=cols[1], label=\"Random\" if i == 0 else None, zorder=0, lw=lw/2)\n",
|
||
|
"\n",
|
||
|
" # Plot settings\n",
|
||
|
" plt.legend(loc=\"lower right\")\n",
|
||
|
" plt.xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
|
||
|
"\n",
|
||
|
" if field == \"radvel\":\n",
|
||
|
" plt.ylabel(r\"$\\langle v_r \\rangle ~ [\\mathrm{km} / s]$\")\n",
|
||
|
" plt.axhline(0, c=\"k\", ls=\"--\",)\n",
|
||
|
" plt.ylim(-0.1, 0.1)\n",
|
||
|
" plt.xscale(\"log\")\n",
|
||
|
" elif field == \"overdensity\":\n",
|
||
|
" plt.ylim(-0.5, 0.5)\n",
|
||
|
" plt.axhline(0, c=\"k\", ls=\"--\",)\n",
|
||
|
" # plt.xlim(0, 200)\n",
|
||
|
" plt.ylabel(r\"$\\langle \\delta_r \\rangle$\")\n",
|
||
|
" # plt.axhline(-0.1, c=\"k\", ls=\"--\")\n",
|
||
|
" elif field == \"density\":\n",
|
||
|
" plt.axhline(277.5 * 0.304, c=\"k\", ls=\"--\",)\n",
|
||
|
" plt.ylim(50, 100)\n",
|
||
|
"\n",
|
||
|
" plt.xlim(0, dist.max())\n",
|
||
|
" # plt.xlim(0, 100)\n",
|
||
|
"\n",
|
||
|
" if to_save:\n",
|
||
|
" fout = join(plt_utils.fout, f\"field_shells_{field}_{MAS}_{grid}.png\")\n",
|
||
|
" print(f\"Saving to `{fout}`.\")\n",
|
||
|
" plt.savefig(fout, dpi=plt_utils.dpi, bbox_inches=\"tight\")\n",
|
||
|
"\n",
|
||
|
" plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 199,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"/tmp/ipykernel_16251/4241837727.py:58: UserWarning: Attempt to set non-positive xlim on a log-scaled axis will be ignored.\n",
|
||
|
" plt.xlim(0, dist.max())\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlcAAAG+CAYAAAC+mCFTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAABnc0lEQVR4nO3deVyU5fo/8M/MwAw7yDqgICgo7igq4r5guJRZeo6Z5ZJHW9RS6pR6SltO6clKMzVP38zsdzLNtEWPx1IUcSFREFcE95VVhGEdhpn5/UFMTcwMDMwKn/frNa/iea7nmWvUmbl47vu5boFarVaDiIiIiExCaO0EiIiIiFoSFldEREREJsTiioiIiMiEWFwR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IiIiITYnFFREREZEIsroiIiIhMiMUVERERkQmxuCIiIiIyIRZXRERERCbE4oqIiIjIhFhcEREREZkQiysiIiIiE2JxRURERGRCLK6IiIiITIjFFREREZEJsbgiIiIiMiEWV0REREQmxOKKiIiIyIRYXBERERGZEIsrIiIiIhNicUVERERkQiyuiIiIiEyIxRURERGRCbG4IiIiIjIhFldEREREJsTiioiIiMiEWFwRERERmRCLKyIiIiITYnFFREREZEIsroiIiIhMiMUVERERkQmxuCIiIiIyIRZXRERERCbE4oqIiIjIhFhcEREREZmQXRdX69evR2hoKJycnBATE4PU1FSD8Tt27EBkZCScnJzQo0cP7N27V2u/QCDQ+Vi1apUmJjQ0tN7+lStXmuX1ERERkf2x2+Jq+/btSEhIwPLly5Geno5evXohPj4e+fn5OuOPHz+OqVOnYvbs2Th9+jQmTpyIiRMn4vz585qYnJwcrccXX3wBgUCASZMmaZ3r7bff1opbsGCBWV8rERER2Q+BWq1WWzuJpoiJiUG/fv2wbt06AIBKpUJwcDAWLFiAxYsX14ufMmUKysvLsWfPHs22AQMGICoqChs3btT5HBMnTkRpaSkSExM120JDQ7Fw4UIsXLiwSXnLZDJ4enqipKQEHh4eTToHERERWZYx3992eeWquroaaWlpiIuL02wTCoWIi4tDSkqKzmNSUlK04gEgPj5eb3xeXh7++9//Yvbs2fX2rVy5Ej4+PujduzdWrVqFmpoavbnK5XLIZDKtBxEREbVcDtZOoCkKCwuhVCoREBCgtT0gIACXLl3SeUxubq7O+NzcXJ3xW7Zsgbu7Ox5//HGt7S+++CL69OkDb29vHD9+HEuWLEFOTg4++ugjnedZsWIF3nrrrca+NCIiIrJzdllcWcIXX3yBadOmwcnJSWt7QkKC5v979uwJsViMZ599FitWrIBEIql3niVLlmgdI5PJEBwcbL7EiYiIyKrssrjy9fWFSCRCXl6e1va8vDxIpVKdx0il0kbHHzlyBFlZWdi+fXuDucTExKCmpgY3btxA586d6+2XSCQ6iy4iIiJqmexyzpVYLEZ0dLTWRHOVSoXExETExsbqPCY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dBQUEN5i2TyeDp6YmSkhJ4eHgY+7KJiIjICoz5/rbLK1fV1dVIS0tDXFycZptQKERcXBxSUlJ0HpOSkqIVDwDx8fH14pOSkuDv74/OnTvj+eefx/3797XO4eXlpSmsACAuLg5CoRAnTpzQ+bxyuRwymUzrQURERC2XXRZXhYWFUCqVCAgI0NoeEBCA3Nxcncfk5uY2GD9mzBh89dVXSExMxL/+9S8cPnwYY8eOhVKp1JzD399f6xwODg7w9vbW+7wrVqyAp6en5hEcHGz06yUiIiL74WDtBGzJE088ofn/Hj16oGfPnujYsSOSkpIwatSoJp1zyZIlSEhI0Pwsk8l
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot_field_shells(\"radvel\", \"SPH\", 1024, False)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Enclosed mass "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "NameError",
|
||
|
"evalue": "name 'a' is not defined",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||
|
"Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43ma\u001b[49m\n",
|
||
|
"\u001b[0;31mNameError\u001b[0m: name 'a' is not defined"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"a"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def plot_enclosed_overdensity(to_save=True):\n",
|
||
|
" with plt.style.context(\"science\"):\n",
|
||
|
" # if True:\n",
|
||
|
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
|
||
|
" fig, axs = plt.subplots(2, 1, sharex=True, figsize=(2 * 3.5, 2 * 1.5 * 2.625), gridspec_kw={\"height_ratios\": [1, 0.8]})\n",
|
||
|
" fig.subplots_adjust(wspace=0, hspace=0)\n",
|
||
|
"\n",
|
||
|
" # CSiBORG2 main\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg2_main.npz\")\n",
|
||
|
" V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
" V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
" rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
" boxsize = csiborgtools.simname2boxsize(\"csiborg2_main\")\n",
|
||
|
"\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
" densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" print(f\"CSiBORG2_main overdensity within 135 Mpc / h: {numpy.mean(density135)} +- {numpy.std(density135)}\")\n",
|
||
|
" print(f\"CSiBORG2_main density of the entire box: {numpy.mean(densitytot)} +- {numpy.std(densitytot)}\")\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" y = numpy.copy(density)\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[0], alpha=0.25, ls=\"dashed\")\n",
|
||
|
" y[i] /= mu\n",
|
||
|
" y[i] -= 1\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[0], label=\"CB2_main\")\n",
|
||
|
" mu2, std2 = numpy.mean(y, axis=0), numpy.std(y, axis=0)\n",
|
||
|
" axs[1].fill_between(dist, mu2 - std2, mu2 + std2, alpha=0.5, color=cols[0])\n",
|
||
|
"\n",
|
||
|
" # CSiBORG2 varysmall\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg2_varysmall.npz\")\n",
|
||
|
" V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
" V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
" rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
" boxsize = csiborgtools.simname2boxsize(\"csiborg2_varysmall\")\n",
|
||
|
"\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
" densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" print(f\"CSiBORG2_varysmall overdensity within 135 Mpc / h: {numpy.mean(density135)} +- {numpy.std(density135)}\")\n",
|
||
|
" print(f\"CSiBORG2_varysmall density of the entire box: {numpy.mean(densitytot)} +- {numpy.std(densitytot)}\")\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" y = numpy.copy(density)\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[2], alpha=0.25, ls=\"dashed\")\n",
|
||
|
" y[i] /= mu\n",
|
||
|
" y[i] -= 1\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[2], label=\"CB2_varysmall\")\n",
|
||
|
" mu2, std2 = numpy.mean(y, axis=0), numpy.std(y, axis=0)\n",
|
||
|
" axs[1].fill_between(dist, mu2 - std2, mu2 + std2, alpha=0.5, color=cols[2])\n",
|
||
|
"\n",
|
||
|
" # CSiBORG2 random\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg2_random.npz\")\n",
|
||
|
" V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
" V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
" rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
" boxsize = csiborgtools.simname2boxsize(\"csiborg2_random\")\n",
|
||
|
"\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
" densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" print(f\"CSiBORG2_random overdensity within 135 Mpc / h: {numpy.mean(density135)} +- {numpy.std(density135)}\")\n",
|
||
|
" print(f\"CSiBORG2_random density of the entire box: {numpy.mean(densitytot)} +- {numpy.std(densitytot)}\")\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[1], alpha=0.5, ls=\"dashed\", zorder=0)\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" std = numpy.std(density, axis=0)\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[1], label=\"CB2_random\", zorder=0)\n",
|
||
|
" axs[0].fill_between(dist, mu - std, mu + std, alpha=1/3, color=cols[1], zorder=0)\n",
|
||
|
"\n",
|
||
|
" # CSiBORG1\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg1.npz\")\n",
|
||
|
" V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
" V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
" rho_mean = 0.307 * 277.53662724583074\n",
|
||
|
" boxsize = csiborgtools.simname2boxsize(\"csiborg1\")\n",
|
||
|
"\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
" densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" print(f\"CSiBORG1 overdensity within 135 Mpc / h: {numpy.mean(density135)} +- {numpy.std(density135)}\")\n",
|
||
|
" print(f\"CSiBORG1 density of the entire box: {numpy.mean(densitytot)} +- {numpy.std(densitytot)}\")\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" y = numpy.copy(density)\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[3], alpha=0.25, ls=\"dashed\", zorder=0.5)\n",
|
||
|
" y[i] /= mu\n",
|
||
|
" y[i] -= 1\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[3], label=\"CB1\", zorder=0.5)\n",
|
||
|
" mu2, std2 = numpy.mean(y, axis=0), numpy.std(y, axis=0)\n",
|
||
|
" axs[1].fill_between(dist, mu2 - std2, mu2 + std2, alpha=0.5, color=cols[3], zorder=0.5)\n",
|
||
|
"\n",
|
||
|
" \n",
|
||
|
" # BORG2\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_borg2.npz\")\n",
|
||
|
" V = d[\"enclosed_volume\"]\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
" density = d[\"enclosed_mass\"] / V / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" y = numpy.copy(density)\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[4], alpha=0.25, ls=\"dashed\", zorder=0.5)\n",
|
||
|
" y[i] /= mu\n",
|
||
|
" y[i] -= 1\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[4], label=\"B2\", zorder=0.5)\n",
|
||
|
" mu2, std2 = numpy.mean(y, axis=0), numpy.std(y, axis=0)\n",
|
||
|
" axs[1].fill_between(dist, mu2 - std2, mu2 + std2, alpha=0.5, color=cols[4], zorder=0.5)\n",
|
||
|
"\n",
|
||
|
" # BORG1\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_borg1.npz\")\n",
|
||
|
" V = d[\"enclosed_volume\"]\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" rho_mean = 0.307 * 277.53662724583074\n",
|
||
|
" density = d[\"enclosed_mass\"] / V / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
" mu = numpy.mean(density, axis=0)\n",
|
||
|
" y = numpy.copy(density)\n",
|
||
|
" for i in range(len(density)):\n",
|
||
|
" axs[0].plot(dist, density[i], c=cols[4], alpha=0.25, ls=\"dashed\", zorder=0.5)\n",
|
||
|
" y[i] /= mu\n",
|
||
|
" y[i] -= 1\n",
|
||
|
" axs[0].plot(dist, mu, c=cols[4], label=\"B2\", zorder=0.5)\n",
|
||
|
" mu2, std2 = numpy.mean(y, axis=0), numpy.std(y, axis=0)\n",
|
||
|
" axs[1].fill_between(dist, mu2 - std2, mu2 + std2, alpha=0.5, color=cols[4], zorder=0.5)\n",
|
||
|
"\n",
|
||
|
" # Plot settings\n",
|
||
|
" axs[0].set_ylim(-0.15, 0.15)\n",
|
||
|
" axs[1].set_ylim(-0.4, 0.4)\n",
|
||
|
" axs[1].set_xlim(-1, dist.max())\n",
|
||
|
" axs[1].set_xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
|
||
|
" axs[0].set_ylabel(r\"$\\delta_r$\")\n",
|
||
|
" axs[1].set_ylabel(r\"$\\delta_r / \\langle \\delta_r \\rangle - 1$\")\n",
|
||
|
"\n",
|
||
|
" axs[0].legend(fontsize=\"small\")\n",
|
||
|
" for i in range(2):\n",
|
||
|
" axs[i].axvline(135, c=\"k\", ls=\"--\")\n",
|
||
|
" fig.tight_layout(h_pad=0)\n",
|
||
|
"\n",
|
||
|
" if to_save:\n",
|
||
|
" fout = join(plt_utils.fout, f\"enclosed_overdensity.png\")\n",
|
||
|
" print(f\"Saving to `{fout}`.\")\n",
|
||
|
" fig.savefig(fout, dpi=plt_utils.dpi, bbox_inches=\"tight\")\n",
|
||
|
"\n",
|
||
|
" fig.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 22,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"CSiBORG2_main overdensity within 135 Mpc / h: -0.04871875932547955 +- 0.00201984793460838\n",
|
||
|
"CSiBORG2_main density of the entire box: -5.9114960471373655e-05 +- 2.4011781815055744e-07\n",
|
||
|
"CSiBORG2_varysmall overdensity within 135 Mpc / h: -0.050013774679444456 +- 7.933447782885623e-05\n",
|
||
|
"CSiBORG2_varysmall density of the entire box: -5.8827166581804094e-05 +- 1.3328610811057487e-07\n",
|
||
|
"CSiBORG2_random overdensity within 135 Mpc / h: 0.006494700117062541 +- 0.03838291159994349\n",
|
||
|
"CSiBORG2_random density of the entire box: -5.874905109742312e-05 +- 4.066696396103268e-07\n",
|
||
|
"CSiBORG1 overdensity within 135 Mpc / h: -0.05300083843550532 +- 0.008948856840208618\n",
|
||
|
"CSiBORG1 density of the entire box: 0.0008964738425259703 +- 8.270101657242762e-07\n",
|
||
|
"Saving to `../plots/enclosed_overdensity.png`.\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot_enclosed_overdensity(True)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# CSiBORG1\n",
|
||
|
"d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg1.npz\")\n",
|
||
|
"V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
"V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
"rho_mean = 0.307 * 277.53662724583074\n",
|
||
|
"boxsize = csiborgtools.simname2boxsize(\"csiborg1\")\n",
|
||
|
"\n",
|
||
|
"dist = d[\"distances\"]\n",
|
||
|
"density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
"density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
"densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"density135_csiborg1 = density135\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# CSiBORG2 main\n",
|
||
|
"d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg2_main.npz\")\n",
|
||
|
"V = 4 / 3 * numpy.pi * d[\"distances\"]**3\n",
|
||
|
"V35 = 4 / 3 * numpy.pi * 135**3\n",
|
||
|
"rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
"boxsize = csiborgtools.simname2boxsize(\"csiborg2_main\")\n",
|
||
|
"\n",
|
||
|
"dist = d[\"distances\"]\n",
|
||
|
"density = d[\"enclosed_mass\"] / V * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
"density135 = d[\"mass135\"] / V35 * 1e-9 / rho_mean - 1\n",
|
||
|
"densitytot = d[\"masstot\"] / boxsize**3 * 1e-9 / rho_mean - 1\n",
|
||
|
"\n",
|
||
|
"density135_csiborg2 = density135"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 39,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"(0.008948856840208618, 0.00201984793460838)"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 39,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"numpy.std(density135_csiborg1), numpy.std(density135_csiborg2)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 41,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"array([15517, 15617, 15717, 15817, 15917, 16017, 16117, 16217, 16317,\n",
|
||
|
" 16417, 16517, 16617, 16717, 16817, 16917, 17017, 17117, 17217,\n",
|
||
|
" 17317, 17417])"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 41,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n",
|
||
|
"paths.get_ics(\"csiborg2_main\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 37,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "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17/W1q1b3VcCPFVFRYUqKircz8vKyprSbQAAGq9kn1R+qPm2FxUvOVKbb3sWaXSIqamp0cSJEzV48GBddNFF7um33nqrunXrppSUFH311VeaOnWqduzYoXfeeUeS5HK5PAKMJPdzl8tV57Zyc3M1Y8aMxnYVAADfKNkn5Q2Sqsqbb5uhUVL2Rq+DjMvl0qxZs7RkyRLt379fiYmJSktL08SJEzVs2DCdc8457tsJBAcHKykpSSNGjNDs2bPVsWNHSdJHH32kOXPmaOPGjSorK1OPHj00efJkjRkzxudlNkajQ0x2dra+/vprffzxxx7Tx48f7/533759lZycrGHDhmnXrl06//zzG7WtadOmKScnx/28rKxMqamkUgBAMys/dDLA3PSC1OkC/2/vp2+ld8ad3K4XIWbPnj0aPHiwHA6HnnzySfXt21dVVVVatmyZsrOz9c0330iSZs6cqXHjxqm6ulrffvutxo8fr/vvv19//vOfJUmffvqp+vXrp6lTpyopKUmLFy/WHXfcodjYWF177bV+KdkbjQoxEyZM0OLFi7Vu3Tp16dLljG3T09MlSYWFhTr//PPldDq1ceNGjzZFRUWSVO84mvDwcIWHhzemqwAA+F6nC6SUtED3ol733XefgoKCtHHjRo8Tb/r06aN77rnH/bxDhw7u797OnTvrzjvv1Guvveae/+CDD3qs94EHHtDy5cv1zjvvtIgQ49Up1sYYTZgwQe+++65Wr16tc88996zL1N6yOzk5WZKUkZGhLVu26ODBg+42K1asUExMjHr37u1NdwAAwC8UFxdr6dKlys7O9ggwtRwOR53L7d+/Xx9++KH74EN9SktLTxsLGyhehZjs7Gz95S9/0cKFC9WhQwe5XC65XC4dO3ZMkrRr1y499thj2rRpk/bs2aMPPvhAd9xxh6688kr169dPknT11Verd+/euv322/Xll19q2bJleuihh5Sdnc3RFgAAmqiwsFDGGPXs2fOsbadOnaro6GhFRkaqS5cuCgoK0tNPP11v+zfeeEOfffaZ7r77bl92udG8CjHPP/+8SktLNXToUCUnJ7sfixYtkiSFhYVp5cqVuvrqq9WzZ09NmjRJo0aN0ocffuheR0hIiBYvXqyQkBBlZGTotttu0x133OFxXRkAANA4xpgGt508ebI2b96sr776SqtWrZIkjRw5UtXV1ae1XbNmje6++2698MIL6tOnj8/62xRejYk52wuTmpqqtWvXnnU93bp101//+ldvNg0AABqgR48eCgoKcg/ePZNOnTqpe/fu7uXmzp2rjIwMrVmzRpmZme52a9eu1XXXXac5c+bojjvu8FvfvcW9kwAAaEXi4uKUlZWlvLw8HT169LT5JSUl9S4bEhIiSe5hItLJ06xHjhypP/zhDx5nILcEhBgAAFqZvLw8VVdXa9CgQXr77be1c+dObd++Xc8884wyMjLc7Q4fPiyXy6UDBw5o48aNmjx5shISEnTZZZdJOvkT0siRI3X//fdr1KhR7rGwxcXFgSrNQ5Ou2AsAQJv007ctejvnnXeevvjiC82aNUuTJk3SgQMHlJCQoAEDBuj55593t5s+fbqmT58uSUpISNDAgQO1fPlyxcfHS5JeeeUVlZeXKzc3V7m5ue7lhgwZoo8++qjxdfkIIQYAgIaKij9
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.hist(density135_csiborg1, bins=\"auto\", histtype=\"step\", label=\"CB1\", density=True)\n",
|
||
|
"plt.hist(density135_csiborg2, bins=\"auto\", histtype=\"step\", label=\"CB2\", density=True)\n",
|
||
|
"\n",
|
||
|
"plt.legend()\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 29,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"array([[0. , 0. , 0. ],\n",
|
||
|
" [0.11111111, 0.11111111, 0.11111111],\n",
|
||
|
" [0.22222222, 0.22222222, 0.22222222],\n",
|
||
|
" [0.33333333, 0.33333333, 0.33333333],\n",
|
||
|
" [0.44444444, 0.44444444, 0.44444444],\n",
|
||
|
" [0.55555556, 0.55555556, 0.55555556],\n",
|
||
|
" [0.66666667, 0.66666667, 0.66666667],\n",
|
||
|
" [0.77777778, 0.77777778, 0.77777778],\n",
|
||
|
" [0.88888889, 0.88888889, 0.88888889],\n",
|
||
|
" [1. , 1. , 1. ]])"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 29,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"x = numpy.linspace(0, 1, 10)\n",
|
||
|
"numpy.vstack([x, x, x]).T"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_borg2.npz\")\n",
|
||
|
"V = d[\"enclosed_volume\"]\n",
|
||
|
"dist = d[\"distances\"]\n",
|
||
|
"rho_mean = 0.3111 * 277.53662724583074\n",
|
||
|
"density = d[\"enclosed_mass\"] / V / rho_mean - 1"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Bulk flow"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 118,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def process_bulkflow_amplitude(cumulative_velocity, subtract_observer):\n",
|
||
|
" if isinstance(subtract_observer, bool):\n",
|
||
|
" if subtract_observer:\n",
|
||
|
" subtract_observer = 0\n",
|
||
|
" else:\n",
|
||
|
" return numpy.linalg.norm(cumulative_velocity, axis=-1)\n",
|
||
|
"\n",
|
||
|
" if not isinstance(subtract_observer, int):\n",
|
||
|
" raise TypeError(\"Incorrect type for `subtract_observer`.\")\n",
|
||
|
"\n",
|
||
|
" for i in range(len(cumulative_velocity)):\n",
|
||
|
" for j in range(3):\n",
|
||
|
" cumulative_velocity[i, :, j] -= cumulative_velocity[i, subtract_observer, j]\n",
|
||
|
"\n",
|
||
|
" return numpy.linalg.norm(cumulative_velocity, axis=-1)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"def plot_bulkflow_amplitude(subtract_observer=False, to_save=True):\n",
|
||
|
" with plt.style.context(\"science\"):\n",
|
||
|
" # if True:\n",
|
||
|
" plt.figure()\n",
|
||
|
"\n",
|
||
|
" # CSiBORG2 main\n",
|
||
|
" d = numpy.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_shells/enclosed_mass_csiborg2_main.npz\")\n",
|
||
|
" dist = d[\"distances\"]\n",
|
||
|
" cumulative_velocity = d[\"cumulative_velocity\"]\n",
|
||
|
" cumulative_velocity_amplitude = process_bulkflow_amplitude(cumulative_velocity, subtract_observer)\n",
|
||
|
"\n",
|
||
|
" for i in range(len(cumulative_velocity_amplitude)):\n",
|
||
|
" plt.plot(dist, cumulative_velocity_amplitude[i], c=\"C0\", alpha=0.25, ls=\"dashed\")\n",
|
||
|
" plt.plot(dist, numpy.mean(cumulative_velocity_amplitude, axis=0), c=\"C0\", label=\"CSiBORG2\")\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" plt.axvline(135, c=\"k\", ls=\"--\")\n",
|
||
|
" plt.xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
|
||
|
" plt.ylabel(r\"$\\langle U \\rangle ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
|
||
|
" plt.legend()\n",
|
||
|
"\n",
|
||
|
" if to_save:\n",
|
||
|
" fout = join(plt_utils.fout, f\"enclosed_flow.png\")\n",
|
||
|
" print(f\"Saving to `{fout}`.\")\n",
|
||
|
" plt.savefig(fout, dpi=plt_utils.dpi, bbox_inches=\"tight\")\n",
|
||
|
"\n",
|
||
|
" plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 119,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Saving to `../plots/enclosed_flow.png`.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAUYAAAD4CAYAAACQYE9BAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAA3DUlEQVR4nO3de3xcdZ34/9eZWzK5TpLe09J20pZCKaVJqqyKIp2CixKUJrBZXdddaAIr+9vFS0Pd/e6qX4UmILreIIGv7n5VYptQBV1WybSICFRyaQttoZdMb6TXZHJynfuc3x9h5pvLNE3aJGeSeT8fDx4685kz5z2nM+98Pp/zuSiapmkIIYSIMugdgBBCxBtJjEIIMYwkRiGEGMakdwATZdWqVeTl5V3ydW1tbeTm5l7WOS73WD3OeSXHTsU5vV4vJ06cYPHixSQnJ0/ZeSfquOl4rMQbW2trKwcOHBj6pDZD3HHHHRP6uok8Vo9zXsmxU3HO5uZmDdCam5un9LwTddx0PFbiHftrpSk9DqWlpVN6nJ7H6nFOPY7V4xpd6Xmn2/dQj3NecbyXnZLjzFTUGBPFVFyjQ4cOaR/72Me0Q4cOTfq5Jot8l8Ym3q9TrPhmTB/jWOlVQ5hOpuIarVixgj/84Q+Tfp7JJN+lsZmO10nRtJkxwLuoqIgXXnhB7zDEGIXDYQKBAGazGYNBenSEfmLlDvlGCl3s3buX5ORk9u7dq3coQowwYxJjW1sbRUVF1NbW6h2KEGIaqK2tpaioiLa2thFlM6aPMTc3V5rSQogxKy0tpbS0lKKiohFlM6bGOB4ef5DjF3oJhcN6hyKEiEMJmRgDIY1T7X14/CG9QxFCxKEZ05QejxSLEQCPP0RaslnnaBLTddddx6lTp5gzZ47eoQgxQkImRpPRgNlkoN8X1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1+znV58QfDWKRJPWVWrlxJc3MzK1eu1DsUkaBKS0spLS2lqKhoRNmMSYzjEQqHudDjAwVCoRD9vqDcmZ5iKSkpMhVQxK0Z05QeD6PBwFWzUggGw/R6gwRCYQIyyHtKnTx5ki9+8YucPHlS71CEGCEhE+PuIxd44rcHuWFpNrMzrGSmWEiSZvSUam9v58c//jHt7e16hyLECAmZGAPBMLWvHSfDaibZYkBRGPMeG0KImS8hs8HapVlkpVr41ZunQNMIhTQ6er3Ms6XoHZoQIg4kZI0x2WzkhiVZ7DvRSY8vwMmOPt4+2al3WEKIOJGQiTEUhkU5qXR7AqRYjJxq72PfCUmMU2nOnDk89NBDzJkzR+9QhBhhyprS9fX1uN3u6NaIkX0aXC4X9fX12O12XC5XdMnzS5VdCX8whDXJSGqSiQvdfpJNBs52eq74fcXYLVy4kCeeeELvMISIaUoSY2STms2bN+NyudiwYUM0MZaUlEQ3zlZVlZKSkuheEaOVXQmLycjKBZnkzU3j8JlulsxORe314QuESDLL3emp0Nvby9tvv83q1atJS0vTOxwhhpiSpnRFRQWbN28GBvbCjSS74TuL2Ww2mpqaUFV11LIrZTIqFNpzWLMkC28gTFqSGU2B9m7vFb+3GJvDhw/zoQ99iMOHD+sdihAjTHpijCQ4p9OJ0+mkoqIiuq1jZFexwbKzs2lqahq17Er1eoN09Pi5cflsstMsmIwGQiGN9h7fFb+3EGL6m/SmdKSWZ7fbsdvtFBYWUlBQQGtra8zan81mQ1XVUctiiSwiERGZBxlLWrIJi9nAVbNSWTI7jdOd/Vw1OwW13385H1EIMY3U1tYOWWxGl0Uk7HY7NpsNu90ODCQ3t9tNS0tLzBspqqpis9lGLYtlPItIGA0GjAaFrv4gmqZxutNDW0c/rjM9fOzaeWP9aEKIaWh4pSnWIhKT3pS22+0janmRx4WFhdFmdYTb7Y7
|
||
|
"text/plain": [
|
||
|
"<Figure size 350x262.5 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plot_bulkflow_amplitude(False, True)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"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
|
||
|
}
|