csiborgtools/notebooks/flow/reconstruction_comparison.ipynb

2007 lines
236 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
2024-09-18 13:20:39 +00:00
"execution_count": 1,
"metadata": {},
2024-09-18 13:20:39 +00:00
"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",
2024-09-17 09:26:04 +00:00
"from os.path import exists\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from corner import corner\n",
"from getdist import plots\n",
"from astropy.coordinates import angular_separation\n",
"import scienceplots\n",
"from os.path import exists\n",
"import seaborn as sns\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)\n",
"fdir = \"/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Quick checks"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 15:27:56\n"
]
},
{
"data": {
"text/plain": [
"9715.0205"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fname = paths.flow_validation(\n",
" fdir, \"Carrick2015\", \"2MTF\", inference_method=\"mike\",\n",
" sample_alpha=True, sample_beta=None,\n",
" zcmb_max=0.05)\n",
"\n",
"\n",
"get_gof(\"neg_lnZ_harmonic\", fname)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"catalogue = \"CF4_TFR_i\"\n",
"simname = \"Carrick2015\"\n",
"zcmb_max=0.05\n",
"sample_beta = None\n",
"sample_alpha = True\n",
"\n",
"fname_bayes = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"bayes\",\n",
" sample_alpha=sample_alpha, sample_beta=sample_beta,\n",
" zcmb_max=zcmb_max)\n",
"\n",
"fname_mike = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_alpha=sample_alpha, sample_beta=sample_beta,\n",
" zcmb_max=zcmb_max)\n",
"\n",
"\n",
"X = []\n",
"labels = [\"Full posterior\", \"Delta posterior\"]\n",
"for i, fname in enumerate([fname_bayes, fname_mike]):\n",
" samples = get_samples(fname)\n",
" if i == 1:\n",
" print(samples.keys())\n",
"\n",
" X.append(samples_to_getdist(samples, labels[i]))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"params = [f\"a_{catalogue}\", f\"b_{catalogue}\", f\"c_{catalogue}\", f\"e_mu_{catalogue}\",\n",
" \"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"alpha_{catalogue}\"]\n",
"# params = [\"beta\", f\"a_{catalogue}\", f\"b_{catalogue}\", f\"e_mu_{catalogue}\"]\n",
"# params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"mag_cal_{catalogue}\", f\"alpha_cal_{catalogue}\", f\"beta_cal_{catalogue}\", f\"e_mu_{catalogue}\"]\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(catalogue_to_pretty(catalogue), y=1.025)\n",
"plt.gcf().tight_layout()\n",
"# plt.gcf().savefig(f\"../../plots/method_comparison_{simname}_{catalogue}.png\", dpi=500, bbox_inches='tight')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# catalogue = [\"LOSS\", \"Foundation\"]\n",
"catalogue = \"CF4_TFR_i\"\n",
"simname = \"IndranilVoid_exp\"\n",
"zcmb_max = 0.05\n",
"sample_alpha = False\n",
"\n",
"fname = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_mag_dipole=True,\n",
" sample_beta=False,\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max)\n",
"\n",
"\n",
"samples = get_samples(fname, convert_Vext_to_galactic=True)\n",
"\n",
"samples, labels, keys = samples_for_corner(samples)\n",
"fig = corner(samples, labels=labels, show_titles=True,\n",
" title_kwargs={\"fontsize\": 12}, smooth=1)\n",
"# fig.savefig(\"../../plots/test.png\", dpi=250)\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Paper plots"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 0. LOS velocity example"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fpath = \"/mnt/extraspace/rstiskalek/catalogs/PV/CF4/CF4_TF-distances.hdf5\"\n",
"\n",
"loader_carrick = csiborgtools.flow.DataLoader(\"Carrick2015\", [0], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n",
"loader_lilow = csiborgtools.flow.DataLoader(\"Lilow2024\", [0], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n",
"loader_cb2 = csiborgtools.flow.DataLoader(\"csiborg2_main\", [i for i in range(20)], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n",
"loader_cb2X = csiborgtools.flow.DataLoader(\"csiborg2X\", [i for i in range(20)], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n",
"loader_CF4 = csiborgtools.flow.DataLoader(\"CF4\", [i for i in range(20)], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n",
"loader_CLONES = csiborgtools.flow.DataLoader(\"CLONES\", [0], \"CF4_TFR_i\", fpath, paths, ksmooth=0, )\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"angdist = angular_separation(\n",
" np.deg2rad(loader_carrick.cat[\"RA\"]), np.deg2rad(loader_carrick.cat[\"DEC\"]),\n",
" np.deg2rad(csiborgtools.clusters[\"Virgo\"].spherical_pos[1]),\n",
" np.deg2rad(csiborgtools.clusters[\"Virgo\"].spherical_pos[2]))\n",
"k = np.argmin(angdist)\n",
"print([loader_carrick.cat[\"RA\"][k], loader_carrick.cat[\"DEC\"][k]])\n",
"print(csiborgtools.clusters[\"Virgo\"].spherical_pos[1:])\n",
"print(csiborgtools.clusters[\"Virgo\"].spherical_pos[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"loaders = [loader_carrick, loader_lilow, loader_CF4, loader_cb2, loader_cb2X, loader_CLONES]\n",
"simnames = [\"Carrick2015\", \"Lilow2024\", \"CF4\", \"csiborg2_main\", \"csiborg2X\", \"CLONES\"]\n",
"\n",
"\n",
"with plt.style.context(\"science\"):\n",
" plt.rcParams.update({'font.size': 9})\n",
" plt.figure()\n",
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
"\n",
" for i, (simname, loader) in enumerate(zip(simnames, loaders)):\n",
" r = loader.rdist\n",
" vrad = loader.los_radial_velocity[:, k, :]\n",
"\n",
" if simname == \"Carrick2015\":\n",
" vrad *= 0.43\n",
"\n",
" if len(vrad) > 1:\n",
" ylow, yhigh = np.percentile(vrad, [16, 84], axis=0)\n",
" plt.fill_between(r, ylow, yhigh, alpha=0.66, color=cols[i],\n",
" label=simname_to_pretty(simname))\n",
" else:\n",
" plt.plot(r, vrad[0], label=simname_to_pretty(simname), c=cols[i])\n",
"\n",
" plt.xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
" plt.ylabel(r\"$V_{\\rm rad} ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
"\n",
" plt.xlim(0, 90)\n",
" plt.ylim(-1000, 1000)\n",
" plt.legend(ncols=2, fontsize=\"small\")\n",
" plt.axvline(12.045, zorder=0, c=\"k\", ls=\"--\", alpha=0.75)\n",
"\n",
" plt.tight_layout()\n",
" plt.savefig(\"../../plots/LOS_example.pdf\", dpi=450, bbox_inches='tight')\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. Evidence comparison"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:18:58\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:18:52\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:20:01\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:20:05\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 14:49:46\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:19:42\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_LOSS_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 21:55:56\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:18:47\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:18:56\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:19:59\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 13:19:50\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 14:50:07\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:19:26\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_Foundation_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 21:55:55\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 15:27:56\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 11:29:14\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 12:03:40\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 12:04:05\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 14:52:59\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:19:10\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_2MTF_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 21:59:45\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 15:28:34\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 11:29:14\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 12:05:48\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 12:06:16\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 14:57:22\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:19:11\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_SFI_gals_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 22:02:16\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:48:49\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:49:07\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 11:13:55\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 11:12:57\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 15:05:21\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:19:57\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_CF4_TFR_i_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 22:15:58\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:48:29\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:49:00\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 11:10:51\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 11:07:55\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_manticore_2MPP_N128_DES_V1_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 15:04:25\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 10:29:11\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_CF4_TFR_w1_mike_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 20/09/2024 22:07:15\n"
]
}
],
"source": [
"zcmb_max = 0.05\n",
"\n",
"sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"manticore_2MPP_N128_DES_V1\", \"CLONES\", \"CF4\",]\n",
"catalogues = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
"y_BIC = np.full((len(catalogues), len(sims)), np.nan)\n",
"y_lnZ = np.full_like(y_BIC, np.nan)\n",
"\n",
"for i, catalogue in enumerate(catalogues):\n",
" for j, simname in enumerate(sims):\n",
" fname = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_alpha=simname != \"IndranilVoid_exp\",\n",
" zcmb_max=zcmb_max)\n",
"\n",
" # y_BIC[i, j] = get_gof(\"BIC\", fname)z\n",
" y_lnZ[i, j] = get_gof(\"neg_lnZ_harmonic\", fname)\n",
"\n",
" y_lnZ[i] -= y_lnZ[i].min()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAzQAAAGYCAYAAACUM6fLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB6IUlEQVR4nO3dTWwjZ5of8L+IcZAYGatEYZVeKMhERQ8QYLAZu0hNDgGCZFXVkyCwAtgscQUESQ4j0kYGCBCMVa0FgkUuqyHblwCLjEn5sEGQ1Uikexe6rcnuIIccMhKrvYc9BDMsGUjUETRoqtRe+DI7rBy09br4KZJiVbHI/w8w3CwW+ZYk1sP383kXHMdxQEREREREFEGxsC+AiIiIiIhoXGzQEBERERFRZLFBQ0REREREkcUGDRERERERRRYbNEREREREFFls0BARERERUWSxQUNERERERJHFBg0REREREUUWGz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aVH97KGzbZsVlHsyDEM0CtzsUaZpYn9/H0+fPhVTvIZZ82Lbtli0rSiKiA/u+52fn6NarXb1duVyOTQaDZTLZTFfvlgsii+Yzp4873v2usZ+10HTjbFi+tm2jWKx2BUP0um0mIJeq9UGZrG6S6+YRNMl6JG3ra0tMdUtSJPoBOGUMx+kUqm+HwZvZVeSJNFKdXtIG42GmIPY7zmabsMEAm8KRgBtc9Rdp6enaDabqFarME0ThmG0TfFwM4J4v9D8WvPAtRT3l8/nu3qgDMNAJpMRv9+9vT2sra0NFdjdv/v6+rro/arVamL
"text/plain": [
"<Figure size 830x415 with 6 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
" figwidth = 8.3\n",
" fig, axs = plt.subplots(2, 3, figsize=(figwidth, 0.5 * figwidth))\n",
" fig.subplots_adjust(hspace=0)\n",
"\n",
" x = np.arange(len(sims))\n",
" y = y_lnZ\n",
" for n in range(len(catalogues)):\n",
" i, j = n // 3, n % 3\n",
" ax = axs[i, j]\n",
" ax.text(0.1, 0.875, catalogue_to_pretty(catalogues[n]),\n",
" transform=ax.transAxes, #fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='left',\n",
" bbox=dict(facecolor='white', alpha=0.5),\n",
" )\n",
" ax.scatter(x, y[n], c=\"k\", s=7.5)\n",
"\n",
" y_min, y_max = ax.get_ylim()\n",
" y_offset = (y_max - y_min) * 0.075 # Adjust the fraction (0.05) as needed\n",
"\n",
" for k, txt in enumerate(y[n]):\n",
" ax.text(x[k], y[n, k] + y_offset, f\"({y[n, k]:.1f})\",\n",
" ha='center', fontsize=\"small\")\n",
"\n",
" ax.set_ylim(y_min, y_max + 2 * y_offset)\n",
"\n",
" for i in range(3):\n",
" axs[1, i].set_xticks(\n",
" np.arange(len(sims)),\n",
" [simname_to_pretty(sim) for sim in sims], rotation=90,\n",
" fontsize=\"small\")\n",
" axs[0, i].set_xticks([], [])\n",
"\n",
" for i in range(2):\n",
" for j in range(3):\n",
" axs[i, j].set_xlim(-0.75, len(sims) - 0.25)\n",
"\n",
" axs[i, j].tick_params(axis='x', which='major', top=False)\n",
" axs[i, j].tick_params(axis='x', which='minor', top=False, length=0)\n",
" axs[i, j].tick_params(axis='y', which='minor', length=0)\n",
"\n",
" axs[i, 0].set_ylabel(r\"$-\\Delta \\ln \\mathcal{Z}$\")\n",
"\n",
" fig.tight_layout()\n",
" fig.savefig(f\"../../plots/lnZ_comparison.pdf\", dpi=500, bbox_inches='tight')\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. Dependence of the evidence on smoothing scale"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
2024-09-17 20:01:15 +00:00
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"zcmb_max = 0.05\n",
"\n",
"ksmooth = [0, 1, 2, 3, 4]\n",
"scales = [0, 2, 4, 6, 8]\n",
"sims = [\"Carrick2015\", \"csiborg2_main\"]\n",
"catalogues = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\"]\n",
"\n",
"y = np.full((len(sims), len(catalogues), len(ksmooth)), np.nan)\n",
"for i, simname in enumerate(sims):\n",
" for j, catalogue in enumerate(catalogues):\n",
" for n, k in enumerate(ksmooth):\n",
" fname = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_alpha=True, smooth=k,\n",
" zcmb_max=zcmb_max)\n",
" if not exists(fname):\n",
" raise FileNotFoundError(fname)\n",
"\n",
" y[i, j, n] = get_gof(\"neg_lnZ_harmonic\", fname)\n",
"\n",
" y[i, j, :] -= y[i, j, :].min()"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"for i, simname in enumerate(sims):\n",
" for j, catalogue in enumerate(catalogues):\n",
" print(simname, catalogue, y[i, j, -1])"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
" plt.figure()\n",
"\n",
" ls = [\"-\", \"--\", \"-.\", \":\"]\n",
" for i, simname in enumerate(sims):\n",
" for j, catalogue in enumerate(catalogues):\n",
" plt.plot(scales, y[i, j], marker='o', ms=2.5, ls=ls[i],\n",
" label=catalogue_to_pretty(catalogue) if i == 0 else None, c=cols[j],)\n",
"\n",
" plt.xlabel(r\"$R_{\\rm smooth} ~ [\\mathrm{Mpc} / h]$\")\n",
" plt.ylabel(r\"$-\\Delta \\ln \\mathcal{Z}$\")\n",
2024-09-18 13:20:39 +00:00
" plt.xlim(0)\n",
" plt.ylim(0)\n",
" plt.legend()\n",
"\n",
" plt.tight_layout()\n",
" plt.savefig(\"../../plots/smoothing_comparison.pdf\", dpi=450)\n",
" plt.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 3. External flow consistency"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"CF4\", \"CLONES\"]\n",
"# sims = [\"Carrick2015\", \"Lilow2024\", \"CF4\", \"csiborg2_main\", \"csiborg2X\"]\n",
"# cats = [[\"LOSS\", \"Foundation\"], \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"# cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_not2MTForSFI_i\"]\n",
"\n",
"X = {}\n",
"\n",
"for sim in sims:\n",
" for cat in cats:\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"bayes\",\n",
" sample_alpha=True, zcmb_max=0.05)\n",
"\n",
" if not exists(fname):\n",
" raise FileNotFoundError(fname)\n",
"\n",
" with File(fname, 'r') as f:\n",
" X[f\"{sim}_{cat}\"] = np.linalg.norm(f[f\"samples/Vext\"][...], axis=1)"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"fname = paths.flow_validation(\n",
" fdir, \"CF4\", \"CF4_TFR_i\", inference_method=\"bayes\",\n",
" sample_alpha=True, zcmb_max=0.05)\n",
"\n",
"with File(fname, 'r') as f:\n",
" x = f[\"samples/Vext\"][...]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
"\n",
2024-09-18 13:20:39 +00:00
" fig, axs = plt.subplots(2, 2, figsize=(3.5, 2.65 * 1.25))\n",
" fig.subplots_adjust(hspace=0, wspace=0)\n",
"\n",
" for k, cat in enumerate(cats):\n",
" i, j = k // 2, k % 2\n",
" ax = axs[i, j]\n",
"\n",
" for sim in sims:\n",
" sns.kdeplot(X[f\"{sim}_{cat}\"], fill=True, bw_adjust=0.75, ax=ax,\n",
" label=simname_to_pretty(sim) if i == 0 else None)\n",
"\n",
" ax.text(0.725, 0.85, catalogue_to_pretty(cat),\n",
" transform=ax.transAxes, fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='center',\n",
" bbox=dict(facecolor='white', alpha=0.5, edgecolor='none'))\n",
"\n",
" ax.set_ylabel(None)\n",
" ax.set_yticklabels([])\n",
" ax.set_xlim(0)\n",
"\n",
" handles, labels = axs[0, 0].get_legend_handles_labels()\n",
" fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 1.1),\n",
" ncol=3)\n",
"\n",
" for i in range(2):\n",
" axs[-1, i].set_xlabel(r\"$|\\mathbf{V}_{\\rm ext}| ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" axs[i, 0].set_ylabel(\"Normalised PDF\")\n",
"\n",
" fig.tight_layout()\n",
" fig.savefig(f\"../../plots/Vext_comparison.pdf\", dpi=450)\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4. What $\\beta$ is preferred by the data? "
]
},
{
"cell_type": "code",
2024-09-17 09:26:04 +00:00
"execution_count": null,
"metadata": {},
2024-09-17 09:26:04 +00:00
"outputs": [],
"source": [
"sims = [\"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"CF4\", \"CLONES\"]\n",
"cats = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"# cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_not2MTForSFI_i\"]\n",
"\n",
"X = {}\n",
"for sim in sims:\n",
" for cat in cats:\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"bayes\",\n",
" sample_alpha=True, zcmb_max=0.05, sample_beta=True)\n",
"\n",
" if not exists(fname):\n",
" raise FileNotFoundError(fname)\n",
"\n",
" with File(fname, 'r') as f:\n",
" X[f\"{sim}_{cat}\"] = f[f\"samples/beta\"][...]"
]
},
{
"cell_type": "code",
2024-09-17 09:26:04 +00:00
"execution_count": null,
"metadata": {},
2024-09-17 09:26:04 +00:00
"outputs": [],
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
"\n",
" fig, axs = plt.subplots(3, 2, figsize=(3.5, 2.65 * 1.8))\n",
" fig.subplots_adjust(hspace=0, wspace=0)\n",
"\n",
" for k, cat in enumerate(cats):\n",
" i, j = k // 2, k % 2\n",
" ax = axs[i, j]\n",
"\n",
" for sim in sims:\n",
" sns.kdeplot(X[f\"{sim}_{cat}\"], fill=True, bw_adjust=0.75, ax=ax,\n",
" label=simname_to_pretty(sim) if i == 0 else None)\n",
"\n",
" ax.text(0.1, 0.85, catalogue_to_pretty(cat),\n",
" transform=ax.transAxes, fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='left',\n",
" bbox=dict(facecolor='white', alpha=0.5, edgecolor='k')\n",
" )\n",
"\n",
" ax.axvline(1, c=\"k\", ls=\"--\", alpha=0.75)\n",
" ax.set_ylabel(None)\n",
" ax.set_yticklabels([])\n",
"\n",
" handles, labels = axs[0, 0].get_legend_handles_labels()\n",
" fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 1.075),\n",
" ncol=3)\n",
"\n",
" # for i in range(3):\n",
" for j in range(2):\n",
" axs[-1, j].set_xlabel(r\"$\\beta$\")\n",
"\n",
" for i in range(3):\n",
" axs[i, 0].set_ylabel(\"Normalised PDF\")\n",
"\n",
" fig.tight_layout()\n",
" fig.savefig(f\"../../plots/beta_comparison.pdf\", dpi=450)\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-09-18 22:42:17 +00:00
"### What $\\sigma_v$ is preferred by the data?"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": 83,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:24:46\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:24:56\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:26:54\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:28:43\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 12:20:11\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Carrick2015_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 12:19:39\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:25:09\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:25:47\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:27:13\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:28:48\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 12:19:59\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_Lilow2024_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 12:26:53\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:29:55\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:42:40\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:54:29\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 17:10:19\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:27:52\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2_main_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 12:58:15\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:33:23\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:39:06\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:59:53\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 17:16:15\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:39:34\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_csiborg2X_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:01:55\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:46:28\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 16:49:33\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 30/08/2024 17:12:11\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 14:07:26\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:23:47\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CF4_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:19:35\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_LOSS_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 18/09/2024 15:44:36\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_Foundation_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 18/09/2024 15:48:10\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_2MTF_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:49:16\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_SFI_gals_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:50:20\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_CF4_TFR_i_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:52:12\n",
"File: /mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/samples_CLONES_CF4_TFR_w1_bayes_zcmb_max_0.05_sample_alpha.hdf5\n",
"Last modified: 12/09/2024 13:51:03\n"
]
}
],
"source": [
"sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"CF4\", \"CLONES\"]\n",
"cats = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"# cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_not2MTForSFI_i\"]\n",
"\n",
"X = {}\n",
"for sim in sims:\n",
" for cat in cats:\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"bayes\",\n",
" sample_alpha=True, zcmb_max=0.05)\n",
"\n",
" if not exists(fname):\n",
" raise FileNotFoundError(fname)\n",
"\n",
" with File(fname, 'r') as f:\n",
" X[f\"{sim}_{cat}\"] = f[f\"samples/sigma_v\"][...]"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
2024-09-18 13:20:39 +00:00
"outputs": [
{
"data": {
2024-09-18 22:42:17 +00:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAIBCAYAAABp6FWdA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Sn2loXXb7fYp1UMm5qNYDJOTVy3nDT+TuN1uQqEQv/u7v5u2RjxfBgYG+MlPfoLb7Z6zj5MnTwLjmTozkSlvvsz3ek3kdU/Mj7179ybz+U9XAMXhcLB9+/bk3Kmvr894FspFZwdcoytgvbEsE2PJGjOZR6ZLrN7Q0JBM6djU1ERDQ0NSy9u7dy91dXVpT7TZkqs3NTVRXV298rPTlayBNSujkMKuXbs4dOhQiuA+dOhQ8kJaDNNVTFnusOZMUlBQQGlp6XIPIymwJ15nE5mp2MHkYieJ1KuQWtBkooliOtPpbMx0vU6uspRIYDVbO06nM3mNZyMT4k27ODlTYvX6+vqkraqxsTFZQQUkYTs5o1i6TE6uvnfv3hVj11st1NfXT9Gwp6vf19DQkEwW1NTUlNxus9k4ePBg8hE4cfHt3bs3mcckke8EpBt+gqampmSbCdNMov+6ujrq6uqSgiTRb11dHQ6Hg6NHjyaPvZkLYSRoa2sDpN/JZrMlv5PZih1MLJSQOHZyQZOWlhb27duX3L6Ym/nk63Xik1eimtJsHDlyJDmfpivgsVhuqHzc82GmxOptbW1JgXry5En2799PU1MTVqs1+bfY5OpHjx6ltraW6urqGTPbyUxPIrXunj17knbGySQ0uZaWFnbs2JF8YkoUEm5ubqahoYGjR4/y+OOPc+jQoaRgmO4CS1Q+StgsE4WIJwqahJDZt29fipBxOBxJYWK1Wqmvr78pC2FMJFH
2024-09-18 13:20:39 +00:00
"text/plain": [
2024-09-18 22:42:17 +00:00
"<Figure size 350x477 with 6 Axes>"
2024-09-18 13:20:39 +00:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
2024-09-18 22:42:17 +00:00
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
"\n",
" fig, axs = plt.subplots(3, 2, figsize=(3.5, 2.65 * 1.8))\n",
" fig.subplots_adjust(hspace=0, wspace=0)\n",
"\n",
" for k, cat in enumerate(cats):\n",
" i, j = k // 2, k % 2\n",
" ax = axs[i, j]\n",
"\n",
" for sim in sims:\n",
" sns.kdeplot(X[f\"{sim}_{cat}\"], fill=True, bw_adjust=0.75, ax=ax,\n",
" label=simname_to_pretty(sim) if i == 0 else None)\n",
"\n",
" ax.text(0.9, 0.85, catalogue_to_pretty(cat),\n",
" transform=ax.transAxes, fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='right',\n",
" # bbox=dict(facecolor='white', alpha=0.5, edgecolor='k')\n",
" )\n",
"\n",
" ax.set_ylabel(None)\n",
" ax.set_yticklabels([])\n",
"\n",
" xmin = ax.get_xlim()[0]\n",
" if xmin < 0:\n",
" ax.set_xlim(0)\n",
"\n",
" handles, labels = axs[0, 0].get_legend_handles_labels()\n",
" fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 1.075),\n",
" ncol=3)\n",
"\n",
" # for i in range(3):\n",
" for j in range(2):\n",
" axs[-1, j].set_xlabel(r\"$\\sigma_v ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
"\n",
" for i in range(3):\n",
" axs[i, 0].set_ylabel(\"Normalised PDF\")\n",
"\n",
" fig.tight_layout()\n",
" fig.savefig(f\"../../plots/sigmav_comparison.pdf\", dpi=450)\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5. Bulk flow in the simulation rest frame "
]
},
{
"cell_type": "code",
"execution_count": 4,
2024-09-18 22:42:17 +00:00
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU0AAAD1CAYAAADUHqdoAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB0T0lEQVR4nO2dd3wcZ53/3zPbV221kixZsmxpJfcu2ymkY5mOgUS2Me1okeACgbsDK4YDjuPAkeF+cHBwSKGEcji2dEkwPVJCAgkJsS33Lq3c5CqtVmX7zszvj9GstVbvkj3v12us3dkpz4x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jm6agzfhQVFVFXV8eGDRtiz0HPautwXNMHc14fzE29v/L19YzU19fH2dI5nc5BDWBWr15Nfn5+zHxjKhu7TO82TUWCQAvYMli0aBGyLHPq1CmWL1/ea1O/FOSE7/yEFGtBQi52g3VUx7jRPftG6uvre7lm19bWxtpGtQnTtHbSsrKyET+I2kyS2hdEm37gZvPGDAaDnD8/Mc9Ibm4uVuvgz8i+ffsoLy+PTUFSWVlJaWlpn////bmmD+S8PlQ39cHo+Yz0tIsbKhUVFXg8nlE9pxPFNBdNGbrOgXMhs2fPxm63c+zYsT5F84TvPKtee2RCirXvju9TlDx3xPv35+bek/5cs5944gmqq6tj4qm91hiJG/vDDz9MbW1t7MukNeLfbKJ5/vx5Pv3pT0/Iub73ve8xd+7gz4j2fwjqD+XatWspLi4elmv69u3b+3Ve78tN3eVyjeoZSUtLG1YTgTaNdXV
"text/plain": [
"<Figure size 350x262.5 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"manticore_2MPP_N128_DES_V1\", \"CLONES\", \"CF4\"]\n",
"\n",
"\n",
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
"\n",
" plt.figure()\n",
" for i, sim in enumerate(sims):\n",
" r, B = get_bulkflow_simulation(sim, convert_to_galactic=True)\n",
" B = B[..., 0]\n",
"\n",
" if sim == \"Carrick2015\":\n",
" B *= 0.43\n",
"\n",
" if sim in [\"Carrick2015\", \"Lilow2024\", \"CLONES\"]:\n",
" plt.plot(r, B[0], label=simname_to_pretty(sim), color=cols[i])\n",
" else:\n",
" ylow, yhigh = np.percentile(B, [16, 84], axis=0)\n",
" plt.fill_between(r, ylow, yhigh, alpha=0.5,\n",
" label=simname_to_pretty(sim), color=cols[i])\n",
"\n",
" plt.xlabel(r\"$R ~ [\\mathrm{Mpc} / h]$\")\n",
2024-09-18 13:20:39 +00:00
" plt.ylabel(r\"$|\\mathbf{B}_{\\rm sim}| ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" plt.xlim(5, 200)\n",
" plt.legend(ncols=2)\n",
"\n",
" plt.tight_layout()\n",
" plt.savefig(\"../../plots/bulkflow_simulations_restframe.pdf\", dpi=450)\n",
" plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 6. Bulk flow in the CMB frame"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"sims = [\"Carrick2015\", \"Lilow2024\", \"csiborg2_main\", \"csiborg2X\", \"CLONES\", \"CF4\"]\n",
"# cats = [[\"LOSS\", \"Foundation\"], \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\"]\n",
"cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
"\n",
"data = {}\n",
"for sim in sims:\n",
" for cat in cats:\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"bayes\",\n",
" sample_alpha=True, zcmb_max=0.05)\n",
" data[f\"{sim}_{cat}\"] = get_bulkflow(fname, sim)\n",
"\n",
"def get_ax_centre(ax):\n",
" # Get the bounding box of the specific axis in relative figure coordinates\n",
" bbox = ax.get_position()\n",
"\n",
" # Extract the position and size of the axis\n",
" x0, y0, width, height = bbox.x0, bbox.y0, bbox.width, bbox.height\n",
"\n",
" # Calculate the center of the axis\n",
" center_x = x0 + width / 2\n",
" center_y = y0 + height / 2\n",
" return center_x, center_y"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
" nrows = len(sims)\n",
" ncols = 3\n",
"\n",
" figwidth = 8.3\n",
2024-09-18 13:20:39 +00:00
" fig, axs = plt.subplots(nrows, ncols, figsize=(figwidth, 1.15 * figwidth), sharex=True, )\n",
" fig.subplots_adjust(hspace=0, wspace=0)\n",
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
" # fig.suptitle(f\"Calibrated against {catalogue}\")\n",
"\n",
" for i, sim in enumerate(sims):\n",
" for j, catalogue in enumerate(cats):\n",
" r, B = data[f\"{sim}_{catalogue}\"]\n",
" c = cols[j]\n",
" for n in range(3):\n",
" ylow, ymed, yhigh = np.percentile(B[..., n], [16, 50, 84], axis=-1)\n",
" axs[i, n].fill_between(\n",
" r, ylow, yhigh, alpha=0.5, color=c, edgecolor=c,\n",
" label=catalogue_to_pretty(catalogue) if i == 1 else None)\n",
"\n",
"\n",
" # CMB-LG velocity\n",
2024-09-18 13:20:39 +00:00
" kwargs = {\"color\": \"mediumblue\", \"alpha\": 0.5, \"zorder\": 10}\n",
" for n in range(len(sims)):\n",
" axs[n, 0].fill_between([r.min(), 15.], [627 - 22, 627 - 22], [627 + 22, 627 + 22], label=\"CMB-LG\" if n == 0 else None, **kwargs)\n",
" axs[n, 1].fill_between([r.min(), 15.], [276 - 3, 276 - 3], [276 + 3, 276 + 3], **kwargs)\n",
" axs[n, 2].fill_between([r.min(), 15.], [30 - 3, 30 - 3], [30 + 3, 30 + 3], **kwargs)\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",
2024-09-18 13:20:39 +00:00
" kwargs = {\"color\": \"black\", \"zorder\": 0, \"alpha\": 0.25}\n",
" for n in range(len(sims)):\n",
" axs[n, 0].fill_between(\n",
" Rs[m], p16[m], p84[m],\n",
" label=r\"$\\Lambda\\mathrm{CDM}$\" if n == 0 else None, **kwargs)\n",
"\n",
" for n in range(3):\n",
" axs[-1, n].set_xlabel(r\"$R ~ [\\mathrm{Mpc} / h]$\")\n",
"\n",
" for n in range(len(sims)):\n",
" axs[n, 0].set_ylabel(r\"$|\\mathbf{B}| ~ [\\mathrm{km} / \\mathrm{s}]$\")\n",
" axs[n, 1].set_ylabel(r\"$\\ell ~ [\\mathrm{deg}]$\")\n",
" axs[n, 2].set_ylabel(r\"$b ~ [\\mathrm{deg}]$\")\n",
"\n",
" for i, sim in enumerate(sims):\n",
" ax = axs[i, -1].twinx()\n",
" ax.set_ylabel(simname_to_pretty(sim), rotation=270, labelpad=7.5)\n",
" ax.set_yticklabels([])\n",
"\n",
2024-09-18 13:20:39 +00:00
" # Watkins numbers\n",
" # for n in range(len(sims)):\n",
" # rx = 150\n",
"\n",
" axs[0, 0].set_xlim(r.min(), r.max())\n",
"\n",
" axs[0, 0].legend()\n",
" handles, labels = axs[1, 0].get_legend_handles_labels() # get the labels from the first axis\n",
" fig.legend(handles, labels, loc='upper center', bbox_to_anchor=(0.5, 0.975), ncol=len(cats) + 2)\n",
"\n",
2024-09-18 13:20:39 +00:00
" fig.tight_layout(rect=[0, 0, 0.95, 0.95], h_pad=0.01)\n",
" fig.savefig(f\"../../plots/bulkflow_CMB.pdf\", dpi=450)\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 8. Full vs Delta comparison"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"catalogue = \"CF4_TFR_i\"\n",
"simname = \"csiborg2X\"\n",
"zcmb_max=0.05\n",
"sample_beta = True\n",
"sample_alpha = True\n",
"\n",
"fname_bayes = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"bayes\",\n",
" sample_alpha=sample_alpha, sample_beta=sample_beta,\n",
" zcmb_max=zcmb_max)\n",
"\n",
"fname_mike = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_alpha=sample_alpha, sample_beta=sample_beta,\n",
" zcmb_max=zcmb_max)\n",
"\n",
"\n",
"X = []\n",
"labels = [\"Full posterior\", \"Delta posterior\"]\n",
"for i, fname in enumerate([fname_bayes, fname_mike]):\n",
" samples = get_samples(fname)\n",
" if i == 1:\n",
" print(samples.keys())\n",
"\n",
" X.append(samples_to_getdist(samples, labels[i]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"params = [f\"a_{catalogue}\", f\"b_{catalogue}\", f\"c_{catalogue}\", f\"e_mu_{catalogue}\",\n",
" \"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"alpha_{catalogue}\"]\n",
"# params = [\"beta\", f\"a_{catalogue}\", f\"b_{catalogue}\", f\"e_mu_{catalogue}\"]\n",
"# params = [\"Vmag\", \"l\", \"b\", \"sigma_v\", \"beta\", f\"mag_cal_{catalogue}\", f\"alpha_cal_{catalogue}\", f\"beta_cal_{catalogue}\", f\"e_mu_{catalogue}\"]\n",
"\n",
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 11})\n",
" g = plots.get_subplot_plotter()\n",
" g.settings.figure_legend_frame = False\n",
" g.settings.alpha_filled_add = 0.75\n",
" g.settings.fontsize = 12\n",
"\n",
" g.triangle_plot(X, params=params, filled=True, legend_loc='upper right')\n",
" # plt.gcf().suptitle(catalogue_to_pretty(catalogue), y=1.025)\n",
" plt.gcf().tight_layout()\n",
" plt.gcf().savefig(f\"../../plots/method_comparison_{simname}_{catalogue}.pdf\", dpi=300, bbox_inches='tight')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Guilhem plots"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Manticore vs linear comparison"
]
},
{
"cell_type": "code",
2024-09-17 09:26:04 +00:00
"execution_count": null,
"metadata": {},
2024-09-17 09:26:04 +00:00
"outputs": [],
"source": [
"zcmb_max = 0.05\n",
"\n",
"sims = [\"Carrick2015\", \"csiborg2X\"]\n",
"catalogues = [\"LOSS\", \"Foundation\", \"2MTF\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
"y_lnZ = np.full((len(catalogues), len(sims)), np.nan)\n",
"\n",
"for i, catalogue in enumerate(catalogues):\n",
" for j, simname in enumerate(sims):\n",
" fname = paths.flow_validation(\n",
" fdir, simname, catalogue, inference_method=\"mike\",\n",
" sample_alpha=simname != \"IndranilVoid_exp\",\n",
" zcmb_max=zcmb_max)\n",
"\n",
" y_lnZ[i, j] = - get_gof(\"neg_lnZ_harmonic\", fname)\n",
"\n",
" # y_lnZ[i] -= y_lnZ[i].min()"
]
},
{
"cell_type": "code",
2024-09-17 09:26:04 +00:00
"execution_count": null,
"metadata": {},
2024-09-17 09:26:04 +00:00
"outputs": [],
"source": [
"bayes_factor = y_lnZ[:, 1] - y_lnZ[:, 0]\n",
"\n",
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
" plt.figure()\n",
"\n",
" sns.barplot(x=np.arange(len(catalogues)), y=bayes_factor / np.log(10), color=\"#21456D\")\n",
" plt.xticks(\n",
" np.arange(len(catalogues)),\n",
" [catalogue_to_pretty(cat) for cat in catalogues],\n",
" rotation=35, fontsize=\"small\", minor=False)\n",
" plt.ylabel(r\"$\\log \\left(\\mathcal{Z}_{\\rm Manticore} / \\mathcal{Z}_{\\rm linear}\\right)$\")\n",
" plt.tick_params(axis='x', which='both', bottom=False, top=False)\n",
"\n",
" plt.tight_layout()\n",
" plt.savefig(\"../../plots/manticore_vs_carrick.png\", dpi=450)\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## All possible things"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Dipole magnitude"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"sim = \"IndranilVoid_gauss\"\n",
"\n",
"X = []\n",
"for cat in cats:\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\",\n",
" sample_mag_dipole=False,\n",
" sample_alpha=False, zcmb_max=0.05)\n",
" \n",
" if not exists(fname):\n",
" raise FileNotFoundError(fname)\n",
"\n",
" samples = get_samples(fname, convert_Vext_to_galactic=False)\n",
"\n",
" # keys = list(samples.keys())\n",
" # for key in keys:\n",
" # if cat in key:\n",
" # value = samples.pop(key)\n",
" # samples[key.replace(f\"_{cat}\",'')] = value\n",
" \n",
" samples = samples_to_getdist(samples, catalogue_to_pretty(cat))\n",
" X.append(samples)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# params = [\"Vmag\", \"l\", \"b\", \"a_dipole_mag\", \"a_dipole_l\", \"a_dipole_b\"]\n",
"params = [\"Vx\", \"Vy\", \"Vz\"]\n",
"# params = [\"Vmag\", \"l\", \"b\"]\n",
"\n",
"with plt.style.context('science'):\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(catalogue_to_pretty(cat), y=1.025)\n",
" plt.gcf().tight_layout()\n",
" plt.gcf().savefig(f\"../../plots/vext_{sim}.png\", dpi=500, bbox_inches='tight')"
]
},
{
"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": null,
"metadata": {},
"outputs": [],
"source": [
"simname = \"Carrick2015\"\n",
"catalogue = \"Pantheon+\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Goodness-of-fit"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"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": null,
"metadata": {},
"outputs": [],
"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": "markdown",
"metadata": {},
"source": [
2024-09-17 09:26:04 +00:00
"## Void testing"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Evidence comparison"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"zcmb_max = 0.05\n",
"\n",
"sims = [\"no_field\", \"IndranilVoid_exp\"]\n",
"cats = [\"LOSS\", \"Foundation\", \"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
"neglnZ = {}\n",
2024-09-17 09:26:04 +00:00
"kfound = []\n",
"for sim in sims:\n",
" for cat in cats:\n",
" sample_alpha = sim not in [\"IndranilVoid_exp\", \"no_field\"]\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\",\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max)\n",
2024-09-17 09:26:04 +00:00
" \n",
"\n",
" neglnZ[f\"{sim}_{cat}\"] = get_gof(\"neg_lnZ_harmonic\", fname)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"simA = sims[0]\n",
"simB = sims[1]\n",
"\n",
"print(f\"lnZ_({simA}) - lnZ_({simB})\\n\")\n",
"for cat in cats:\n",
" lnZ_A = - neglnZ[f\"{simA}_{cat}\"]\n",
" lnZ_B = - neglnZ[f\"{simB}_{cat}\"]\n",
" print(f\"{cat:15s} {lnZ_A - lnZ_B:.1f}\")\n",
"\n",
"\n",
"print(f\"\\n(Positive -> preference for {simA})\")"
]
},
2024-09-17 09:26:04 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. Goodness-of-fit comparison"
]
},
{
"cell_type": "code",
2024-09-17 20:01:15 +00:00
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
2024-09-17 09:26:04 +00:00
"zcmb_max = 0.05\n",
2024-09-17 20:01:15 +00:00
"no_Vext = True\n",
2024-09-17 09:26:04 +00:00
"\n",
"sims = [\"IndranilVoid_exp\", \"IndranilVoid_gauss\", \"IndranilVoid_mb\"]\n",
"cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
"neglnZ = {}\n",
"kfound = {}\n",
"for sim in sims:\n",
" for cat in cats:\n",
" kfound[f\"{sim}_{cat}\"] = []\n",
" for ksim in range(500):\n",
" sample_alpha = False\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\", nsim=ksim,\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max,\n",
2024-09-17 20:01:15 +00:00
" sample_beta=True,\n",
2024-09-17 09:26:04 +00:00
" no_Vext=no_Vext, verbose_print=False)\n",
"\n",
" if not exists(fname):\n",
" continue\n",
"\n",
" kfound[f\"{sim}_{cat}\"].append(ksim)\n",
" neglnZ[f\"{sim}_{cat}_{ksim}\"] = get_gof(\"neg_lnZ_harmonic\", fname)\n",
"\n",
"\n",
"neglnZ_no_field = {}\n",
"neglnZ_dipole = {}\n",
"sim = \"no_field\"\n",
"for cat in cats:\n",
" sample_alpha = False\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\",\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max,\n",
" no_Vext=True, verbose_print=False)\n",
"\n",
" if not exists(fname):\n",
" continue\n",
"\n",
2024-09-17 09:26:04 +00:00
" neglnZ_no_field[f\"{cat}\"] = get_gof(\"neg_lnZ_harmonic\", fname)\n",
"\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\",\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max,\n",
" no_Vext=None, verbose_print=False)\n",
"\n",
" if not exists(fname):\n",
" continue\n",
"\n",
" neglnZ_dipole[f\"{cat}\"] = get_gof(\"neg_lnZ_harmonic\", fname)\n"
]
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
2024-09-17 20:01:15 +00:00
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
2024-09-17 09:26:04 +00:00
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
" figwidth = 8.3 \n",
" fig, axs = plt.subplots(2, 2, figsize=(figwidth, 0.65 * figwidth))\n",
"\n",
" for n, cat in enumerate(cats):\n",
" i, j = n // 2, n % 2\n",
" ax = axs[i, j]\n",
"\n",
" for sim in sims:\n",
" x = kfound[f\"{sim}_{cat}\"]\n",
" y = [neglnZ[f\"{sim}_{cat}_{ksim}\"] / np.log(10) for ksim in x]\n",
" x = np.array(x) * 0.674\n",
" ax.plot(x, y, label=simname_to_pretty(sim))\n",
" \n",
" # if no_Vext is None:\n",
" # y_no_field = neglnZ_no_field[cat] / np.log(10)\n",
" # if cat != \"CF4_TFR_w1\":\n",
" # ax.axhline(y_no_field, color=\"black\", ls=\"--\", label=\"No peculiar velocity\")\n",
" y_no_field = neglnZ_no_field[cat] / np.log(10)\n",
" ax.axhline(y_no_field, color=\"black\", ls=\"--\", label=\"No peculiar velocity\")\n",
"\n",
" y_dipole = neglnZ_dipole[cat] / np.log(10)\n",
" ax.axhline(y_dipole, color=\"black\", ls=\":\", label=\"Constant dipole\")\n",
"\n",
" ax.text(0.5, 0.9, catalogue_to_pretty(cat),\n",
" transform=ax.transAxes, #fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='center',\n",
" bbox=dict(facecolor='white', alpha=0.5),\n",
" )\n",
"\n",
" if n == 0:\n",
" ax.legend(fontsize=\"small\", loc=\"upper left\")\n",
"\n",
" ax.set_ylabel(r\"$-\\Delta \\log \\mathcal{Z}$\")\n",
" ax.set_xlabel(r\"$R_{\\rm offset} ~ [\\mathrm{Mpc} / h]$\")\n",
" ax.set_xlim(0)\n",
"\n",
" fig.tight_layout()\n",
" fname = f\"../../plots/void_goodness_of_fit_observer.png\"\n",
" if no_Vext:\n",
" fname = fname.replace(\".png\", \"_no_Vext.png\")\n",
" print(f\"Saving to `{fname}`.\")\n",
" fig.savefig(fname, dpi=450)\n",
" fig.show()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-09-17 09:53:42 +00:00
"### 2. Single parameter radial dependence"
2024-09-17 09:26:04 +00:00
]
},
{
"cell_type": "code",
2024-09-17 20:01:15 +00:00
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
2024-09-17 09:26:04 +00:00
"zcmb_max = 0.05\n",
2024-09-17 20:01:15 +00:00
"key = \"beta\"\n",
"# key_label = r\"$\\sigma_v ~ [\\mathrm{km} / \\mathrm{s}]$\"\n",
2024-09-17 09:53:42 +00:00
"# key_label = r\"$|\\mathbf{V}_{\\rm ext}| ~ [\\mathrm{km} / \\mathrm{s}]$\"\n",
2024-09-17 20:01:15 +00:00
"key_label = r\"$\\beta$\"\n",
2024-09-17 09:53:42 +00:00
"no_Vext = True\n",
"\n",
2024-09-17 09:26:04 +00:00
"sims = [\"IndranilVoid_exp\", \"IndranilVoid_gauss\", \"IndranilVoid_mb\"]\n",
"cats = [\"2MTF\", \"SFI_gals\", \"CF4_TFR_i\", \"CF4_TFR_w1\"]\n",
"\n",
2024-09-17 09:26:04 +00:00
"data_mean = {}\n",
"data_std = {}\n",
"kfound = {}\n",
"for sim in sims:\n",
" for cat in cats:\n",
" kfound[f\"{sim}_{cat}\"] = []\n",
" for ksim in range(500):\n",
" sample_alpha = False\n",
" fname = paths.flow_validation(\n",
" fdir, sim, cat, inference_method=\"mike\", nsim=ksim,\n",
" sample_alpha=sample_alpha, zcmb_max=zcmb_max,\n",
2024-09-17 20:01:15 +00:00
" sample_beta=True,\n",
2024-09-17 09:26:04 +00:00
" no_Vext=no_Vext, verbose_print=False)\n",
"\n",
" if not exists(fname):\n",
" continue\n",
"\n",
" kfound[f\"{sim}_{cat}\"].append(ksim)\n",
" with File(fname, 'r') as f:\n",
" x = f[f\"samples/{key}\"][...]\n",
" if key == \"Vext\":\n",
" x = np.linalg.norm(x, axis=-1)\n",
"\n",
" data_mean[f\"{sim}_{cat}_{ksim}\"] = x.mean()\n",
" data_std[f\"{sim}_{cat}_{ksim}\"] = x.std()"
]
},
{
"cell_type": "code",
2024-09-17 12:11:53 +00:00
"execution_count": null,
2024-09-17 09:53:42 +00:00
"metadata": {},
2024-09-17 12:11:53 +00:00
"outputs": [],
2024-09-17 20:01:15 +00:00
"source": []
},
{
"cell_type": "code",
2024-09-18 22:42:17 +00:00
"execution_count": null,
2024-09-17 20:01:15 +00:00
"metadata": {},
2024-09-18 22:42:17 +00:00
"outputs": [],
2024-09-17 09:26:04 +00:00
"source": [
"with plt.style.context('science'):\n",
" plt.rcParams.update({'font.size': 9})\n",
"\n",
" figwidth = 8.3\n",
" fig, axs = plt.subplots(2, 2, figsize=(figwidth, 0.65 * figwidth))\n",
"\n",
" for n, cat in enumerate(cats):\n",
" i, j = n // 2, n % 2\n",
" ax = axs[i, j]\n",
"\n",
" for sim in sims:\n",
" x = kfound[f\"{sim}_{cat}\"]\n",
" y = [data_mean[f\"{sim}_{cat}_{ksim}\"] for ksim in x]\n",
" yerr = [data_std[f\"{sim}_{cat}_{ksim}\"] for ksim in x]\n",
" x = np.array(x) * 0.674\n",
"\n",
" ax.plot(x, y, label=simname_to_pretty(sim))\n",
2024-09-17 20:01:15 +00:00
" ax.fill_between(x, np.array(y) - np.array(yerr), np.array(y) + np.array(yerr), alpha=0.5)\n",
2024-09-17 09:26:04 +00:00
"\n",
" ax.text(0.5, 0.9, catalogue_to_pretty(cat),\n",
" transform=ax.transAxes, #fontsize=\"small\",\n",
" verticalalignment='center', horizontalalignment='center',\n",
" bbox=dict(facecolor='white', alpha=0.5),\n",
" )\n",
"\n",
" if n == 0:\n",
" ax.legend(fontsize=\"small\", loc='upper right')\n",
"\n",
" ax.set_ylabel(key_label)\n",
" ax.set_xlabel(r\"$R_{\\rm offset} ~ [\\mathrm{Mpc} / h]$\")\n",
" ax.set_xlim(0),\n",
"\n",
" fig.tight_layout()\n",
" fname = f\"../../plots/void_{key}_per_observer.png\"\n",
" if no_Vext:\n",
" fname = fname.replace(\".png\", \"_no_Vext.png\")\n",
" print(f\"Saving to `{fname}`.\")\n",
" fig.savefig(fname, dpi=450)\n",
" fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2024-07-03 08:51:00 +00:00
"source": []
2024-09-17 09:26:04 +00:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"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
}