2024-03-08 10:44:19 +00:00
{
"cells": [
2024-03-21 15:50:37 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Calibrating the velocity field against observations "
]
},
2024-03-08 10:44:19 +00:00
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 1,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-04-01 22:19:14 +00:00
"outputs": [],
2024-03-08 10:44:19 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"# 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-03-08 10:44:19 +00:00
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import jax\n",
2024-06-26 09:43:26 +00:00
"from jax import numpy as jnp\n",
2024-03-16 17:16:22 +00:00
"from numpyro.infer import MCMC, NUTS, init_to_median\n",
"import corner\n",
2024-03-21 15:50:37 +00:00
"from getdist import plots\n",
"from scipy.stats import multivariate_normal\n",
2024-03-08 10:44:19 +00:00
"\n",
"import csiborgtools\n",
"\n",
2024-03-21 15:50:37 +00:00
"from flow_calibration import *\n",
"\n",
2024-03-08 10:44:19 +00:00
"%load_ext autoreload\n",
"%autoreload 2\n",
2024-03-16 17:16:22 +00:00
"%matplotlib inline\n",
2024-03-08 10:44:19 +00:00
"\n",
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## LOS density & radial velocity plots "
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 2,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"2024-06-26 08:43:14.168393: reading the catalogue,\n",
"2024-06-26 08:43:14.224388: reading the interpolated field,\n",
"2024-06-26 08:43:14.298118: calculating the radial velocity.\n"
2024-06-21 18:21:06 +00:00
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:91: UserWarning: The number of radial steps is even. Skipping the first step at 0.0 because Simpson's rule requires an odd number of steps.\n",
2024-06-21 18:21:06 +00:00
" warn(f\"The number of radial steps is even. Skipping the first \"\n"
]
}
],
2024-03-08 10:44:19 +00:00
"source": [
2024-06-21 18:21:06 +00:00
"fpath = \"/mnt/extraspace/rstiskalek/catalogs/PV_compilation.hdf5\"\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-06-21 18:21:06 +00:00
"loader_carrick = csiborgtools.flow.DataLoader(\"Carrick2015\", 0, \"LOSS\", fpath, paths, ksmooth=0, )\n",
"loaders_csiborg2X = [csiborgtools.flow.DataLoader(\"csiborg2X\", i, \"LOSS\", fpath, paths, ksmooth=1, verbose=False) for i in range(20)]\n",
"loaders_csiborg2 = [csiborgtools.flow.DataLoader(\"csiborg2_main\", i, \"LOSS\", fpath, paths, ksmooth=1, verbose=False) for i in range(20)]"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 2,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-06-26 09:43:26 +00:00
"outputs": [
{
"ename": "NameError",
"evalue": "name 'loaders_csiborg2X' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m cols \u001b[38;5;241m=\u001b[39m plt\u001b[38;5;241m.\u001b[39mrcParams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124maxes.prop_cycle\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mby_key()[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcolor\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# CSiBORG2\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m x \u001b[38;5;241m=\u001b[39m \u001b[43mloaders_csiborg2X\u001b[49m[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39mrdist\n\u001b[1;32m 9\u001b[0m y \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39masarray([loaders_csiborg2[i]\u001b[38;5;241m.\u001b[39mlos_density[k, :] \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(loaders_csiborg2X))])\n\u001b[1;32m 10\u001b[0m ylow, ymed, yhigh \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mpercentile(y, [\u001b[38;5;241m16\u001b[39m, \u001b[38;5;241m50\u001b[39m, \u001b[38;5;241m84\u001b[39m], axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0\u001b[39m)\n",
"\u001b[0;31mNameError\u001b[0m: name 'loaders_csiborg2X' is not defined"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAl0AAAJMCAYAAADACBMVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAt1ElEQVR4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mILgCABEQXAEACogsAIAHRBQCQgOgCAEhAdAEAJCC6AAASEF0AAAmILgCABEQXAEACogsAIAHRBQCQgOgCAEhAdAEAJCC6AAASEF0AAAmILgCABEQXAEACogsAIAHRBQCQgOgCAEhAdAEAJDCm6GppaYmqqqooKSmJ6urq2Llz53vOX79+fXz605+O008/PSorK2P58uXxl7/8ZUwbBgCYiPKOri1btkRDQ0M0NTXF7t27Y9asWVFXVxcHDhwYdf5jjz0WK1eujKamptizZ088/PDDsWXLlrjzzjs/8OYBACaKvKNr3bp1cdNNN8XSpUvjoosuio0bN8YZZ5wRjzzyyKjzn3322bj88svj+uuvj6qqqrj66qvjuuuue9+7YwAAHyZ5RdfAwEDs2rUramtr3z1AYWHU1tZGe3v7qGsuu+yy2LVr13Bk7du3L7Zt2xbXXHPNUc/T398fvb29I14AABPZpHwmHzp0KAYHB6O8vHzEeHl5eezdu3fUNddff30cOnQovvCFL0SWZfHOO+/ELbfc8p4fLzY3N8eaNWvy2RoAwElt3H96cceOHbF27dp48MEHY/fu3fHEE0/E1q1b45577jnqmsbGxujp6Rl+7d+/f7y3CQAwrvK60zVlypQoKiqK7u7uEePd3d1RUVEx6pq77747Fi1aFDfeeGNERFx88cXR19cXN998c6xatSoKC4/svlwuF7lcLp+tAQCc1PK601VcXBxz586Ntra24bGhoaFoa2uLmpqaUde89dZbR4RVUVFRRERkWZbvfgEAJqS87nRFRDQ0NMSSJUti3rx5MX/+/Fi/fn309fXF0qVLIyJi8eLFMWPGjGhubo6IiAULFsS6detizpw5UV1dHa+88krcfffdsWDBguH4AgD4sMs7uurr6+PgwYOxevXq6OrqitmzZ0dra+vwl+s7OztH3Nm66667oqCgIO666654/fXX46Mf/WgsWLAgvvvd7x6/dwEAcJIryCbAZ3y9vb1RVlYWPT09UVpaeqK3AwB8iI1Xd/jdiwAACYguAIAERBcAQAKiCwAgAdEFAJCA6AIASEB0AQAkILoAABIQXQAACYguAIAERBcAQAKiCwAgAdEFAJCA6AIASEB0AQAkILo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AkILoAABIQXQAACYguAIAERBcAQAKiCwAgAdEFAJCA6AIASEB0AQAkILoAABIQXQAACYguAIAERBcAQAKiCwAgAdEFAJCA6AIASEB0AQAkILoAABIQXQAACYguAIAERBcAQAKiCwAgAdEFAJCA6AIASEB0AQAkILoAABIQXQAACYguAIAExhRdLS0tUVVVFSUlJVFdXR07d+48pnWbN2+OgoKCWLhw4VhOCwAwYeUdXVu2bImGhoZoamqK3bt3x6xZs6Kuri4OHDjwnutee+21+MY3vhFXXHHFmDcLADBR5R1d69ati5tuuimWLl0aF110UWzcuDHOOOOMeOSRR466ZnBwML72ta/FmjVr4rzzzvtAGwYAmIjyiq6BgYHYtWtX1NbWvnuAwsKora2N9vb2o6779re/HVOnTo0bbrjhmM7T398fvb29I14AABNZXtF16NChGBwcjPLy8hHj5eXl0dXVNeqaZ555Jh5++OHYtGnTMZ+nubk5ysrKhl+VlZX5bBMA4KQzrj+9+Oabb8aiRYti06Z
"text/plain": [
"<Figure size 700x700 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
2024-03-08 10:44:19 +00:00
"source": [
2024-06-21 18:21:06 +00:00
"ks = [i for i in range(50)]\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-06-21 18:21:06 +00:00
"for k in ks:\n",
2024-03-16 17:02:00 +00:00
" fig, axs = plt.subplots(2, 1, figsize=(7, 7), sharex=True)\n",
" fig.subplots_adjust(wspace=0)\n",
2024-06-21 18:21:06 +00:00
" cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
2024-03-16 17:02:00 +00:00
" # CSiBORG2\n",
2024-06-21 18:21:06 +00:00
" x = loaders_csiborg2X[0].rdist\n",
" y = np.asarray([loaders_csiborg2[i].los_density[k, :] for i in range(len(loaders_csiborg2X))])\n",
" ylow, ymed, yhigh = np.percentile(y, [16, 50, 84], axis=0)\n",
" axs[0].fill_between(x, ylow, yhigh, color=cols[0], alpha=0.25)\n",
" axs[0].plot(x, ymed, color=cols[0], label=\"CSiBORG2\")\n",
"\n",
" y = np.asarray([loaders_csiborg2[i].los_radial_velocity[k, :] for i in range(len(loaders_csiborg2X))])\n",
" ylow, ymed, yhigh = np.percentile(y, [16, 50, 84], axis=0)\n",
" axs[1].fill_between(x, ylow, yhigh, color=cols[0], alpha=0.25)\n",
" axs[1].plot(x, ymed, color=cols[0], label=\"CSiBORG2\")\n",
"\n",
" # CSiBORG2X\n",
" x = loaders_csiborg2X[0].rdist\n",
" y = np.asarray([loaders_csiborg2X[i].los_density[k, :] for i in range(len(loaders_csiborg2X))])\n",
" ylow, ymed, yhigh = np.percentile(y, [16, 50, 84], axis=0)\n",
" axs[0].fill_between(x, ylow, yhigh, color=cols[1], alpha=0.25)\n",
" axs[0].plot(x, ymed, color=cols[1], label=\"CSiBORG2X\")\n",
"\n",
" y = np.asarray([loaders_csiborg2X[i].los_radial_velocity[k, :] for i in range(len(loaders_csiborg2X))])\n",
" ylow, ymed, yhigh = np.percentile(y, [16, 50, 84], axis=0)\n",
" axs[1].fill_between(x, ylow, yhigh, color=cols[1], alpha=0.25)\n",
" axs[1].plot(x, ymed, color=cols[1], label=\"CSiBORG2X\")\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-03-16 17:02:00 +00:00
" # Plot Carrick+2015\n",
2024-06-21 18:21:06 +00:00
" axs[0].plot(loader_carrick.rdist, loader_carrick.los_density[k, :], color=\"red\", label=\"Carrick+2015\")\n",
" axs[1].plot(loader_carrick.rdist, loader_carrick.los_radial_velocity[k, :] * 0.43, color=\"red\")\n",
2024-03-08 10:44:19 +00:00
"\n",
"\n",
2024-03-16 17:02:00 +00:00
" axs[1].set_xlabel(r\"$r ~ [\\mathrm{Mpc} / h]$\")\n",
" axs[0].set_ylabel(r\"$\\rho_{\\rm LOS} / \\langle \\rho_{\\rm matter} \\rangle$\")\n",
" axs[1].set_ylabel(r\"$v_{\\rm LOS} ~ [\\mathrm{km/s}]$\")\n",
" axs[0].set_yscale(\"log\")\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-03-16 17:02:00 +00:00
" axs[0].legend(loc=\"upper right\")\n",
" axs[0].set_xlim(0, 200)\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-03-16 17:02:00 +00:00
" fig.tight_layout(w_pad=0, h_pad=0)\n",
2024-06-21 18:21:06 +00:00
" fig.savefig(f\"../../plots/LOSS_los_{k}.png\", dpi=500, bbox_inches=\"tight\")\n",
2024-03-16 17:02:00 +00:00
"\n",
" fig.show()"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test running a model"
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 22,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"2024-06-26 08:49:16.604687: reading the catalogue,\n",
"2024-06-26 08:49:16.612221: reading the interpolated field,\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2024-06-26 08:49:16.629812: calculating the radial velocity.\n",
"2024-06-26 08:49:16.637461: reading the catalogue,\n",
"2024-06-26 08:49:16.645362: reading the interpolated field,\n",
"2024-06-26 08:49:16.690361: calculating the radial velocity.\n"
2024-06-21 18:21:06 +00:00
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:91: UserWarning: The number of radial steps is even. Skipping the first step at 0.0 because Simpson's rule requires an odd number of steps.\n",
" warn(f\"The number of radial steps is even. Skipping the first \"\n"
]
}
],
2024-03-08 10:44:19 +00:00
"source": [
2024-04-23 11:02:09 +00:00
"fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/PV_compilation.hdf5\"\n",
2024-03-16 17:02:00 +00:00
"# fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/A2.h5\"\n",
2024-04-23 11:02:09 +00:00
"# fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/PV_mock_CB2_17417_large.hdf5\"\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-06-26 09:43:26 +00:00
"simname = \"csiborg2X\"\n",
"catalogue = \"LOSS\"\n",
"loader = csiborgtools.flow.DataLoader(simname, [0], catalogue, fpath_data, paths, ksmooth=0, )\n",
"loader_mult = csiborgtools.flow.DataLoader(simname, [0, 0, 0, 0, 0], catalogue, fpath_data, paths, ksmooth=0, )\n",
"\n",
"\n",
"SN_hyperparams = {\"e_mu_mean\": 0.1, \"e_mu_std\": 0.05, \n",
" \"mag_cal_mean\": -18.25, \"mag_cal_std\": 0.5,\n",
" \"alpha_cal_mean\": 0.148, \"alpha_cal_std\": 0.05,\n",
" \"beta_cal_mean\": 3.112, \"beta_cal_std\": 1.0,\n",
" }\n",
"calibration_hyperparams = {\"Vext_std\": 250,\n",
" \"alpha_mean\": 1.0, \"alpha_std\": 0.5,\n",
" \"beta_mean\": 1.0, \"beta_std\": 0.5,\n",
" \"sigma_v_mean\": 150., \"sigma_v_std\": 100.,\n",
" \"sample_alpha\": True, \"sample_beta\": True,\n",
" }\n",
2024-06-20 13:33:00 +00:00
"get_model_kwargs = {\"zcmb_max\": 0.05}"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-03-21 15:50:37 +00:00
"#### Running HMC"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 23,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"Selected 50/50 galaxies.\n",
"Selected 50/50 galaxies.\n"
2024-06-21 18:21:06 +00:00
]
}
],
2024-03-08 10:44:19 +00:00
"source": [
2024-03-26 09:42:53 +00:00
"model = csiborgtools.flow.get_model(loader, **get_model_kwargs)\n",
2024-06-26 09:43:26 +00:00
"model_mult = csiborgtools.flow.get_model(loader_mult, **get_model_kwargs)\n",
"model_kwargs = {\"distmod_hyperparams\": SN_hyperparams, \"calibration_hyperparams\": calibration_hyperparams,}"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 24,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"sample: 100%|██████████| 1000/1000 [01:12<00:00, 13.84it/s, 7 steps of size 3.69e-01. acc. prob=0.90] \n"
2024-06-21 18:21:06 +00:00
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
2024-06-26 09:43:26 +00:00
" mean std median 5.0% 95.0% n_eff r_hat\n",
" Vext[0] 52.11 78.33 51.46 -79.62 181.68 411.62 1.00\n",
" Vext[1] 118.56 115.94 119.97 -59.27 312.47 324.37 1.00\n",
" Vext[2] -4.41 159.70 -12.18 -261.86 252.69 255.23 1.02\n",
" alpha 0.50 0.35 0.49 -0.02 1.07 185.82 1.00\n",
" alpha_cal 0.13 0.02 0.13 0.10 0.17 551.23 1.01\n",
" beta 1.11 0.36 1.15 0.52 1.66 197.49 1.00\n",
" beta_cal 3.56 0.23 3.56 3.16 3.90 262.57 1.00\n",
" e_mu 0.08 0.03 0.08 0.04 0.12 248.50 1.00\n",
" mag_cal -18.18 0.04 -18.19 -18.25 -18.12 313.96 1.04\n",
" sigma_v 216.41 75.53 212.88 94.54 333.95 187.59 1.00\n",
2024-06-21 18:21:06 +00:00
"\n",
"Number of divergences: 0\n"
]
}
],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"kernel = NUTS(model, init_strategy=init_to_median(num_samples=100))\n",
2024-06-26 09:43:26 +00:00
"mcmc = MCMC(kernel, num_warmup=500, num_samples=500)\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-06-21 18:21:06 +00:00
"rng_key = jax.random.PRNGKey(5)\n",
2024-06-26 09:43:26 +00:00
"mcmc.run(rng_key, extra_fields=(\"potential_energy\",), **model_kwargs)\n",
2024-06-21 18:21:06 +00:00
"mcmc.print_summary()\n",
"samples = mcmc.get_samples()"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 25,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-20 13:33:00 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-06-26 09:43:26 +00:00
"from numpyro.infer import log_likelihood"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"ll_single = log_likelihood(model, samples, **model_kwargs)[\"ll\"]\n",
"ll_mult = log_likelihood(model_mult, samples, **model_kwargs, )[\"ll\"]"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
" 0., 0., 0., 0., 0., 0., 0.], dtype=float32)"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ll_single - ll_mult"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([-374.78827, -376.5492 , -371.77686, -372.9841 , -378.55914,\n",
" -378.39984, -378.2459 , -375.273 , -377.44177, -377.93024,\n",
" -379.78754, -376.69867, -376.69543, -373.6802 , -378.27258,\n",
" -375.40875, -375.0953 , -372.4082 , -378.23706, -373.86218,\n",
" -378.33875, -376.94678, -373.83652, -378.32117, -378.96307,\n",
" -376.3273 , -378.99994, -375.4494 , -377.64166, -375.86154,\n",
" -378.59518, -380.15732, -377.50745, -380.40387, -376.8189 ,\n",
" -376.1007 , -373.51187, -377.10147, -374.32153, -374.2683 ,\n",
" -375.59872, -376.4356 , -377.2743 , -377.35114, -374.19208,\n",
" -376.06555, -380.0948 , -374.54852, -377.23047, -382.89264,\n",
" -380.85538, -378.4214 , -375.15735, -373.39212, -375.85846,\n",
" -375.65417, -376.16678, -375.97055, -378.42426, -376.42603,\n",
" -377.9259 , -372.40448, -373.42722, -374.55554, -378.3473 ,\n",
" -373.24213, -374.04 , -374.16534, -374.32443, -379.45923,\n",
" -375.31113, -378.57886, -375.84442, -377.4536 , -376.42334,\n",
" -377.72723, -376.27448, -377.9539 , -373.5795 , -374.67526,\n",
" -372.17963, -372.82324, -374.28815, -373.96506, -376.82507,\n",
" -376.93213, -375.63318, -375.7738 , -375.90573, -378.0384 ,\n",
" -378.0224 , -379.54617, -378.00513, -377.14618, -378.09073,\n",
" -375.86597, -378.58353, -375.02972, -378.62332, -375.34515,\n",
" -377.38895, -376.81897, -377.08514, -378.20892, -374.73334,\n",
" -374.945 , -374.85724, -374.56958, -375.57413, -375.072 ,\n",
" -377.19028, -377.54443, -374.5007 , -376.54013, -374.14465,\n",
" -374.65546, -375.77112, -373.91183, -374.46637, -374.3336 ,\n",
" -378.4422 , -375.58517, -376.24066, -374.48282, -376.95374,\n",
" -372.74634, -372.97794, -374.2119 , -376.01407, -378.1242 ,\n",
" -378.89832, -375.39142, -375.29816, -376.1898 , -374.10272,\n",
" -375.10376, -376.2453 , -377.4701 , -378.1543 , -373.8468 ,\n",
" -376.58026, -374.8551 , -375.1272 , -376.64966, -377.48123,\n",
" -380.61816, -378.7544 , -374.92545, -374.71252, -372.59912,\n",
" -373.55402, -373.39218, -374.92795, -373.6598 , -376.6132 ,\n",
" -377.88617, -373.76184, -378.83252, -378.48187, -378.70923,\n",
" -380.9616 , -381.7417 , -376.7549 , -379.59344, -380.48926,\n",
" -374.94775, -376.39612, -374.6676 , -379.39023, -381.8791 ,\n",
" -377.42413, -375.87958, -374.0121 , -375.43823, -372.45062,\n",
" -372.70752, -373.5069 , -375.3844 , -375.36328, -373.78485,\n",
" -376.49564, -374.79987, -375.86487, -374.06674, -377.0426 ,\n",
" -377.5667 , -379.7243 , -379.37122, -376.22632, -375.70654,\n",
" -377.56372, -377.34256, -373.73972, -377.02332, -375.53345,\n",
" -378.89685, -377.6688 , -378.84888, -383.19537, -382.12585,\n",
" -382.6466 , -376.49536, -375.93127, -377.6048 , -373.5756 ,\n",
" -375.25043, -374.0218 , -374.23123, -377.78134, -375.96564,\n",
" -378.48746, -376.1507 , -374.9716 , -373.93018, -374.73456,\n",
" -376.74103, -376.92188, -375.25317, -374.2467 , -374.29163,\n",
" -376.87674, -376.17133, -376.6051 , -376.20227, -378.027 ,\n",
" -374.63226, -373.1444 , -378.2168 , -374.78253, -377.88095,\n",
" -376.7299 , -374.00055, -374.18256, -374.50098, -377.90918,\n",
" -377.5914 , -376.723 , -375.05054, -374.03278, -372.99585,\n",
" -377.1592 , -378.5726 , -382.3648 , -381.95084, -379.8012 ,\n",
" -377.27887, -374.89774, -374.56357, -375.84525, -377.89868,\n",
" -382.2562 , -375.49042, -379.07535, -374.9853 , -376.29773,\n",
" -374.1893 , -375.35574, -380.31897, -376.27448, -376.47168,\n",
" -374.6464 , -378.147 , -375.70886, -376.68924, -375.76617,\n",
" -376.2506 , -378.01782, -382.2915 , -374.9214 , -376.70178,\n",
" -376.90546, -377.411 , -375.27643, -373.80533, -372.5861 ,\n",
" -373.1949 , -376.22168, -377.56824, -378.8287 , -375.53308,\n",
" -374.56818, -382.15012, -374.25894, -381.0781 , -374.3027 ,\n",
" -380.56134, -376.60718, -376.42545, -375.17792, -376.3213 ,\n",
" -374.37567, -373.76025, -374.4405 , -375.02045, -375.70337,\n",
" -374.74585, -375.88458, -374.74628, -374.50763, -375.70026,\n",
" -377.86438, -378.53693, -378.09235, -381.33105, -376.464 ,\n",
" -378.4175 , -378.98584, -375.14954, -378.98206, -376.01047,\n",
" -376.45996, -377.2332 , -374.2134 , -375.89975, -375.65414,\n",
" -374.02612, -372.55133, -375.69962, -374.4325 , -376.36453,\n",
" -373.98578, -375.55103, -377.81378, -377.8647 , -377.20526,\n",
" -376.3604 , -381.58832, -376.55713, -376.03836, -376.24966,\n",
" -373.95 , -379.94614, -377.0968 , -377.84164, -376.44522,\n",
" -377.85254, -378.3142 , -375.67706, -380.1999 , -376.95044,\n",
" -373.88947, -374.81598, -376.07452, -377.36395, -379.3869 ,\n",
" -375.50687, -377.68784, -376.3739 , -375.44025, -375.18735,\n",
" -376.06638, -376.60834, -376.28995, -377.0169 , -380.38916,\n",
" -379.51105, -382.0304 , -380.0194 , -378.8652 , -375.53314,\n",
" -375.5034 , -374.6402 , -376.51093, -377.72595, -380.00995,\n",
" -379.5835 , -377.2257 , -379.3488 , -379.24078, -377.37265,\n",
" -381.14996, -376.83673, -376.86017, -376.98822, -376.59003,\n",
" -377.82474, -378.2244 , -376.83997, -375.96432, -374.3552 ,\n",
" -372.27533, -380.0143 , -374.36603, -373.62616, -373.85562,\n",
" -373.1689 , -374.1674 , -373.0071 , -373.59494, -376.51263,\n",
" -373.30582, -374.53265, -374.3034 , -379.04468, -374.61243,\n",
" -376.40887, -376.2823 , -381.99615, -379.41455, -377.62433,\n",
" -376.36798, -378.97614, -375.00592, -377.91043, -377.10544,\n",
" -375.4801 , -376.89624, -374.7605 , -375.33405, -374.52933,\n",
" -375.02234, -375.1839 , -376.97693, -376.73566, -376.3647 ,\n",
" -377.85864, -376.54773, -377.09457, -379.05438, -378.02417,\n",
" -375.28592, -375.15805, -374.34442, -380.4338 , -376.1878 ,\n",
" -373.36633, -376.19815, -376.89926, -376.19022, -377.86075,\n",
" -377.2689 , -377.83676, -375.71466, -377.34888, -375.27258,\n",
" -376.75476, -377.30792, -377.51782, -379.70868, -376.17413,\n",
" -375.9779 , -377.96228, -374.87674, -373.77216, -375.6394 ,\n",
" -375.8968 , -373.49118, -373.32666, -374.5882 , -375.28967,\n",
" -375.78192, -377.6034 , -377.48282, -377.46722, -376.3749 ,\n",
" -376.20535, -376.85107, -376.78308, -376.67972, -376.1621 ,\n",
" -378.71033, -374.8225 , -377.3939 , -373.82043, -375.69586,\n",
" -377.2488 , -374.63022, -374.32742, -374.76212, -379.32126,\n",
" -379.09344, -375.42993, -378.1632 , -375.69092, -375.98285,\n",
" -377.10352, -376.98743, -374.9332 , -375.23105, -374.81265,\n",
" -374.3098 , -372.58917, -373.61246, -376.50525, -376.5714 ,\n",
" -374.68048, -375. , -375.02234, -377.66193, -379.3037 ,\n",
" -378.351 , -375.5417 , -378.686 , -376.46448, -377.3991 ,\n",
" -376.28412, -379.40198, -374.2234 , -372.92682, -376.41956], dtype=float32)"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 10,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"data": {
"text/plain": [
2024-06-26 09:43:26 +00:00
"Array([391.9341 , 392.08212, 391.02206, 389.15616, 398.34534, 398.74045,\n",
" 394.00363, 394.9679 , 392.753 , 392.53403, 390.58237, 389.0428 ,\n",
" 390.0239 , 393.4534 , 392.26123, 390.88834, 389.4346 , 388.27728,\n",
" 388.42407, 390.7624 , 393.82834, 396.3672 , 393.64532, 392.78622,\n",
" 394.62543, 392.79187, 394.0692 , 394.19113, 393.68393, 393.9558 ,\n",
" 394.51782, 394.80338, 394.38104, 392.66638, 392.84058, 393.24478,\n",
" 394.0837 , 394.68433, 390.162 , 392.5648 , 390.56827, 394.7597 ,\n",
" 394.33154, 393.9468 , 391.83417, 394.58472, 394.23224, 391.1751 ,\n",
" 391.31418, 399.5129 , 394.8937 , 393.32156, 389.23395, 389.13815,\n",
" 389.2338 , 390.08365, 392.15442, 391.80756, 396.48865, 392.57013,\n",
" 392.00992, 392.81107, 391.49927, 391.80618, 395.6378 , 393.09927,\n",
" 392.07812, 389.32758, 391.35922, 393.24258, 393.46533, 391.42642,\n",
" 390.91577, 390.9773 , 389.37076, 392.87485, 393.59995, 393.8794 ,\n",
" 394.30118, 392.2907 , 390.15256, 390.99207, 391.33752, 390.59207,\n",
" 394.78662, 393.71133, 395.89343, 397.57526, 394.3614 , 395.2866 ,\n",
" 400.6802 , 393.19537, 392.35477, 395.25443, 391.1807 , 392.4784 ,\n",
" 394.2002 , 390.61996, 393.63477, 394.57047, 396.10788, 393.12854,\n",
" 394.32095, 396.66772, 394.04712, 391.67096, 391.37128, 389.3575 ,\n",
" 389.4813 , 392.70554, 391.0798 , 391.58707, 391.3387 , 392.6452 ,\n",
" 391.1168 , 391.28464, 389.49527, 391.098 , 390.07748, 391.25574,\n",
" 392.2501 , 392.58688, 393.03354, 391.07687, 392.5799 , 390.90054,\n",
" 389.83463, 389.98987, 392.46228, 390.82193, 393.27582, 393.54163,\n",
" 392.20618, 388.82373, 390.24686, 391.1798 , 390.0974 , 391.47324,\n",
" 396.02036, 393.31866, 394.73904, 393.04593, 396.20193, 392.5486 ,\n",
" 392.00214, 396.90887, 394.09827, 391.98636, 391.64633, 392.54788,\n",
" 390.28278, 391.5285 , 391.0113 , 390.20108, 391.2806 , 391.9383 ,\n",
" 394.31247, 392.9718 , 395.74432, 395.6111 , 396.32532, 396.84842,\n",
" 394.43015, 396.00247, 402.50272, 392.72025, 391.83334, 392.79337,\n",
" 396.3226 , 401.59814, 397.6963 , 395.19052, 394.43784, 392.80142,\n",
" 390.1531 , 389.4234 , 389.03558, 389.0597 , 392.2272 , 390.56104,\n",
" 394.64798, 391.2173 , 392.151 , 388.85483, 393.61578, 395.56732,\n",
" 396.60648, 393.86707, 392.8924 , 392.639 , 393.36166, 394.42212,\n",
" 392.52884, 393.4237 , 394.6955 , 392.98947, 392.58792, 394.54013,\n",
" 395.2757 , 394.46317, 396.52585, 393.2268 , 391.0806 , 390.68488,\n",
" 390.83286, 393.68234, 391.00925, 389.52612, 392.32867, 391.63733,\n",
" 392.44458, 397.25595, 392.09634, 394.46027, 392.6832 , 393.11966,\n",
" 392.70135, 392.94568, 390.5427 , 391.2181 , 390.14978, 393.05313,\n",
" 392.1329 , 395.2773 , 390.55872, 389.75958, 392.8294 , 390.34613,\n",
" 390.57422, 393.61807, 393.4588 , 392.6946 , 393.0386 , 390.5007 ,\n",
" 391.86188, 392.18567, 393.70074, 391.2875 , 389.60342, 390.3574 ,\n",
" 392.36462, 396.8469 , 395.1043 , 393.78467, 392.90707, 394.79532,\n",
" 392.64337, 392.04562, 391.07858, 393.60815, 399.3589 , 395.53397,\n",
" 392.84903, 392.6835 , 391.1862 , 391.29715, 393.18088, 396.14114,\n",
" 396.67612, 394.8662 , 395.70645, 393.47675, 396.14685, 395.2865 ,\n",
" 391.64557, 392.49634, 393.31058, 395.3479 , 390.1821 , 392.41928,\n",
" 391.62433, 394.0529 , 392.24847, 391.0419 , 391.29785, 392.43967,\n",
" 391.05963, 392.9988 , 390.8053 , 391.57315, 392.09854, 396.18353,\n",
" 393.75366, 393.8414 , 391.85266, 396.80035, 394.54794, 399.54883,\n",
" 393.41476, 390.52176, 392.8705 , 390.99615, 391.3205 , 392.70792,\n",
" 392.3243 , 389.38223, 392.36218, 392.93887, 393.47202, 391.486 ,\n",
" 390.32257, 390.8464 , 389.24442, 393.06158, 390.1328 , 394.20773,\n",
" 392.92813, 391.93857, 393.84244, 393.34424, 392.4594 , 392.7215 ,\n",
" 389.22064, 390.21176, 390.24298, 390.88086, 388.82172, 390.49158,\n",
" 390.16858, 392.40662, 393.3886 , 394.6822 , 393.8078 , 396.0063 ,\n",
" 393.62537, 392.98868, 395.08075, 394.6271 , 389.055 , 390.7642 ,\n",
" 390.36136, 394.7984 , 389.74716, 392.25842, 392.42697, 393.6167 ,\n",
" 390.31824, 391.90237, 399.44983, 393.19128, 393.52548, 392.53802,\n",
" 390.68805, 391.63797, 396.24985, 394.57785, 392.13458, 390.36664,\n",
" 390.1804 , 390.89145, 395.8922 , 396.92868, 390.8619 , 391.1419 ,\n",
" 392.4267 , 393.0737 , 397.35675, 398.8355 , 396.29037, 391.05008,\n",
" 389.4605 , 391.93326, 391.39075, 390.61874, 394.65973, 394.07922,\n",
" 394.02365, 397.24677, 397.92264, 392.71225, 393.26868, 392.57773,\n",
" 389.75055, 391.72717, 392.82794, 390.9369 , 392.5645 , 391.68805,\n",
" 393.5547 , 392.33005, 389.79407, 396.49945, 393.72034, 393.51117,\n",
" 392.1612 , 390.8545 , 390.19092, 389.54028, 390.081 , 393.38885,\n",
" 389.43814, 391.40814, 392.77875, 390.07477, 389.34094, 390.62073,\n",
" 391.42688, 396.5186 , 397.25574, 388.39703, 391.31366, 398.72787,\n",
" 391.05505, 392.2018 , 391.27768, 393.10678, 395.05096, 393.76315,\n",
" 392.66342, 392.51956, 390.97275, 390.50626, 393.93262, 391.706 ,\n",
" 390.8292 , 394.87894, 393.27704, 390.10495, 389.4763 , 388.9353 ,\n",
" 388.51953, 388.58496, 389.6656 , 394.77295, 391.35245, 391.1977 ,\n",
" 391.07584, 391.1299 , 390.0027 , 392.0007 , 392.77393, 392.88647,\n",
" 388.6409 , 392.9662 , 390.44272, 391.4916 , 389.46524, 392.48782,\n",
" 391.1928 , 391.6972 , 392.49786, 397.5695 , 391.7954 , 391.18668,\n",
" 394.03104, 391.3363 , 393.5302 , 391.74683, 389.46597, 389.0724 ,\n",
" 395.04776, 395.0067 , 394.68988, 392.55582, 391.55222, 391.8968 ,\n",
" 392.51648, 389.999 , 390.82315, 391.85864, 397.0075 , 393.12473,\n",
" 394.1504 , 388.86996, 390.43127, 393.28723, 394.8042 , 394.32358,\n",
" 394.70056, 394.62448, 393.04788, 391.87747, 392.00067, 390.53983,\n",
" 390.52933, 390.52118, 391.3734 , 389.67596, 391.80765, 391.9735 ,\n",
" 388.86786, 389.31982, 389.36093, 390.76718, 393.16095, 392.73416,\n",
" 392.00232, 391.61856, 394.8812 , 398.4053 , 398.8124 , 393.909 ,\n",
" 399.0349 , 393.04034, 390.39853, 390.08875, 389.0157 , 388.95517,\n",
" 392.23053, 390.5207 ], dtype=float32)"
2024-06-21 18:21:06 +00:00
]
},
2024-06-26 09:43:26 +00:00
"execution_count": 10,
2024-06-21 18:21:06 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
2024-03-16 17:02:00 +00:00
"source": [
2024-06-26 09:43:26 +00:00
"mcmc.get_extra_fields()[\"potential_energy\"]"
2024-03-26 09:42:53 +00:00
]
},
{
"cell_type": "code",
2024-06-20 13:33:00 +00:00
"execution_count": null,
2024-04-23 11:02:09 +00:00
"metadata": {},
"outputs": [],
2024-06-21 18:21:06 +00:00
"source": []
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(774.734619140625, 755.6143798828125)"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"samples = mcmc.get_samples()\n",
"csiborgtools.numpyro_gof(model, mcmc)"
]
},
{
"cell_type": "code",
"execution_count": 117,
2024-06-21 18:21:06 +00:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-26 09:43:26 +00:00
"\n",
"Reading LOSS fitted to Carrick2015 with ksmooth = 0.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"BIC = 773.225037 +- 0.000000\n",
"AIC = 754.104797 +- 0.000000\n",
"logZ = -356.240234 +- 0.000000\n",
"chi2 = 1.207006 +- 0.228673\n"
2024-06-21 18:21:06 +00:00
]
}
],
2024-03-08 10:44:19 +00:00
"source": [
2024-06-26 09:43:26 +00:00
"data, names, __ = read_samples(\"LOSS\", \"Carrick2015\", 0, return_MCsamples=False)"
]
},
{
"cell_type": "code",
"execution_count": 118,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA0f0lEQVR4nO3df3RU9Z3/8dcQJpNJQn5ITAIhsugAIr+CKJjYNtpNi0BdWb9firZH0FW6fht2wbBaY/1RZDVYZIFVBEFdul3ZUPwC7hGrAi74teAqaM5BrNBUhDSShGB+MMlkEpL7/SMSGTIzyc2PuZPk+Thn/rj3fu7Me7wmeXHv54fNMAxDAAAAFhlkdQEAAGBgI4wAAABLEUYAAIClCCMAAMBShBEAAGApwggAALAUYQQAAFiKMAIAACw12OoCOqOlpUVfffWVhgwZIpvNZnU5AACgEwzD0Llz5zR8+HANGhT4/kefCCNfffWV0tPTrS4DAAB0QUlJiUaMGBHweJ8II0OGDJHU+mXi4uIsrgYAAHRGbW2t0tPT2/6OB9InwsiFRzNxcXGEEQAA+piOuljQgRUAAFiKMAIAACxFGAEAAJYijAAAAEsRRgAAgKU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b6HV2XxzK9PRAAYQSAJVzJsZqQxh9nAIymAQAAFiOMAAAASxFGAACApQgjAADAUoQRAABgKcIIAACwFGEEAABYijACAAAsRRgBAACWIowAAABLEUYAAIClWJsGQI8qrfaoqq4x4PHiCncIqwHQFxBGAPS
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"key = \"beta\"\n",
2024-03-21 15:50:37 +00:00
"\n",
2024-06-26 09:43:26 +00:00
"plt.figure()\n",
"plt.hist(data[:, names.index(key)], bins=\"auto\", density=1, histtype=\"step\")\n",
"plt.hist(samples[key], bins=\"auto\", density=1, histtype=\"step\")\n",
2024-03-21 15:50:37 +00:00
"\n",
2024-06-26 09:43:26 +00:00
"plt.show()"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [],
"source": [
"samples = mcmc.get_samples()"
]
},
{
"cell_type": "code",
"execution_count": 120,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [
{
"data": {
"text/plain": [
2024-06-26 09:43:26 +00:00
"Array([-369.51086, -369.97043, -370.17526, ..., -372.54755, -376.03503,\n",
" -374.88458], dtype=float32)"
2024-06-21 18:21:06 +00:00
]
},
2024-06-26 09:43:26 +00:00
"execution_count": 120,
2024-06-21 18:21:06 +00:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2024-06-26 09:43:26 +00:00
"samples[\"ll_values\"]"
2024-06-21 18:21:06 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 121,
2024-06-21 18:21:06 +00:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2024-06-26 09:43:26 +00:00
"11"
]
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nparam = 0\n",
"for val in samples.values():\n",
" if val.ndim == 1:\n",
" nparam += 1\n",
" elif val.ndim == 2:\n",
" nparam += val.shape[-1]\n",
" else:\n",
" raise ValueError(\"Invalid dimensionality of samples to count the number of parameters.\")\n",
" \n",
"\n",
"nparam\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"|V| = 197.8179931640625 +- 99.38513946533203\n",
"l = 213.2463176948003 +- 116.2995226818662\n",
"b = -5.31730133782022 +- 27.004291397137365\n",
"beta = 0.4450029134750366 +- 0.10768470168113708\n"
]
}
],
"source": [
"Vmag = np.sqrt(samples[\"Vext\"][:, 0]**2 + samples[\"Vext\"][:, 1]**2 + samples[\"Vext\"][:, 2]**2)\n",
"\n",
"V = np.vstack([samples[\"Vext\"][:, 0], samples[\"Vext\"][:, 1], samples[\"Vext\"][:, 2]]).T\n",
"V = csiborgtools.cartesian_to_radec(V)\n",
"\n",
"l, b = csiborgtools.radec_to_galactic(V[:, 1], V[:, 2])\n",
"\n",
"print(f\"|V| = {np.mean(Vmag)} +- {np.std(Vmag)}\")\n",
"print(f\"l = {np.mean(l)} +- {np.std(l)}\")\n",
"print(f\"b = {np.mean(b)} +- {np.std(b)}\")\n",
"if \"beta\" in samples:\n",
" print(f\"beta = {np.mean(samples['beta'])} +- {np.std(samples['beta'])}\")"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABU0AAAVeCAYAAABFJBpgAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd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EAAAAAACAwozQtBA7evSo4uPjs+w0zes9TV955RUtW7ZMXbt21ZUrVzRnzpw0r0dEREiSGjZsqCFDhuibb75RUlKSHnroIW3cuFELFy7U6NGj09zm/uqrr2rVqlVq2bKlXnzxRZUtW1Y///yzVq1apWeeecY+dufOnWrTpo3GjRuXplOyX79+CggIUPPmzVWuXDkdPHhQX3/9tQwGgyZOnGgfl52anH2fzggMDNSbb75p/75///56+eWXdfjwYXv362OPPSZJWrlyZZprk5OTNWHCBG3evFkmk0mS7CFyek6ePKkBAwbI09NTjRo1Unh4uA4dOqTw8PAM15Ckw4cP6+rVqxo5cqQkqX379mrYsKEWL16sZ555xun3CgAAAAAAUNgRmhZi+/btkyTVq1fPpevu2bNHkrR8+XItX778jtcdw8Rp06bJZDJp5syZWrx4sapUqaLJkydr1KhRaa5p1aqVtm3bpvHjx+vLL7/U5cuXVa1aNU2YMEH/+te/sqzpscce09y5c/Xxxx8rOjpaISEh6tmzp8a
"text/plain": [
"<Figure size 1390x1390 with 36 Axes>"
2024-06-21 18:21:06 +00:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-26 09:42:53 +00:00
"data = [l, b, Vmag]\n",
"labels = [r\"$l$\", r\"$b$\", r\"$|\\bf{V}_{\\rm ext}|$\"]\n",
2024-03-21 15:50:37 +00:00
"if \"alpha\" in samples:\n",
2024-03-26 09:42:53 +00:00
" data.append(samples[\"alpha\"])\n",
" labels.append(r\"$\\alpha$\")\n",
"\n",
"if \"beta\" in samples:\n",
" data.append(samples[\"beta\"])\n",
" labels.append(r\"$\\beta$\")\n",
2024-03-21 15:50:37 +00:00
"\n",
2024-04-01 22:19:14 +00:00
"if \"h\" in samples:\n",
" data.append(samples[\"h\"])\n",
" labels.append(r\"$h$\")\n",
"\n",
2024-06-26 09:43:26 +00:00
"if \"sigma_v\" in samples:\n",
" data.append(samples[\"sigma_v\"])\n",
" labels.append(r\"$\\sigma_v$\")\n",
"\n",
2024-03-26 09:42:53 +00:00
"data = np.vstack(data).T\n",
2024-04-01 22:19:14 +00:00
"fig = corner.corner(data, labels=labels, show_titles=True, title_fmt=\".3f\", title_kwargs={\"fontsize\": 12}, smooth=1)\n",
2024-06-21 18:21:06 +00:00
"fig.savefig(f\"../../plots/mock_{simname}_{catalogue}.png\", dpi=500, bbox_inches=\"tight\")"
2024-03-16 17:02:00 +00:00
]
},
2024-06-26 09:43:26 +00:00
{
"cell_type": "code",
"execution_count": 125,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Reading Pantheon+ fitted to csiborg2_main with ksmooth = 0.\n",
"BIC = 10055.604150 +- 27.237237\n",
"AIC = 10010.412744 +- 27.237237\n",
"logZ = -5000.136133 +- 23.062465\n",
"chi2 = 0.985968 +- 0.117400\n",
"Removed no burn in\n"
]
},
{
"data": {
"text/plain": [
"<getdist.mcsamples.MCSamples at 0x7f34904c5b90>"
]
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"read_samples(\"Pantheon+\", \"csiborg2_main\", 0, return_MCsamples=True)"
]
},
2024-03-16 17:02:00 +00:00
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
"source": [
2024-03-21 15:50:37 +00:00
"## Vizualize the results"
2024-03-08 10:44:19 +00:00
]
},
2024-03-16 17:02:00 +00:00
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-04-23 11:02:09 +00:00
"data, names, gof = read_samples(\"Pantheon+_groups\", \"Carrick2015\", 0)\n",
2024-03-08 10:44:19 +00:00
"\n",
2024-03-21 15:50:37 +00:00
"fig = corner.corner(data, labels=names_to_latex(names, True), show_titles=True,\n",
" title_fmt=\".3f\", title_kwargs={\"fontsize\": 12}, smooth=1)"
2024-03-08 10:44:19 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{LOSS}$ comparison"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 126,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-26 09:43:26 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Reading LOSS fitted to Carrick2015 with ksmooth = 0.\n",
"BIC = 773.225037 +- 0.000000\n",
"AIC = 754.104797 +- 0.000000\n",
"logZ = -356.240234 +- 0.000000\n",
"chi2 = 1.207006 +- 0.228673\n",
"Removed no burn in\n"
]
}
],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"LOSS_Carrick_0 = read_samples(\"LOSS\", \"Carrick2015\", 0, return_MCsamples=True)\n",
2024-06-26 09:43:26 +00:00
"# LOSS_Carrick_1 = read_samples(\"LOSS\", \"Carrick2015\", 1, return_MCsamples=True)\n",
2024-03-21 15:50:37 +00:00
"\n",
2024-06-26 09:43:26 +00:00
"# LOSS_CB1_0 = read_samples(\"LOSS\", \"csiborg1\", 0, return_MCsamples=True)\n",
"# LOSS_CB1_1 = read_samples(\"LOSS\", \"csiborg1\", 1, return_MCsamples=True)\n",
2024-03-21 15:50:37 +00:00
"\n",
2024-06-26 09:43:26 +00:00
"# LOSS_CB2_0 = read_samples(\"LOSS\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"# LOSS_CB2_1 = read_samples(\"LOSS\", \"csiborg2_main\", 1, return_MCsamples=True)"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"X = [\n",
" LOSS_Carrick_0,\n",
" # LOSS_Carrick_1,\n",
" # LOSS_CB1_0,\n",
" LOSS_CB1_1,\n",
" LOSS_CB2_0,\n",
" LOSS_CB2_1,\n",
" ]\n",
"\n",
"# params = [\"l\", \"b\", \"Vmag\", \"beta\"]\n",
"params = None\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, params=params, filled=True, legend_loc='upper right', )\n",
"g.export(f\"../plots/LOSS_comparison.png\", dpi=500,)\n"
]
},
{
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{Foundation}$ comparison"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
2024-03-08 10:44:19 +00:00
"metadata": {},
"outputs": [],
"source": [
2024-03-21 15:50:37 +00:00
"FOUNDATION_Carrick_0 = read_samples(\"Foundation\", \"Carrick2015\", 0, return_MCsamples=True)\n",
"FOUNDATION_Carrick_1 = read_samples(\"Foundation\", \"Carrick2015\", 1, return_MCsamples=True)\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-03-21 15:50:37 +00:00
"FOUNDATION_CB1_0 = read_samples(\"Foundation\", \"csiborg1\", 0, return_MCsamples=True)\n",
"FOUNDATION_CB1_1 = read_samples(\"Foundation\", \"csiborg1\", 1, return_MCsamples=True)\n",
"\n",
"FOUNDATION_CB2_0 = read_samples(\"Foundation\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"FOUNDATION_CB2_1 = read_samples(\"Foundation\", \"csiborg2_main\", 1, return_MCsamples=True)"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-03-21 15:50:37 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"X = [\n",
" FOUNDATION_Carrick_0,\n",
" # FOUNDATION_Carrick_1,\n",
" # FOUNDATION_CB1_0,\n",
" FOUNDATION_CB1_1,\n",
" FOUNDATION_CB2_0,\n",
" FOUNDATION_CB2_1,\n",
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
"g.export(f\"../plots/FOUNDATION_comparison.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{Pantheon+}$ comparison"
]
},
{
"cell_type": "code",
2024-06-21 18:21:06 +00:00
"execution_count": null,
2024-04-23 11:02:09 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [],
2024-04-23 11:02:09 +00:00
"source": [
2024-06-20 13:33:00 +00:00
"PANTHEONP_Carrick_0 = read_samples(\"Pantheon+\", \"Carrick2015\", 0, return_MCsamples=True)\n",
"PANTHEONP_Carrick_1 = read_samples(\"Pantheon+\", \"Carrick2015\", 1, return_MCsamples=True)\n",
2024-04-23 11:02:09 +00:00
"\n",
"# PANTHEONP_CB1_0 = read_samples(\"Pantheon+\", \"csiborg1\", 0, return_MCsamples=True)\n",
"# PANTHEONP_CB1_1 = read_samples(\"Pantheon+\", \"csiborg1\", 1, return_MCsamples=True)\n",
"\n",
"PANTHEONP_CB2_0 = read_samples(\"Pantheon+\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"PANTHEONP_CB2_1 = read_samples(\"Pantheon+\", \"csiborg2_main\", 1, return_MCsamples=True)\n"
]
},
{
"cell_type": "code",
2024-06-21 18:21:06 +00:00
"execution_count": null,
2024-04-23 11:02:09 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [],
2024-04-23 11:02:09 +00:00
"source": [
"X = [\n",
2024-06-20 13:33:00 +00:00
" PANTHEONP_Carrick_0,\n",
2024-04-23 11:02:09 +00:00
" # PANTHEONP_Carrick_1,\n",
" # PANTHEONP_CB1_0,\n",
" # PANTHEONP_CB1_1,\n",
" PANTHEONP_CB2_0,\n",
" PANTHEONP_CB2_1,\n",
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
"# g.export(f\"../plots/PANTHEONP_comparison.png\", dpi=500,)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### $\\texttt{Pantheon+}$ groups"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-06-21 18:21:06 +00:00
"execution_count": null,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [],
2024-03-08 10:44:19 +00:00
"source": [
2024-06-20 13:33:00 +00:00
"LG = -1\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-04-23 11:02:09 +00:00
"PANTHEONP_Carrick = read_samples(\"Pantheon+\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG, )\n",
"PANTHEONP_Carrick_Groups = read_samples(\"Pantheon+_groups\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"PANTHEONP_Carrick_Groups_zSN = read_samples(\"Pantheon+_groups_zSN\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"PANTHEONP_Carrick_zSN = read_samples(\"Pantheon+_zSN\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-04-23 11:02:09 +00:00
"# ksmooth = 1\n",
"# PANTHEONP_CB2 = read_samples(\"Pantheon+\", \"csiborg2_main\", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# PANTHEONP_CB2_Groups = read_samples(\"Pantheon+_groups\", \"csiborg2_main\", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# PANTHEONP_CB2_Groups_zSN = read_samples(\"Pantheon+_groups_zSN\", \"csiborg2_main\", ksmooth, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"\n",
"\n"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-06-21 18:21:06 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-21 18:21:06 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-04-23 11:02:09 +00:00
"params = [\"Vmag\", \"l\", \"b\"]\n",
"CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),\n",
" names=params, labels=names_to_latex(params, True), label=\"CMB\")\n",
"\n",
"\n",
2024-03-21 15:50:37 +00:00
"X = [\n",
2024-04-23 11:02:09 +00:00
" PANTHEONP_Carrick,\n",
2024-06-20 13:33:00 +00:00
" # PANTHEONP_Carrick_Groups,\n",
2024-04-23 11:02:09 +00:00
" # PANTHEONP_Carrick_Groups_zSN,\n",
" PANTHEONP_Carrick_zSN,\n",
" # PANTHEONP_CB2,\n",
" # PANTHEONP_CB2_Groups,\n",
" # PANTHEONP_CB2_Groups_zSN,\n",
2024-06-20 13:33:00 +00:00
" # CMB,\n",
2024-03-21 15:50:37 +00:00
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
2024-04-23 11:02:09 +00:00
"g.export(f\"../../plots/PANTHEON_GROUPS_Carrick_comparison_LG.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{2MTF}$ comparison"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-06-26 09:43:26 +00:00
"execution_count": 24,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-06-26 09:43:26 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Reading 2MTF fitted to Carrick2015 with ksmooth = 0.\n",
"BIC = 19517.031250 +- 0.000000\n",
"AIC = 19470.867188 +- 0.000000\n",
"logZ = -9731.227539 +- 0.000000\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n",
"\n",
"Reading 2MTF fitted to Carrick2015 with ksmooth = 1.\n",
"BIC = 19632.685547 +- 0.000000\n",
"AIC = 19586.521484 +- 0.000000\n",
"logZ = -9788.892578 +- 0.000000\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n",
"\n",
"Reading 2MTF fitted to csiborg1 with ksmooth = 0.\n",
"BIC = 19922.607596 +- 33.988735\n",
"AIC = 19876.443533 +- 33.988735\n",
"logZ = -9934.180538 +- 17.010780\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n",
"\n",
"Reading 2MTF fitted to csiborg1 with ksmooth = 1.\n",
"BIC = 19840.144473 +- 31.749545\n",
"AIC = 19793.980411 +- 31.749545\n",
"logZ = -9891.951984 +- 16.078607\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n",
"\n",
"Reading 2MTF fitted to csiborg2_main with ksmooth = 0.\n",
"BIC = 19248.799609 +- 38.583873\n",
"AIC = 19202.635547 +- 38.583873\n",
"logZ = -9598.394336 +- 19.251815\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n",
"\n",
"Reading 2MTF fitted to csiborg2_main with ksmooth = 1.\n",
"BIC = 19167.596582 +- 20.190445\n",
"AIC = 19121.432520 +- 20.190445\n",
"logZ = -9555.558252 +- 9.820362\n",
"chi2 = 0.000000 +- 0.000000\n",
"Removed no burn in\n"
]
}
],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"TWOMTF_Carrick_0 = read_samples(\"2MTF\", \"Carrick2015\", 0, return_MCsamples=True)\n",
"TWOMTF_Carrick_1 = read_samples(\"2MTF\", \"Carrick2015\", 1, return_MCsamples=True)\n",
"\n",
"TWOMTF_CB1_0 = read_samples(\"2MTF\", \"csiborg1\", 0, return_MCsamples=True)\n",
"TWOMTF_CB1_1 = read_samples(\"2MTF\", \"csiborg1\", 1, return_MCsamples=True)\n",
"\n",
"TWOMTF_CB2_0 = read_samples(\"2MTF\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"TWOMTF_CB2_1 = read_samples(\"2MTF\", \"csiborg2_main\", 1, return_MCsamples=True)\n"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-03-21 15:50:37 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"X = [\n",
" TWOMTF_Carrick_0,\n",
" # TWOMTF_Carrick_1,\n",
" # TWOMTF_CB1_0,\n",
" TWOMTF_CB1_1,\n",
" TWOMTF_CB2_0,\n",
" TWOMTF_CB2_1,\n",
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
"g.export(f\"../plots/2MTF_comparison.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-08 10:44:19 +00:00
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{SFI++ galaxies}$ comparison"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-08 10:44:19 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"SFIGAL_Carrick_0 = read_samples(\"SFI_gals\", \"Carrick2015\", 0, return_MCsamples=True)\n",
"SFIGAL_Carrick_1 = read_samples(\"SFI_gals\", \"Carrick2015\", 1, return_MCsamples=True)\n",
"\n",
"# SFIGAL_CB1_0 = read_samples(\"SFI_gals\", \"csiborg1\", 0, return_MCsamples=True)\n",
"# SFIGAL_CB1_1 = read_samples(\"SFI_gals\", \"csiborg1\", 1, return_MCsamples=True)\n",
"\n",
"SFIGAL_CB2_0 = read_samples(\"SFI_gals\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"SFIGAL_CB2_1 = read_samples(\"SFI_gals\", \"csiborg2_main\", 1, return_MCsamples=True)"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
2024-03-21 15:50:37 +00:00
"X = [\n",
" SFIGAL_Carrick_0,\n",
" # SFIGAL_Carrick_1,\n",
" # SFIGAL_CB1_0,\n",
" # SFIGAL_CB1_1,\n",
" # SFIGAL_CB2_0,\n",
" SFIGAL_CB2_1,\n",
" ]\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-03-21 15:50:37 +00:00
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
"g.export(f\"../plots/SFI_gals_comparison.png\", dpi=500,)"
2024-03-08 10:44:19 +00:00
]
},
2024-03-26 14:11:04 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### $\\texttt{SFI++ groups}$ comparison"
2024-03-26 14:11:04 +00:00
]
},
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-26 14:11:04 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-26 14:11:04 +00:00
"source": [
"SFIGROUP_Carrick_0 = read_samples(\"SFI_groups\", \"Carrick2015\", 0, return_MCsamples=True)\n",
"SFIGROUP_Carrick_1 = read_samples(\"SFI_groups\", \"Carrick2015\", 1, return_MCsamples=True)\n",
"\n",
"SFIGROUP_CB2_0 = read_samples(\"SFI_groups\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"SFIGROUP_CB2_1 = read_samples(\"SFI_groups\", \"csiborg2_main\", 1, return_MCsamples=True)"
]
},
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-26 14:11:04 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-26 14:11:04 +00:00
"source": [
"X = [\n",
" SFIGROUP_Carrick_0,\n",
2024-04-08 22:14:43 +00:00
" SFIGAL_Carrick_0,\n",
2024-03-26 14:11:04 +00:00
" # SFIGROUP_Carrick_1,\n",
" # SFIGROUP_CB2_0,\n",
2024-04-08 22:14:43 +00:00
" # SFIGROUP_CB2_1,\n",
2024-03-26 14:11:04 +00:00
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
2024-04-08 22:14:43 +00:00
"g.export(f\"../plots/SFI_gals_vs_groups_comparison.png\", dpi=500,)"
2024-03-26 14:11:04 +00:00
]
},
2024-04-01 22:19:14 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"### SN to TF comparison"
2024-04-01 22:19:14 +00:00
]
},
{
"cell_type": "code",
2024-06-20 13:33:00 +00:00
"execution_count": null,
2024-04-01 22:19:14 +00:00
"metadata": {},
2024-06-20 13:33:00 +00:00
"outputs": [],
2024-04-01 22:19:14 +00:00
"source": [
2024-04-23 11:02:09 +00:00
"LG = 0\n",
2024-04-02 08:28:57 +00:00
"\n",
2024-04-23 11:02:09 +00:00
"# PANTHEONP_Carrick = read_samples(\"Pantheon+\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG, )\n",
"# PANTHEONP_Groups_Carrick = read_samples(\"Pantheon+_groups\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG, )\n",
"# TWOMTF_Carrick = read_samples(\"2MTF\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# SFIGAL_Carrick = read_samples(\"SFI_gals\", \"Carrick2015\", 0, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"\n",
"k = 1\n",
"PANTHEONP_CB2 = read_samples(\"Pantheon+\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG, )\n",
"PANTHEONP_Groups_CB2 = read_samples(\"Pantheon+_groups\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG, )\n",
"TWOMTF_CB2 = read_samples(\"2MTF\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"SFIGAL_CB2 = read_samples(\"SFI_gals\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)"
2024-04-01 22:19:14 +00:00
]
},
{
"cell_type": "code",
2024-06-20 13:33:00 +00:00
"execution_count": null,
2024-04-01 22:19:14 +00:00
"metadata": {},
2024-06-20 13:33:00 +00:00
"outputs": [],
2024-04-23 11:02:09 +00:00
"source": [
"\n",
"params = [\"Vmag\", \"l\", \"b\"]\n",
"CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),\n",
" names=params, labels=names_to_latex(params, True), label=\"CMB\")\n",
"\n",
"\n",
"X = [\n",
" # PANTHEONP_Carrick,\n",
" # PANTHEONP_Groups_Carrick,\n",
" # TWOMTF_Carrick,\n",
" # SFIGAL_Carrick,\n",
" PANTHEONP_CB2,\n",
" PANTHEONP_Groups_CB2,\n",
" TWOMTF_CB2,\n",
" SFIGAL_CB2,\n",
" CMB,\n",
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
"# g.export(f\"../../plots/SN_TF_CB2_consistency.png\", dpi=500,)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Mock $\\texttt{CB2}$ comparison"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"SMALLMOCK_CB2_0 = read_samples(\"CB2_small\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"SMALLMOCK_CB2_1 = read_samples(\"CB2_small\", \"csiborg2_main\", 1, return_MCsamples=True)\n",
"\n",
"LARGEMOCK_CB2_0 = read_samples(\"CB2_large\", \"csiborg2_main\", 0, return_MCsamples=True)\n",
"LARGEMOCK_CB2_1 = read_samples(\"CB2_large\", \"csiborg2_main\", 1, return_MCsamples=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2024-04-01 22:19:14 +00:00
"source": [
"X = [\n",
2024-04-02 08:28:57 +00:00
" # SMALLMOCK_CB2_0,\n",
" # SMALLMOCK_CB2_1,\n",
" LARGEMOCK_CB2_0,\n",
" LARGEMOCK_CB2_1,\n",
2024-04-01 22:19:14 +00:00
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, filled=True, legend_loc='upper right')\n",
2024-04-02 08:28:57 +00:00
"g.export(f\"../plots/CB2_mocks_large.png\", dpi=500,)"
2024-04-01 22:19:14 +00:00
]
},
2024-03-08 10:44:19 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2024-04-23 11:02:09 +00:00
"## External flow consistency"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
"source": [
2024-03-21 15:50:37 +00:00
"#### Carrick2015"
2024-03-08 10:44:19 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
2024-03-08 10:44:19 +00:00
"metadata": {},
"outputs": [],
"source": [
2024-03-21 15:50:37 +00:00
"X = [\n",
" # LOSS_Carrick_0,\n",
" # FOUNDATION_Carrick_0,\n",
" PANTHEONP_Carrick_0,\n",
" TWOMTF_Carrick_0,\n",
" SFIGAL_Carrick_0,\n",
" ]\n",
2024-03-16 17:02:00 +00:00
"\n",
2024-03-21 15:50:37 +00:00
"params = [\"Vmag\", \"l\", \"b\", \"beta\"]\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)\n",
"g.export(f\"../plots/Carrick2015_external_flow.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-08 10:44:19 +00:00
"metadata": {},
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"#### CSiBORG1"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-03-21 15:50:37 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-03-21 15:50:37 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"X = [\n",
" # LOSS_CB1_1,\n",
" # FOUNDATION_CB1_1,\n",
" PANTHEONP_CB1_1,\n",
" TWOMTF_CB1_1,\n",
" # SFIGAL_CB1_1,\n",
" ]\n",
"\n",
"params = [\"Vmag\", \"l\", \"b\", \"beta\"]\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)\n",
"g.export(f\"../plots/CB1_external_flow.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
{
2024-03-21 15:50:37 +00:00
"cell_type": "markdown",
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-03-08 10:44:19 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"#### CSiBORG2"
2024-03-08 10:44:19 +00:00
]
},
2024-03-16 17:02:00 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2024-03-21 15:50:37 +00:00
"source": [
"X = [\n",
" # LOSS_CB2_1,\n",
" # FOUNDATION_CB2_1,\n",
" PANTHEONP_CB2_1,\n",
" TWOMTF_CB2_1,\n",
" SFIGAL_CB2_1,\n",
" ]\n",
"\n",
"params = [\"Vmag\", \"l\", \"b\", \"beta\"]\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
"g.triangle_plot(X, params=params, filled=True, legend_loc='upper right',)\n",
"g.export(f\"../plots/CB2_external_flow.png\", dpi=500,)"
]
2024-03-16 17:02:00 +00:00
},
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-26 09:42:53 +00:00
"k = 1\n",
2024-03-21 15:50:37 +00:00
"LG = 0\n",
2024-03-26 09:42:53 +00:00
"\n",
"# Carrick\n",
"# LOSS_Carrick_LG = read_samples(\"LOSS\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# FOUNDATION_Carrick_LG = read_samples(\"Foundation\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 14:11:04 +00:00
"# PANTHEON_Carrick_LG = read_samples(\"Pantheon+\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 09:42:53 +00:00
"# TWOMTF_Carrick_LG = read_samples(\"2MTF\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 14:11:04 +00:00
"SFIGAL_Carrick_LG = read_samples(\"SFI_gals\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"SFIGROUPS_Carrick_LG = read_samples(\"SFI_groups\", \"Carrick2015\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 09:42:53 +00:00
"\n",
"\n",
"# # CSiBORG2\n",
"# LOSS_CB2_LG = read_samples(\"LOSS\", \"csiborg2_main\", k, return_MCsamples=True,subtract_LG_velocity=LG)\n",
"# FOUNDATION_CB2_LG = read_samples(\"Foundation\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# PANTHEON_CB2_LG = read_samples(\"Pantheon+\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# TWOMTF_CB2_LG = read_samples(\"2MTF\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 14:11:04 +00:00
"SFIGAL_CB2_LG = read_samples(\"SFI_gals\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"SFIGROUP_CB2_LG = read_samples(\"SFI_groups\", \"csiborg2_main\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
2024-03-26 09:42:53 +00:00
"\n",
"# # CSiBORG1\n",
2024-03-26 14:11:04 +00:00
"# LOSS_CB1_LG = read_samples(\"LOSS\", \"csiborg1\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# FOUNDATION_CB1_LG = read_samples(\"Foundation\", \"csiborg1\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# PANTHEON_CB1_LG = read_samples(\"Pantheon+\", \"csiborg1\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# TWOMTF_CB1_LG = read_samples(\"2MTF\", \"csiborg1\", k, return_MCsamples=True, subtract_LG_velocity=LG)\n",
"# SFIGAL_CB1_LG = read_samples(\"SFI_gals\", \"csiborg1\", k, return_MCsamples=True, subtract_LG_velocity=LG)"
2024-03-16 17:02:00 +00:00
]
},
{
"cell_type": "code",
2024-04-23 11:02:09 +00:00
"execution_count": null,
2024-03-16 17:02:00 +00:00
"metadata": {},
2024-04-23 11:02:09 +00:00
"outputs": [],
2024-03-16 17:02:00 +00:00
"source": [
2024-03-21 15:50:37 +00:00
"params = [\"Vmag\", \"l\", \"b\"]\n",
"CMB = MCSamples(samples=multivariate_normal([627, 276, 30], [22, 3, 3]).rvs(size=20000),\n",
" names=params, labels=names_to_latex(params, True), label=\"CMB\")\n",
"\n",
"X = [\n",
2024-03-26 09:42:53 +00:00
" # LOSS_Carrick_LG,\n",
" # FOUNDATION_Carrick_LG,\n",
2024-03-26 14:11:04 +00:00
" # PANTHEON_Carrick_LG,\n",
2024-03-26 09:42:53 +00:00
" # TWOMTF_Carrick_LG,\n",
" # SFIGAL_Carrick_LG,\n",
2024-03-26 14:11:04 +00:00
" # SFIGROUPS_Carrick_LG,\n",
2024-03-21 15:50:37 +00:00
" # LOSS_CB1_LG,\n",
2024-03-26 09:42:53 +00:00
" # FOUNDATION_CB1_LG,\n",
2024-03-26 14:11:04 +00:00
" # PANTHEON_CB1_LG,\n",
2024-03-26 09:42:53 +00:00
" # TWOMTF_CB1_LG,\n",
" # SFIGAL_CB1_LG,\n",
2024-03-21 15:50:37 +00:00
" # LOSS_CB2_LG,\n",
" # FOUNDATION_CB2_LG,\n",
2024-03-26 14:11:04 +00:00
" # PANTHEON_CB2_LG,\n",
2024-03-21 15:50:37 +00:00
" # TWOMTF_CB2_LG,\n",
2024-03-26 14:11:04 +00:00
" SFIGAL_CB2_LG,\n",
" SFIGROUP_CB2_LG,\n",
2024-03-21 15:50:37 +00:00
" CMB,\n",
" ]\n",
"\n",
"g = plots.get_subplot_plotter()\n",
"g.settings.figure_legend_frame = False\n",
"g.settings.alpha_filled_add = 0.75\n",
"# g.settings.title_limit_fontsize = 14\n",
2024-03-26 09:42:53 +00:00
"g.triangle_plot(X, params=params, filled=True, legend_loc='upper right', )\n",
2024-03-26 14:11:04 +00:00
"# g.export(f\"../plots/ALL_dipole.png\", dpi=500,)"
2024-03-16 17:02:00 +00:00
]
},
2024-03-08 10:44:19 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv_csiborg",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2024-06-26 09:43:26 +00:00
"version": "3.11.7"
2024-03-08 10:44:19 +00:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}