mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-23 07:58:03 +00:00
482 lines
173 KiB
Text
482 lines
173 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Copyright (C) 2024 Richard Stiskalek\n",
|
||
|
"# This program is free software; you can redistribute it and/or modify it\n",
|
||
|
"# under the terms of the GNU General Public License as published by the\n",
|
||
|
"# Free Software Foundation; either version 3 of the License, or (at your\n",
|
||
|
"# option) any later version.\n",
|
||
|
"#\n",
|
||
|
"# This program is distributed in the hope that it will be useful, but\n",
|
||
|
"# WITHOUT ANY WARRANTY; without even the implied warranty of\n",
|
||
|
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\n",
|
||
|
"# Public License for more details.\n",
|
||
|
"#\n",
|
||
|
"# You should have received a copy of the GNU General Public License along\n",
|
||
|
"# with this program; if not, write to the Free Software Foundation, Inc.,\n",
|
||
|
"# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n",
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from corner import corner\n",
|
||
|
"from getdist import plots\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"from reconstruction_comparison import *\n",
|
||
|
"\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2\n",
|
||
|
"%matplotlib inline\n",
|
||
|
"\n",
|
||
|
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### $\\log Z$ and BIC for simulations/catalogues"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sims = [\"Carrick2015\", \"Lilow2024\", \"CF4\", \"CF4gp\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"\n",
|
||
|
"for catalogue in catalogues:\n",
|
||
|
" y_lnZ = np.asarray([get_gof(\"lnZ\", sim, catalogue) for sim in sims])\n",
|
||
|
" y_lnZ -= y_lnZ.min()\n",
|
||
|
" y_BIC = np.asarray([get_gof(\"BIC\", sim, catalogue) for sim in sims])\n",
|
||
|
" y_BIC -= y_BIC.min()\n",
|
||
|
"\n",
|
||
|
" fig, ax_left = plt.subplots()\n",
|
||
|
" fig.suptitle(f\"{catalogue}\")\n",
|
||
|
" ax_right = ax_left.twinx()\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ax_left.plot(np.arange(len(sims)), y_lnZ, 'bo')\n",
|
||
|
" ax_right.plot(np.arange(len(sims)), y_BIC, 'rx')\n",
|
||
|
"\n",
|
||
|
" # y-ticks\n",
|
||
|
" ax_left.set_ylabel(r\"$\\Delta \\log \\mathcal{Z}$\", color=\"blue\")\n",
|
||
|
" ax_left.tick_params(axis='y', labelcolor=\"blue\")\n",
|
||
|
" ax_right.set_ylabel(r\"$\\Delta \\mathrm{BIC}$\", color=\"red\")\n",
|
||
|
" ax_right.tick_params(axis='y', labelcolor=\"red\")\n",
|
||
|
"\n",
|
||
|
" ax_left.set_xticks(np.arange(len(sims)), simname_to_pretty(sims), rotation=35)\n",
|
||
|
" fig.tight_layout()\n",
|
||
|
" fig.savefig(f\"../../plots/GOF_{catalogue}.png\", dpi=450)\n",
|
||
|
" fig.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Setting $\\beta = 1$?"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sims = [\"Lilow2024\", \"CF4\", \"CF4gp\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"\n",
|
||
|
"for catalogue in catalogues:\n",
|
||
|
" y_lnZ = [get_gof(\"lnZ\", sim, catalogue, sample_beta=True) - get_gof(\"lnZ\", sim, catalogue, sample_beta=False) for sim in sims]\n",
|
||
|
" y_BIC = [get_gof(\"BIC\", sim, catalogue, sample_beta=True) - get_gof(\"BIC\", sim, catalogue, sample_beta=False) for sim in sims]\n",
|
||
|
"\n",
|
||
|
" fig, ax_left = plt.subplots()\n",
|
||
|
" fig.suptitle(rf\"{catalogue} (higher signifies preference for $\\beta = 1$)\")\n",
|
||
|
" ax_right = ax_left.twinx()\n",
|
||
|
"\n",
|
||
|
" ax_left.plot(np.arange(len(sims)), y_lnZ, 'bo')\n",
|
||
|
" ax_right.plot(np.arange(len(sims)), y_BIC, 'rx')\n",
|
||
|
"\n",
|
||
|
" # y-ticks\n",
|
||
|
" ax_left.set_ylabel(r\"$\\log \\mathcal{Z}_{\\beta} - \\log \\mathcal{Z}_{\\beta = 1}$\", color=\"blue\")\n",
|
||
|
" ax_left.tick_params(axis='y', labelcolor=\"blue\")\n",
|
||
|
" ax_right.set_ylabel(r\"$\\mathrm{BIC}_{\\beta} - \\mathrm{BIC}_{\\beta = 1}$\", color=\"red\")\n",
|
||
|
" ax_right.tick_params(axis='y', labelcolor=\"red\")\n",
|
||
|
"\n",
|
||
|
" ax_left.set_xticks(np.arange(len(sims)), simname_to_pretty(sims), rotation=35)\n",
|
||
|
" ax_left.axhline(0, color=\"black\", linestyle=\"--\", linewidth=1)\n",
|
||
|
" fig.tight_layout()\n",
|
||
|
" fig.savefig(f\"../../plots/GOF_beta_{catalogue}.png\", dpi=450)\n",
|
||
|
" fig.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### What $\\beta$ is preferred by the data? "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 30,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHWCAYAAAARl3+JAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAABq7UlEQVR4nO3de1yTdf8/8NdgAwYbMERjKIp41jzkMTVTuy3zdONdvzsrM+1gWh4xz5VS3XdkZZjVV81KzE56l0q3Zt1p4vlQFmaeU1GQeWScN2Ds+v2BmwwGbLDt2uH1fDz2uN21a7veyI28+lyfz/sjEQRBABERERF5ND+xCyAiIiKihmOoIyIiIvICDHVEREREXoChjoiIiMgLMNQREREReQGGOiIiIiIvwFBHRERE5AUY6oiIiIi8AEMdERERkRdgqCMij5GRkQGJRIKUlBTzscTEREgkEvGKIiJyEwx1ROQ2UlJSIJFI8Ouvv4pdisOdOnUKc+fORbdu3aBUKqFWqzFixAibvtb7778fEokEU6dOdUGlROSppGIXQERkqxYtWkCn00Emk4ldit0+/vhjfPLJJ3j44YfxwgsvIC8vD6tWrcLdd9+NH374AUOGDLH6vo0bN+LAgQMurpaIPBFH6ojIY0gkEgQFBcHf31/sUiwkJiYiNja21nMee+wxZGZm4uOPP8Zzzz2HOXPm4NChQ4iIiEBiYqLV9+j1erz44ouYN2+e44smIq/DUEdEHsPanDprDAYDXn/9dbRq1QqBgYGIjY3FwoULUVJSYj5n1qxZaNSoEQRBMB+bNm0aJBIJli9fbj529epVSCQSrFixokG19+jRAwqFwuJYo0aNMGDAAJw8edLqe9566y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MHnyZBw6dAjvv/8+OnbsiJs3b2L//v24efMmgIoFBPfffz/atWuHjRs3Qq1WIysrC9u2bUNubm5Dv2yfw1BHREQkktZNFLizaZjYZdhl2bJlOHDgAH7//Xd07doVANCiRQt8++236NOnD5555hn8+eefkEgk+O677/Dee+9h+PDhAIDY2Fj06NHD/FnHjx/HuXPnsGPHDrRo0cL8Wf3793f9F+YFuFCCiERTkKNHQY5e7DKIyA5ffvkl7r//fnOgM/Hz80NCQgJOnDiBo0ePAgCioqLw/fffo6CgwOpnNW7cGH5+fvjmm2/MrV+o/hjqiEgUBTl6fJl4EF8mHmSwI/IgZ86cQYcOHay+Zjp+5swZAMBHH32E/fv3o1GjRujVqxcSEhKwb98+8/lNmzbF8uXLsWjRIqhUKtx33314/fXXcf78eed/IV6IoY6IRKHVFMFQaoSh1Ah9oWsacxKRYwiCYNN59957L86fP48dO3bg//2//4fjx49jwIABeP31183nTJkyBVeuXMEXX3yBvn374j//+Q86deqEn376yVnley2GOiJyuYIcPbatOmZ+vuGNX3D9kvXbM0TkXtq2bYuTJ09afc10vG3btuZjMpkMAwYMwLx58/C///0Pr732Gl5//XWUlt5u56JUKjFq1Cj8+9//xtGjRzFgwAD861//cu4X4oUY6ojI5fSFZTCUGnH36DjzMYY6Is/w6KOPYvv27eZ5cyZGoxHJycno2LFjtfl2lXXs2BEGgwF6vfVpFxKJBO3bt0dRUZFD6/YFXP1KRKKRK7gXJpE7y8vLQ3p6usWxJ554AqmpqRg1apRFS5M33ngDJ0+exPbt283bYw0aNAiPPfYYevbsiUaNGuHEiRNYuHAhBg8ejNDQUKSnp2Px4sUYN24cOnbsiICAAOzatQuffvop5s2bJ8JX7NlEDXWxsbG4ePFiteMvvPACPvzwQxEqIiIicp2/rhW69XXS0tJ
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# sims = [\"Lilow2024\", \"CF4\", \"CF4gp\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"sims = [\"Lilow2024\"]\n",
|
||
|
"catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"key = \"beta\"\n",
|
||
|
"\n",
|
||
|
"for sim in sims:\n",
|
||
|
" plt.figure()\n",
|
||
|
" plt.title(simname_to_pretty(sim))\n",
|
||
|
"\n",
|
||
|
" for catalogue in catalogues:\n",
|
||
|
" beta = get_samples(sim, catalogue)[key]\n",
|
||
|
" plt.hist(beta, bins=\"auto\", histtype=\"step\", label=catalogue, density=1)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" plt.xlabel(names_to_latex([key], True)[0])\n",
|
||
|
" plt.ylabel(\"Normalized PDF\")\n",
|
||
|
" # plt.xlim(0., 1.5)\n",
|
||
|
" plt.legend()\n",
|
||
|
"\n",
|
||
|
" plt.tight_layout()\n",
|
||
|
" plt.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Flow | catalogue"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"params = [\"Vmag\", \"beta\", \"sigma_v\"]\n",
|
||
|
"\n",
|
||
|
"for catalogue in catalogues:\n",
|
||
|
" X = [samples_to_getdist(get_samples(sim, catalogue), sim)\n",
|
||
|
" for sim in sims]\n",
|
||
|
"\n",
|
||
|
" g = plots.get_subplot_plotter()\n",
|
||
|
" g.settings.figure_legend_frame = False\n",
|
||
|
" g.settings.alpha_filled_add = 0.75\n",
|
||
|
"\n",
|
||
|
" g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n",
|
||
|
" plt.gcf().suptitle(f'{catalogue}', y=1.025)\n",
|
||
|
" plt.gcf().tight_layout()\n",
|
||
|
" plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Flow | simulation"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"catalogues = [\"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"params = [\"Vmag\", \"beta\", \"sigma_v\"]\n",
|
||
|
"\n",
|
||
|
"for sim in sims:\n",
|
||
|
" X = [samples_to_getdist(get_samples(sim, catalogue), sim, catalogue)\n",
|
||
|
" for catalogue in catalogues]\n",
|
||
|
"\n",
|
||
|
" g = plots.get_subplot_plotter()\n",
|
||
|
" g.settings.figure_legend_frame = False\n",
|
||
|
" g.settings.alpha_filled_add = 0.75\n",
|
||
|
"\n",
|
||
|
" g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n",
|
||
|
" plt.gcf().suptitle(f'{sim}', y=1.025)\n",
|
||
|
" plt.gcf().tight_layout()\n",
|
||
|
" plt.gcf().savefig(f\"../../plots/calibration_{sim}.png\", dpi=500, bbox_inches='tight')\n",
|
||
|
" plt.gcf().show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Stacking vs marginalising CB boxes\n",
|
||
|
"\n",
|
||
|
"#### $V_{\\rm ext}$"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sim = \"csiborg2X\"\n",
|
||
|
"catalogue = \"2MTF\"\n",
|
||
|
"key = \"Vext\"\n",
|
||
|
"\n",
|
||
|
"X = [get_samples(sim, catalogue, nsim=nsim, convert_Vext_to_galactic=False)[key] for nsim in range(20)]\n",
|
||
|
"Xmarg = get_samples(sim, catalogue, convert_Vext_to_galactic=False)[key]\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharey=True)\n",
|
||
|
"fig.suptitle(f\"{simname_to_pretty(sim)}, {catalogue}\")\n",
|
||
|
"fig.subplots_adjust(wspace=0.0, hspace=0)\n",
|
||
|
"\n",
|
||
|
"for i in range(3):\n",
|
||
|
" for n in range(20):\n",
|
||
|
" axs[i].hist(X[n][:, i], bins=\"auto\", alpha=0.25, histtype='step',\n",
|
||
|
" color='black', linewidth=0.5, density=1, zorder=0,\n",
|
||
|
" label=\"Individual box\" if (n == 0 and i == 0) else None)\n",
|
||
|
"\n",
|
||
|
"axs[i].hist(np.hstack([X[n][:, i] for n in range(20)]), bins=\"auto\",\n",
|
||
|
" histtype='step', color='blue', density=1,\n",
|
||
|
" label=\"Stacked individual boxes\" if i == 0 else None)\n",
|
||
|
"axs[i].hist(Xmarg[:, i], bins=\"auto\", histtype='step', color='red',\n",
|
||
|
" density=1, label=\"Marginalised boxes\" if i == 0 else None)\n",
|
||
|
" \n",
|
||
|
"axs[0].legend(fontsize=\"small\", loc='upper left', frameon=False)\n",
|
||
|
"\n",
|
||
|
"axs[0].set_xlabel(r\"$V_{\\mathrm{ext}, x} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
|
||
|
"axs[1].set_xlabel(r\"$V_{\\mathrm{ext}, y} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
|
||
|
"axs[2].set_xlabel(r\"$V_{\\mathrm{ext}, z} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
|
||
|
"axs[0].set_ylabel(\"Normalized PDF\")\n",
|
||
|
"fig.tight_layout()\n",
|
||
|
"fig.savefig(f\"../../plots/consistency_{sim}_{catalogue}_{key}.png\", dpi=450)\n",
|
||
|
"fig.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"#### $\\beta$ and others"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "FileNotFoundError",
|
||
|
"evalue": "[Errno 2] Unable to synchronously open file (unable to open file: name = '/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_LOSS_ksmooth0_nsim1_sample_beta.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
||
|
"Cell \u001b[0;32mIn[28], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m catalogue \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLOSS\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 3\u001b[0m key \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbeta\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 5\u001b[0m X \u001b[38;5;241m=\u001b[39m \u001b[43m[\u001b[49m\u001b[43mget_samples\u001b[49m\u001b[43m(\u001b[49m\u001b[43msim\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcatalogue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnsim\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnsim\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconvert_Vext_to_galactic\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mnsim\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mrange\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m20\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 6\u001b[0m Xmarg \u001b[38;5;241m=\u001b[39m get_samples(sim, catalogue, convert_Vext_to_galactic\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)[key]\n\u001b[1;32m 9\u001b[0m plt\u001b[38;5;241m.\u001b[39mfigure()\n",
|
||
|
"Cell \u001b[0;32mIn[28], line 5\u001b[0m, in \u001b[0;36m<listcomp>\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 2\u001b[0m catalogue \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLOSS\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 3\u001b[0m key \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbeta\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m----> 5\u001b[0m X \u001b[38;5;241m=\u001b[39m [\u001b[43mget_samples\u001b[49m\u001b[43m(\u001b[49m\u001b[43msim\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcatalogue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnsim\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnsim\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconvert_Vext_to_galactic\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m[key] \u001b[38;5;28;01mfor\u001b[39;00m nsim \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m20\u001b[39m)]\n\u001b[1;32m 6\u001b[0m Xmarg \u001b[38;5;241m=\u001b[39m get_samples(sim, catalogue, convert_Vext_to_galactic\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)[key]\n\u001b[1;32m 9\u001b[0m plt\u001b[38;5;241m.\u001b[39mfigure()\n",
|
||
|
"File \u001b[0;32m~/csiborgtools/notebooks/flow/reconstruction_comparison.py:142\u001b[0m, in \u001b[0;36mget_samples\u001b[0;34m(simname, catalogue, ksmooth, nsim, sample_beta, convert_Vext_to_galactic)\u001b[0m\n\u001b[1;32m 140\u001b[0m fname \u001b[38;5;241m=\u001b[39m get_fname(simname, catalogue, ksmooth, nsim, sample_beta)\n\u001b[1;32m 141\u001b[0m samples \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m--> 142\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mFile\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 143\u001b[0m grp \u001b[38;5;241m=\u001b[39m f[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msamples\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 144\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m grp\u001b[38;5;241m.\u001b[39mkeys():\n",
|
||
|
"File \u001b[0;32m~/csiborgtools/venv_csiborg/lib/python3.11/site-packages/h5py/_hl/files.py:562\u001b[0m, in \u001b[0;36mFile.__init__\u001b[0;34m(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, fs_strategy, fs_persist, fs_threshold, fs_page_size, page_buf_size, min_meta_keep, min_raw_keep, locking, alignment_threshold, alignment_interval, meta_block_size, **kwds)\u001b[0m\n\u001b[1;32m 553\u001b[0m fapl \u001b[38;5;241m=\u001b[39m make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0,\n\u001b[1;32m 554\u001b[0m locking, page_buf_size, min_meta_keep, min_raw_keep,\n\u001b[1;32m 555\u001b[0m alignment_threshold\u001b[38;5;241m=\u001b[39malignment_threshold,\n\u001b[1;32m 556\u001b[0m alignment_interval\u001b[38;5;241m=\u001b[39malignment_interval,\n\u001b[1;32m 557\u001b[0m meta_block_size\u001b[38;5;241m=\u001b[39mmeta_block_size,\n\u001b[1;32m 558\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwds)\n\u001b[1;32m 559\u001b[0m fcpl \u001b[38;5;241m=\u001b[39m make_fcpl(track_order\u001b[38;5;241m=\u001b[39mtrack_order, fs_strategy\u001b[38;5;241m=\u001b[39mfs_strategy,\n\u001b[1;32m 560\u001b[0m fs_persist\u001b[38;5;241m=\u001b[39mfs_persist, fs_threshold\u001b[38;5;241m=\u001b[39mfs_threshold,\n\u001b[1;32m 561\u001b[0m fs_page_size\u001b[38;5;241m=\u001b[39mfs_page_size)\n\u001b[0;32m--> 562\u001b[0m fid \u001b[38;5;241m=\u001b[39m \u001b[43mmake_fid\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muserblock_size\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfapl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfcpl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mswmr\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mswmr\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 564\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(libver, \u001b[38;5;28mtuple\u001b[39m):\n\u001b[1;32m 565\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_libver \u001b[38;5;241m=\u001b[39m libver\n",
|
||
|
"File \u001b[0;32m~/csiborgtools/venv_csiborg/lib/python3.11/site-packages/h5py/_hl/files.py:235\u001b[0m, in \u001b[0;36mmake_fid\u001b[0;34m(name, mode, userblock_size, fapl, fcpl, swmr)\u001b[0m\n\u001b[1;32m 233\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m swmr \u001b[38;5;129;01mand\u001b[39;00m swmr_support:\n\u001b[1;32m 234\u001b[0m flags \u001b[38;5;241m|\u001b[39m\u001b[38;5;241m=\u001b[39m h5f\u001b[38;5;241m.\u001b[39mACC_SWMR_READ\n\u001b[0;32m--> 235\u001b[0m fid \u001b[38;5;241m=\u001b[39m \u001b[43mh5f\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfapl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfapl\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mr+\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[1;32m 237\u001b[0m fid \u001b[38;5;241m=\u001b[39m h5f\u001b[38;5;241m.\u001b[39mopen(name, h5f\u001b[38;5;241m.\u001b[39mACC_RDWR, fapl\u001b[38;5;241m=\u001b[39mfapl)\n",
|
||
|
"File \u001b[0;32mh5py/_objects.pyx:54\u001b[0m, in \u001b[0;36mh5py._objects.with_phil.wrapper\u001b[0;34m()\u001b[0m\n",
|
||
|
"File \u001b[0;32mh5py/_objects.pyx:55\u001b[0m, in \u001b[0;36mh5py._objects.with_phil.wrapper\u001b[0;34m()\u001b[0m\n",
|
||
|
"File \u001b[0;32mh5py/h5f.pyx:102\u001b[0m, in \u001b[0;36mh5py.h5f.open\u001b[0;34m()\u001b[0m\n",
|
||
|
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] Unable to synchronously open file (unable to open file: name = '/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_LOSS_ksmooth0_nsim1_sample_beta.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sim = \"csiborg2_main\"\n",
|
||
|
"catalogue = \"Pantheon+\"\n",
|
||
|
"key = \"beta\"\n",
|
||
|
"\n",
|
||
|
"X = [get_samples(sim, catalogue, nsim=nsim, convert_Vext_to_galactic=False)[key] for nsim in range(20)]\n",
|
||
|
"Xmarg = get_samples(sim, catalogue, convert_Vext_to_galactic=False)[key]\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plt.figure()\n",
|
||
|
"plt.title(f\"{simname_to_pretty(sim)}, {catalogue}\")\n",
|
||
|
"for n in range(20):\n",
|
||
|
" plt.hist(X[n], bins=\"auto\", alpha=0.25, histtype='step',\n",
|
||
|
" color='black', linewidth=0.5, density=1, zorder=0,\n",
|
||
|
" label=\"Individual box\" if n == 0 else None)\n",
|
||
|
"\n",
|
||
|
"plt.hist(np.hstack([X[n] for n in range(20)]), bins=\"auto\",\n",
|
||
|
" histtype='step', color='blue', density=1,\n",
|
||
|
" label=\"Stacked individual boxes\")\n",
|
||
|
"plt.hist(Xmarg, bins=\"auto\", histtype='step', color='red',\n",
|
||
|
" density=1, label=\"Marginalised boxes\")\n",
|
||
|
"\n",
|
||
|
"plt.legend(fontsize=\"small\", frameon=False, loc='upper left', ncols=3)\n",
|
||
|
"plt.xlabel(names_to_latex([key], True)[0])\n",
|
||
|
"plt.ylabel(\"Normalized PDF\")\n",
|
||
|
"\n",
|
||
|
"plt.tight_layout()\n",
|
||
|
"plt.savefig(f\"../../plots/consistency_{sim}_{catalogue}_{key}.png\", dpi=450)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### SN/TFR Calibration consistency"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
|
||
|
"catalogues = [\"Pantheon+\"]\n",
|
||
|
"sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n",
|
||
|
"\n",
|
||
|
"for catalogue in catalogues:\n",
|
||
|
" X = [samples_to_getdist(get_samples(sim, catalogue), sim)\n",
|
||
|
" for sim in sims]\n",
|
||
|
"\n",
|
||
|
" if \"Pantheon+\" in catalogue or catalogue in [\"Foundation\", \"LOSS\"]:\n",
|
||
|
" params = [\"alpha_cal\", \"beta_cal\", \"mag_cal\", \"e_mu\"]\n",
|
||
|
" else:\n",
|
||
|
" params = [\"aTF\", \"bTF\", \"e_mu\"]\n",
|
||
|
"\n",
|
||
|
" g = plots.get_subplot_plotter()\n",
|
||
|
" g.settings.figure_legend_frame = False\n",
|
||
|
" g.settings.alpha_filled_add = 0.75\n",
|
||
|
"\n",
|
||
|
" g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n",
|
||
|
" plt.gcf().suptitle(f'{catalogue}', y=1.025)\n",
|
||
|
" plt.gcf().tight_layout()\n",
|
||
|
" # plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Bulk flow in the CMB rest frame"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 55,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"sim = \"Lilow2024\"\n",
|
||
|
"catalogue = \"LOSS\"\n",
|
||
|
"\n",
|
||
|
"r, B = get_bulkflow(sim, catalogue, convert_to_galactic=True, simulation_only=True)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 56,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAABdEAAAHvCAYAAAC7apbEAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3wUdf7H8dfsbnY3PQTSgFBCr+IhKqKIghRRQTnLnZ5w2E4Dp2L3p6h4J3eed+oph+UQPBW7WFBRFEERsFAU6T2UNEp62zK/P+KuxCSkkGQ34f18PPZx7sx3Zj6TcJmd937n+zVM0zQREREREREREREREZFKLIEuQEREREREREREREQkWClEFxERERERERERERGphkJ0EREREREREREREZFqKEQXEREREREREREREamGQnQRERERERERERERkWooRBcRERERERERERERqYZCdBERERERERERERGRaihEFxERERERERERERGphkJ0EREREREREREREZFqKEQXERERkUY1bNgwhg0b5n+/e/duDMNg3rx5/mWTJk0iIiKi6YtrYPPmzcMwDHbv3h3oUqr169+HiIiIiIgcm0J0EREREalgx44d3HDDDaSkpOB0OomKimLIkCE8+eSTFBcXB7q841ZUVMSDDz7I0qVLA11Ki/TII4/w7rvv1qqt7wuVxx57rMa2X3/9NRdffDEJCQk4HA46derEDTfcQFpaWpXtly9fzpgxY2jXrh1Op5MOHTpw4YUXMn/+/ArtCgoKeOCBB+jbty/h4eG0bt2aAQMGcPPNN3PgwIFanYeIiIiItGy2QBcgIiIiIsHjww8/5NJLL8XhcHD11VfTt29fysrKWL58OXfccQcbNmzgueeeO65jdOzYkeLiYkJCQhqo6ropKirioYceAjghe2R/+umnjbr/Rx55hN/+9reMHz++wfb51FNPcfPNN5OSksLUqVNJSkpi06ZN/Pe//+X111/no48+4owzzvC3f/PNN7n88sv9YXirVq3YtWsXX375Jc8//zy///3vAXC5XAwdOpTNmzczceJEpk6dSkFBARs2bGD+/PlcfPHFtG3btsHOQ0RERESaJ4XoIiIiIgLArl27uOKKK+jYsSNLliwhKSnJvy41NZXt27fz4YcfHvdxDMPA6XQe93583G43Xq8Xu93eYPtsyZrbz+nrr7/mlltu4cwzz2TRokWEhYX51914440MGTKE3/72t2zYsIFWrVoB8OCDD9K7d29WrVpV6XyzsrL8//3uu++ydu1aXnnlFX+w7lNSUkJZWVkjnpmIiIiINBcazkVEREREAHj00UcpKChgzpw5FQJ0n65du3LzzTf738+dO5dzzz2X+Ph4HA4HvXv3Zvbs2TUep6ox0X127tzJqFGjCA8Pp23btsyYMQPTNCtt+9hjj/HEE0/QpUsXHA4HGzdupKysjOnTpzNw4ECio6MJDw/nrLPO4osvvqiwf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c8/vjjtZ5gs76qGnv85ZdfZtKkSYwfP5477riD+Ph4rFYrM2fO9E8geSy+mm+//XZGjRpVZZuqwuv6uOyyy1ixYgV33HEHAwYMICIiAq/Xy+jRo+v1s2uI34fVaq1yuXnUxK7//Oc/mTRpEu+99x6ffvopf/7zn5k5cyarVq065tjj9dW1a1dsNhs//vhjtW1KS0vZsmULp5xySpXrw8LCOOusszjrrLNo06YNDz30EB9//DETJ06s1LZjx45MnjyZiy++mJSUFF555RX+8pe/NNj5iIiIiEjzpBBdRERERAC44IILeO6551i5ciWDBw8+ZtsPPviA0tJS3n///Qo9mL/44ot6H9/r9bJ
|
||
|
"text/plain": [
|
||
|
"<Figure size 1500x500 with 3 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharex=True)\n",
|
||
|
"cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
|
||
|
"fig.suptitle(f\"Calibrated against {catalogue}\")\n",
|
||
|
"\n",
|
||
|
"c = cols[0]\n",
|
||
|
"for n in range(3):\n",
|
||
|
" ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=-1)\n",
|
||
|
" axs[n].plot(r, ymed, color=c)\n",
|
||
|
" axs[n].fill_between(r, ylow, yhigh, alpha=0.5, color=c, label=simname_to_pretty(sim))\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# CMB-LG velocity\n",
|
||
|
"axs[0].fill_between([r.min(), 10.], [627 - 22, 627 - 22], [627 + 22, 627 + 22], color='black', alpha=0.25, zorder=0.5, label=\"CMB-LG\", hatch=\"x\")\n",
|
||
|
"axs[1].fill_between([r.min(), 10.], [276 - 3, 276 - 3], [276 + 3, 276 + 3], color='black', alpha=0.25, zorder=0.5, hatch=\"x\")\n",
|
||
|
"axs[2].fill_between([r.min(), 10.], [30 - 3, 30 - 3], [30 + 3, 30 + 3], color='black', alpha=0.25, zorder=0.5, hatch=\"x\")\n",
|
||
|
"\n",
|
||
|
"# LCDM expectation\n",
|
||
|
"Rs,mean,std,mode,p05,p16,p84,p95 = np.load(\"/mnt/users/rstiskalek/csiborgtools/data/BulkFlowPlot.npy\")\n",
|
||
|
"m = Rs < 175\n",
|
||
|
"axs[0].plot(Rs[m], mode[m], color=\"violet\", zorder=0)\n",
|
||
|
"axs[0].fill_between(Rs[m], p16[m], p84[m], alpha=0.25, color=\"violet\",\n",
|
||
|
" zorder=0, hatch='//', label=r\"$\\Lambda\\mathrm{CDM}$\")\n",
|
||
|
"\n",
|
||
|
"for n in range(3):\n",
|
||
|
" axs[n].set_xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
|
||
|
"\n",
|
||
|
"axs[0].legend()\n",
|
||
|
"axs[0].set_ylabel(r\"$B ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
|
||
|
"axs[1].set_ylabel(r\"$\\ell_B ~ [\\mathrm{deg}]$\")\n",
|
||
|
"axs[2].set_ylabel(r\"$b_B ~ [\\mathrm{deg}]$\")\n",
|
||
|
"\n",
|
||
|
"axs[0].set_xlim(r.min(), r.max())\n",
|
||
|
"\n",
|
||
|
"fig.tight_layout()\n",
|
||
|
"fig.savefig(f\"../../plots/bulkflow_{sim}_{catalogue}.png\", dpi=450)\n",
|
||
|
"fig.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"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
|
||
|
}
|