csiborgtools/notebooks/flow/reconstruction_comparison.ipynb

653 lines
258 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"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": [
2024-07-05 10:28:06 +00:00
"sims = [\"Carrick2015\", \"Lilow2024\", \"CF4\", \"CF4gp\", \"csiborg2_main\", \"csiborg2X\"]\n",
"catalogues = [\"LOSS\", \"Foundation\", \"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
"\n",
"for catalogue in catalogues:\n",
" y_BIC = np.asarray([get_gof(\"BIC\", sim, catalogue) for sim in sims])\n",
" y_BIC -= y_BIC.min()\n",
2024-07-05 10:28:06 +00:00
" y_lnZ = np.full_like(y_BIC, np.nan)\n",
" # y_lnZ = np.asarray([get_gof(\"lnZ\", sim, catalogue) for sim in sims])\n",
" # y_lnZ -= y_lnZ.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",
2024-07-05 10:28:06 +00:00
" 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",
2024-07-03 08:50:21 +00:00
"execution_count": null,
"metadata": {},
2024-07-03 08:50:21 +00:00
"outputs": [],
"source": [
"# sims = [\"Lilow2024\", \"CF4\", \"CF4gp\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n",
2024-07-05 10:28:06 +00:00
"sims = [\"csiborg2_main\", \"csiborg2X\"]\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",
2024-07-05 10:28:06 +00:00
" plt.savefig(f\"../../plots/what_beta_{sim}.png\", dpi=450)\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",
2024-07-05 10:28:06 +00:00
" plt.gcf().savefig(f\"../../plots/calibration_{catalogue}.png\", dpi=500, bbox_inches='tight')\n"
]
},
{
"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",
2024-07-05 10:28:06 +00:00
"params = [\"Vmag\", \"l\", \"b\", \"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",
2024-07-03 08:50:21 +00:00
"execution_count": null,
"metadata": {},
2024-07-03 08:50:21 +00:00
"outputs": [],
"source": [
"sim = \"csiborg2_main\"\n",
"catalogue = \"Pantheon+\"\n",
2024-07-05 10:28:06 +00:00
"key = \"alpha\"\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": [
2024-07-03 08:50:21 +00:00
"### $V_{\\rm ext}$ comparison"
]
},
2024-07-03 08:50:21 +00:00
{
"cell_type": "code",
2024-07-05 10:28:06 +00:00
"execution_count": null,
2024-07-03 08:50:21 +00:00
"metadata": {},
2024-07-05 10:28:06 +00:00
"outputs": [],
2024-07-03 08:50:21 +00:00
"source": [
"catalogues = [\"LOSS\"]\n",
"# sims = [\"Carrick2015\", \"csiborg2_main\", \"csiborg2X\"]\n",
"sims = [\"Carrick2015\"]\n",
"params = [\"Vmag\", \"l\", \"b\"]\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'{simname_to_pretty(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": [
"### Bulk flow in the simulation rest frame"
]
},
{
"cell_type": "code",
2024-07-05 10:28:06 +00:00
"execution_count": null,
2024-07-03 08:50:21 +00:00
"metadata": {},
2024-07-05 10:28:06 +00:00
"outputs": [],
2024-07-03 08:50:21 +00:00
"source": [
"sims = [\"Carrick2015\", \"csiborg1\", \"csiborg2_main\", \"csiborg2X\"]\n",
"convert_to_galactic = False\n",
"\n",
"fig, axs = plt.subplots(1, 3, figsize=(15, 5))\n",
"cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
"\n",
"for i, sim in enumerate(sims):\n",
" r, B = get_bulkflow_simulation(sim, convert_to_galactic=convert_to_galactic)\n",
" if sim == \"Carrick2015\":\n",
" if convert_to_galactic:\n",
" B[..., 0] *= 0.43\n",
" else:\n",
" B *= 0.43\n",
"\n",
" for n in range(3):\n",
" ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=0)\n",
" axs[n].fill_between(r, ylow, yhigh, color=cols[i], alpha=0.5, label=simname_to_pretty(sim) if n == 0 else None)\n",
"\n",
2024-07-03 08:50:21 +00:00
"axs[0].legend()\n",
"if convert_to_galactic:\n",
" axs[0].set_ylabel(r\"$B ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" axs[1].set_ylabel(r\"$\\ell_B ~ [\\degree]$\")\n",
" axs[2].set_ylabel(r\"$b_B ~ [\\degree]$\")\n",
"else:\n",
" axs[0].set_ylabel(r\"$B_{x} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" axs[1].set_ylabel(r\"$B_{y} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" axs[2].set_ylabel(r\"$B_{z} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
"\n",
"for n in range(3):\n",
" axs[n].set_xlabel(r\"$R ~ [\\mathrm{Mpc}]$\")\n",
"\n",
"\n",
"fig.tight_layout()\n",
2024-07-05 10:28:06 +00:00
"fig.savefig(\"../../plots/bulkflow_simulations_restframe.png\", dpi=450)\n",
2024-07-03 08:50:21 +00:00
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Bulk flow in the CMB rest frame"
]
},
{
"cell_type": "code",
2024-07-05 10:28:06 +00:00
"execution_count": null,
"metadata": {},
2024-07-05 10:28:06 +00:00
"outputs": [],
"source": [
2024-07-05 10:28:06 +00:00
"sim = \"csiborg2_main\"\n",
"catalogues = [\"Pantheon+\", \"2MTF\", \"SFI_gals\"]\n",
2024-07-03 08:50:21 +00:00
"\n",
"\n",
"fig, axs = plt.subplots(1, 3, figsize=(15, 5), sharex=True)\n",
"cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
2024-07-03 08:50:21 +00:00
"# fig.suptitle(f\"Calibrated against {catalogue}\")\n",
"\n",
2024-07-03 08:50:21 +00:00
"for i, catalogue in enumerate(catalogues):\n",
2024-07-05 10:28:06 +00:00
" r, B = get_bulkflow(sim, catalogue, sample_beta=True, convert_to_galactic=True,\n",
" weight_simulations=True, downsample=3)\n",
2024-07-03 08:50:21 +00:00
" c = cols[i]\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=catalogue)\n",
"\n",
"\n",
"# CMB-LG velocity\n",
2024-07-03 08:50:21 +00:00
"axs[0].fill_between([r.min(), 10.], [627 - 22, 627 - 22], [627 + 22, 627 + 22], color='black', alpha=0.5, 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.5, 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.5, 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": "markdown",
"metadata": {},
"source": [
"### Smoothing scale dependence"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"simname = \"Carrick2015\"\n",
"catalogue = \"Pantheon+\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Goodness-of-fit"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAABlEklEQVR4nO3deVhUZf8G8HvYtxkQBAYUEEVQBFxTSStNzT3XVkstX/2paJmVZmYuZS6VS+VSVupbmm+5leaSikuuKEaiLCKCK4uKMiwCw8zz+4M4MQIKChxmuD/XNVfOOc+c+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AQDk5eXh7bffxoYNG5Cfn4+ePXti+fLlcHd3l153+fJljBs3Dvv374eDgwNGjBiBefPmwcKi1nw0IjIReVodLqRn33Nzew3SNGWfB2dhpkBjV/t/Won8e0FDAydbmPG2WkRUDWpF+jl58iS+/vprhISEGCx/66238Pvvv+OXX36Bo6MjJkyYgMGDB+PIkSMAAJ1Oh759+0KtVuPo0aNISUnB8OHDYWlpiU8++USOj0JEJkCnF7h0K6dUQ9/kWzko565aaOBkK828FZ8L17i+A6wseB4cEdUchRDlna5bM7Kzs9GmTRssX74cH3/8MVq1aoUlS5YgMzMTrq6uWL9+PYYOHQoAiIuLQ/PmzXHs2DF07NgRO3fuRL9+/XD9+nVpFm/lypWYOnUqbty4ASuril3er9Fo4OjoiMzMTKhUqmr7rERU9XR6gYikDKRn5cFNaYP2vs4Vvsm8EAJpmnypoW9xiEtIy0Z+Ydn
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"scales = [0, 4, 8, 16, 32]\n",
"\n",
"y = np.asarray([get_gof(\"BIC\", simname, catalogue, ksmooth=i)\n",
" for i in range(len(scales))])\n",
"ymin = y.min()\n",
"\n",
"y -= ymin\n",
"y_CF4 = get_gof(\"BIC\", \"CF4\", catalogue) - ymin\n",
"y_CF4gp = get_gof(\"BIC\", \"CF4gp\", catalogue) - ymin\n",
"\n",
"plt.figure()\n",
"plt.axhline(y[0], color='blue', label=\"Carrick+2015, no smoothing\")\n",
"plt.plot(scales[1:], y[1:], marker=\"o\", label=\"Carrick+2015, smoothed\")\n",
"\n",
"plt.axhline(y_CF4, color='red', label=\"CF4, no smoothing\")\n",
"\n",
"plt.xlabel(r\"$R_{\\rm smooth} ~ [\\mathrm{Mpc}]$\")\n",
"plt.ylabel(r\"$\\Delta \\mathrm{BIC}$\")\n",
"plt.legend(ncols=1)\n",
"\n",
"plt.tight_layout()\n",
"plt.savefig(\"../../plots/test_smooth.png\", dpi=450)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Removed no burn in\n",
"Removed no burn in\n",
"Removed no burn in\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_3872503/2011775450.py:22: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.\n",
" plt.gcf().tight_layout()\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA90AAAQFCAYAAACsBKtKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3ydZ33//9d9ny2doz0t2bJlyTu2Y8cjzh4kBBICAcooEJcw2pIyfxQoFJKUQlsopS0NhQIJlC9QICTsJGTHGc7y3kO2lrW3zj73/fvjWLJlybYkSzpH0vv5eOhBzj0/tmU/eOu6rs9l2LZtIyIiIiIiIiITzkx1ASIiIiIiIiIzlUK3iIiIiIiIyCRR6BYRERERERGZJArdIiIiIiIiIpNEoVtERERERERkkih0i4iIiIiIiEwShW4RERERERGRSaLQLSIiIiIiIjJJFLpFREREREREJolCt4iISJoxDIM777wz1WWIiIjIBFDoFhGRWe/+++/HMIzBL6/Xy6JFi7jzzjtpbm6elHc+//zz3HXXXXR1dU3K80VERCQ9OFNdgIiISLq45557WLBgAeFwmC1btvDtb3+bP/zhD+zevZuMjIwJfdfzzz/P3XffzebNm8nJyZnQZ4uIiEj60Ei3iIjISTfddBPvec97+MAHPsD999/Pxz/+cWpqavj1r3+d6tKmhfnz53PXXXelugwREZG0otAtIiJyFtdeey0ANTU1fP3rX2fTpk3k5+fj8/lYu3Ytv/zlL4fdM7Ae+6GHHmLFihV4PB6WL1/Oww8/PHjNXXfdxac//WkAFixYMDit/dixY0Oeda5nDGhoaOD9738/xcXFg9f94Ac/G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yAHjPe97D7bffPuK1K1euHPX7xvJugBtvvJE//elPQ86/5z3v4YYbbuB973vfuN4rIiIyEyl0i4iInMcDDzyA1+vlkUcewePxDB6/7777xv3MkUbIx6KwsJBAIEAikeD6668/57UVFRXs3LkTy7KGjHbv379/8PxYlZaWUlpaOuSY1+ulsrLyvPWIiIjMJlrTLSIich4OhwPDMEgkEoPHjh07xkMPPTTuZ2ZmZgLQ1dU17pre+ta38sADD7B79+5h51tbWwf/+w1veANNTU383//93+CxeDzOf/7nf+L3+7nqqqvGVYOIiIicn0a6RUREzuONb3wj3/jGN3j961/Pu9/9blpaWviv//ovqqqq2Llz57ieuXbtWgA+//nP8853vhOXy8Utt9wyGMZH45/+6Z948skn2bBhAx/84AdZtmwZHR0dvPbaazz22GN0dHQA8KEPfYjvfOc7bN68mVdffZX58+fzy1/+kueee45vfvObBAKBcf0aRERE5PwUukVERM7j2muv5fvf/z7/9E//xMc//nEWLFjAP//zP3Ps2LFxh+5169bxD//wD/z3f/83Dz/8MJZlUVNTM6bQXVxczEsvvcQ999zDr371K+69917y8/NZvnw5//zP/zx4nc/n46mnnuKzn/0sP/zhD+np6WHx4sXcd999bN68eVz1i4iIyOgYtlqKioiIiIiIiEwKrekWERERERERmSQK3SIiIiIiIiKTRKFbREREREREZJIodIuIiIiIiIhMEoVuERERERERkUmi0C0iIiIiIiIySRS6RURERERERCaJQreIiIiIiIjIJFHoFhEREREREZkkCt0iIiIiIiIik0ShW0RERERERGSSKHSLiIiIiIiITBKFbhEREREREZFJotAtIiIiIiIiMkkUukVEREREREQmiUK3iIiIiIiIyCRR6BYRERERERGZJArdIiIiIiIiIpNEoVtERERERERkkih0i4iIiIiIiEwShW4RERERERGRSaLQLSIiIiIiIjJJFLpFREREREREJokz1QVMNcuyaGxsJBAIYBhGqssRmVC2bdPb28ucOXMwTf1MTUREREQk1WZd6G5sbGTu3LmpLkNkUtXV1VFeXp7qMkREREREZr1ZF7oDgQCQDCVZWVkprkZkYvX09DB37tzB73MREREREUmtWRe6B6aUZ2VlKXTLjKWlEyIiIiIi6UGLPkVEREREREQmiUK3iIiIiIiIyCSZddPLRUREREREpqvu7m6CweCkviMjI4Ps7OxJfcdsotAtIiIiIiIyDXR3d/Otb32LeDw+qe9xOp3ceeed0yp4b968mZycHL75zW+mupRhNL1cRERERERkGggGg5MeuAHi8fikj6anq1gsxp133klubi55eXn8zd/8zQX/nit0i4iIiIiIiABf/vKX2bJlC3v37mXPnj08++yzfOUrX7mgZyp0i4iIiIiIyLh94xvfYN68eQQCAebPn8/3vvc9amtred3rXkdhYSG5ubm88Y1v5NixY4P3bN68mTvuuIO3ve1t+P1+li9fzu7du/nOd75DeXk5hYWF3HvvvYPX33XXXdx8883ccccdZGVlUV1dzYMPPnjWmo4cOcItt9xCYWEhFRUVfPnLX8ayLABqamq4/vrryc7OJi8vj8suu2xwZP8HP/gBX/jCFygtLaW0tJTPf/7zfP/737+g3x+FbhERERERERmXgwcP8oUvfIFHH32U3t5etm7dyvr167Esi09+8pPU1dVx/PhxMjIy+OAHPzjk3l/84hd84hOfoKuri3Xr1nHrrbdy5MgRjh49ys9+9jM+8YlP0NzcPHj9ww8/zPr16+no6OAb3/gG73rXuzhy5MiwmoLBINdddx3XXXcdDQ0NPPvss/zsZz/jvvvuA+Dzn/88VVVVtLW10dzczNe+9jWcTiednZ3U19ezevXqwWetXr2a2tpauru7x/17pNAtIiIiIiIi4+JwOLBtmz179hAKhSguLmblypXMnz+fm266Ca/XS1ZWFp///Od59tlnB0ebAd74xjdy2WWX4XQ6+bM/+zOOHTvG3Xffjdvt5rrrriM7O5tdu3YNXr9o0SI+/OEP43Q
"text/plain": [
"<Figure size 1000x1000 with 15 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sim = \"Carrick2015\"\n",
"catalogue = \"Pantheon+\"\n",
"\n",
"\n",
"X = [samples_to_getdist(get_samples(sim, catalogue, ksmooth=ksmooth), ksmooth)\n",
" for ksmooth in [0, 1, 2]]\n",
"\n",
"params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\"]\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",
"\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": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2024-07-03 08:51:00 +00:00
"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",
2024-07-05 10:28:06 +00:00
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}