csiborgtools/notebooks/flow_calibration.ipynb

1193 lines
2.7 MiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from jax import numpy as jnp\n",
"import jax\n",
"from tqdm import tqdm\n",
2024-03-16 17:16:22 +00:00
"from h5py import File\n",
"from numpyro.infer import MCMC, NUTS, init_to_median\n",
"import corner\n",
"\n",
"import csiborgtools\n",
"\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
2024-03-16 17:16:22 +00:00
"%matplotlib inline\n",
"\n",
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## LOS density & radial velocity plots "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:19: reading the catalogue.\n",
"10:20:19: reading the interpolated field.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 1/1 [00:00<00:00, 84.48it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:19: calculating the radial velocity.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 50/50 [00:00<00:00, 21608.99it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:19: reading the catalogue.\n",
"10:20:19: reading the interpolated field.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 101/101 [00:02<00:00, 42.58it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:21: calculating the radial velocity.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 50/50 [00:00<00:00, 351.66it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:22: reading the catalogue.\n",
"10:20:22: reading the interpolated field.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 20/20 [00:00<00:00, 123.83it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"10:20:22: calculating the radial velocity.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 50/50 [00:00<00:00, 1285.41it/s]\n"
]
}
],
"source": [
"# fpath = \"/mnt/extraspace/rstiskalek/catalogs/A2.h5\"\n",
"fpath = \"/mnt/extraspace/rstiskalek/catalogs/PV_compilation_Supranta2019.hdf5\"\n",
"\n",
"loader_carrick = csiborgtools.flow.DataLoader(\"Carrick2015\", \"LOSS\", fpath, paths, ksmooth=0)\n",
"loader_csiborg = csiborgtools.flow.DataLoader(\"csiborg1\", \"LOSS\", fpath, paths, ksmooth=0)\n",
"loader_csiborg2 = csiborgtools.flow.DataLoader(\"csiborg2_main\", \"LOSS\", fpath, paths, ksmooth=0)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# ks = [115, 53, 77, 105, 26, 61, 86, 29, 80, 21]\n",
"ks = [19, 8, 15, 0, 16, 6, 48, 38, 26, 44]\n",
"# ks = [19]\n",
"# ks = np.random.choice(50, 10, replace=False)\n",
"\n",
"# k = 6\n",
"for k in []:\n",
" fig, axs = plt.subplots(2, 1, figsize=(7, 7), sharex=True)\n",
" # Get rid of vertical spacing\n",
" fig.subplots_adjust(wspace=0)\n",
"\n",
" # Plot CSiBORG\n",
" for i in range(loader_csiborg.los_density.shape[1]):\n",
" axs[0].plot(loader_csiborg.rdist, loader_csiborg.los_density[k, i, :], alpha=0.1, color=\"black\")\n",
" axs[1].plot(loader_csiborg.rdist, loader_csiborg.los_radial_velocity[k, i, :], alpha=0.1, color=\"black\")\n",
"\n",
" # CSiBORG1\n",
" axs[0].plot(loader_csiborg.rdist, loader_csiborg.los_density[k, :, :].mean(axis=0), color=\"red\", label=\"CSiBORG1\")\n",
" axs[1].plot(loader_csiborg.rdist, loader_csiborg.los_radial_velocity[k, :, :].mean(axis=0), color=\"red\")\n",
"\n",
" # CSiBORG2\n",
" axs[0].plot(loader_csiborg2.rdist, loader_csiborg2.los_density[k, :, :].mean(axis=0), color=\"violet\", label=\"CSiBORG2\")\n",
" axs[1].plot(loader_csiborg2.rdist, loader_csiborg2.los_radial_velocity[k, :, :].mean(axis=0), color=\"violet\")\n",
"\n",
" # Plot Carrick+2015\n",
" axs[0].plot(loader_carrick.rdist, loader_carrick.los_density[k, 0, :], color=\"blue\", label=\"Carrick+2015\")\n",
" axs[1].plot(loader_carrick.rdist, loader_carrick.los_radial_velocity[k, 0, :] * 0.43, color=\"blue\")\n",
"\n",
"\n",
" # for i in range(2):\n",
" # label = \"SN\"\n",
" # rdist = loader_csiborg.cat[\"r_hMpc\"][k]\n",
" # axs[i].axvline(rdist, color=\"violet\", linestyle=\"--\",\n",
" # zorder=0, label=label)\n",
"\n",
" 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",
"\n",
" axs[0].set_yscale(\"log\")\n",
"\n",
" axs[0].legend(loc=\"upper right\")\n",
" axs[0].set_xlim(0, 200)\n",
"\n",
" fig.tight_layout(w_pad=0, h_pad=0)\n",
" fig.savefig(f\"../plots/LOSS_los_{k}.png\", dpi=500, bbox_inches=\"tight\")\n",
"\n",
" fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test running a model"
]
},
{
"cell_type": "code",
"execution_count": 174,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16:28:25: reading the catalogue.\n",
"16:28:25: reading the interpolated field.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 101/101 [00:21<00:00, 4.68it/s]\n",
"/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:108: 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"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"16:28:46: calculating the radial velocity.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 1248/1248 [00:02<00:00, 441.14it/s]\n"
]
}
],
"source": [
"fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/PV_compilation_Supranta2019.hdf5\"\n",
"# fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/A2.h5\"\n",
"\n",
"simname = \"csiborg1\"\n",
"catalogue = \"2MTF\"\n",
"loader = csiborgtools.flow.DataLoader(simname, catalogue, fpath_data, paths, ksmooth=0)\n",
"get_model_kwargs = {\"zcmb_max\": 0.06}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Maximizing the log-likelihood"
]
},
{
"cell_type": "code",
"execution_count": 137,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 5/5 [00:13<00:00, 2.76s/it]\n"
]
}
],
"source": [
"samples, stats, fmin, logz, bic = csiborgtools.flow.optimize_model_with_jackknife(loader, 19, 5, True, get_model_kwargs=get_model_kwargs)\n"
]
},
{
"cell_type": "code",
"execution_count": 138,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Log Z: \n",
"-720.9279427394929 3.501431137265503\n",
"BIC: \n",
"1496.4595387739434 6.356325506551423\n",
"beta: \n",
"0.9214629141858417 0.2800670163219086\n"
]
}
],
"source": [
"print(\"Log Z: \")\n",
"print(np.mean(logz), np.std(logz))\n",
"\n",
"print(\"BIC: \")\n",
"print(np.mean(bic), np.std(bic))\n",
"\n",
"print(\"beta: \")\n",
"print(*stats[\"beta\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Running HMC"
]
},
{
"cell_type": "code",
"execution_count": 176,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Selected 1248/1248 galaxies.\n"
]
}
],
"source": [
"model = csiborgtools.flow.get_model(loader, k=30, **get_model_kwargs)"
]
},
{
"cell_type": "code",
"execution_count": 178,
"metadata": {},
"outputs": [],
"source": [
"kernel = NUTS(model, init_strategy=init_to_median(num_samples=100))\n",
"mcmc = MCMC(kernel, num_warmup=250, num_samples=500)\n",
"\n",
"rng_key = jax.random.PRNGKey(5)"
]
},
{
"cell_type": "code",
"execution_count": 179,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"sample: 100%|██████████| 750/750 [03:36<00:00, 3.47it/s, 7 steps of size 4.64e-01. acc. prob=0.91] \n"
]
}
],
"source": [
"mcmc.run(rng_key, sample_alpha=True)"
]
},
{
"cell_type": "code",
"execution_count": 180,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" mean std median 5.0% 95.0% n_eff r_hat\n",
" Vext_x 82.64 22.65 82.44 42.11 119.99 503.40 1.00\n",
" Vext_y -195.75 24.46 -195.33 -236.00 -155.73 647.07 1.00\n",
" Vext_z -306.00 25.02 -305.94 -347.13 -267.32 425.43 1.00\n",
" a -22.28 0.02 -22.28 -22.30 -22.25 493.19 1.00\n",
" alpha 0.52 0.04 0.52 0.46 0.58 588.72 1.00\n",
" b -6.31 0.09 -6.31 -6.44 -6.17 510.16 1.00\n",
" beta 0.95 0.05 0.95 0.87 1.03 678.00 1.00\n",
" e_mu_intrinsic 0.40 0.01 0.40 0.38 0.42 406.23 1.00\n",
" sigma_v 227.07 15.02 226.96 199.16 248.31 636.71 1.00\n",
"\n",
"Number of divergences: 0\n"
]
}
],
"source": [
"mcmc.print_summary()\n",
"samples = mcmc.get_samples(group_by_chain=False)"
]
},
{
"cell_type": "code",
"execution_count": 181,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAG0CAYAAACSbkVhAAAAOXRFWH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TNmqE2bNrrjjjvkcrk0ceJElZWVqVOnTnI6nZo8ebLcbjfvdAEAAAEhxce//vUv3XHHHfriiy/UuXNnDRs2TJs3b1bnzp0lSXPnzlVycrJKSkrk9/tVXFyshQsXRmXgAAAgPiUZY0ysB/FtPp9PLpdLDQ0N3P+BuNF92ppYDwHfcnD2yFgPATjvhPL7m+92AQAAVhEfAADAKuIDAABYFfJ3uwDxhvsxAKB14coHAACwivgAAABWER8AAMAq4gMAAFhFfAAAAKuIDwAAYBXxAQAArCI+AACAVcQHAACwik84BZBwbHyqLd+cC4SPKx8AAMAq4gMAAFhFfAAAAKuIDwAAYBXxAQAArCI+AACAVcQHAACwivgAAABWER8AAMAq4gMAAFhFfAAAAKuIDwAAYBXxAQAArCI+AACAVcQHAACwivgAAABWER8AAMAq4gMAAFhFfAAAAKuIDwAAYBXxAQAArCI+AACAVcQHAACwivgAAABWER8AAMAq4gMAAFjVoviYPXu2kpKSNGXKlMC6xsZGlZaWKjMzUx06dFBJSYm8Xm9LxwkAABJE2PGxdetW/eEPf9CAAQOC1k+dOlWrV6/WihUrtHHjRh06dEijR49u8UABAEBiCCs+jh49qrFjx+q5557TBRdcEFjf0NCgxYsXa86cORo+fLgKCgq0ZMkS/eMf/9DmzZsjNmgAABC/woqP0tJSjRw5UkVFRUHra2pqdOLEiaD
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.hist(samples[\"beta\"], bins=\"auto\")\n",
"plt.xlabel(r\"$\\beta$\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 182,
"metadata": {},
"outputs": [],
"source": [
"Vmag = np.sqrt(samples[\"Vext_x\"]**2 + samples[\"Vext_y\"]**2 + samples[\"Vext_z\"]**2)\n",
"\n",
"V = np.vstack([samples[\"Vext_x\"], samples[\"Vext_y\"], samples[\"Vext_z\"]]).T\n",
"V = csiborgtools.cartesian_to_radec(V)\n",
"\n",
"l, b = csiborgtools.flow.radec_to_galactic(V[:, 1], V[:, 2])"
]
},
{
"cell_type": "code",
"execution_count": 183,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"|V| = 373.878173828125 +- 27.086021423339844\n",
"l = 342.21601176361986 +- 4.145220888130849\n",
"b = -27.483255950082246 +- 3.1987615901961264\n",
"beta = 0.9494613409042358 +- 0.05187663435935974\n"
]
}
],
"source": [
"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",
"print(f\"beta = {np.mean(samples['beta'])} +- {np.std(samples['beta'])}\")"
]
},
{
"cell_type": "code",
"execution_count": 184,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkwAAAGxCAYAAACQgOmZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAACBoElEQVR4nO2de3wU5b3/P5uQBBLIjQAbFJGLt8glwKkSoSqIGgXBtvb8ROtdrIqnlHoh1FIRjlKqLforFhWVeo4K9ZyCICo/oFBbIQgVA4SbBLk1JCAENhAgxGR+f8RZdjdzeea2M7P5vF+vvCDZmdlnnp2d5zPfa0CSJAmEEEIIIUSVJLcHQAghhBDidSiYCCGEEEJ0oGAihBBCCNGBgokQQgghRAcKJkIIIYQQHSiYCCGEEEJ0oGAihBBCCNGhjdsDSBSamppw8OBBdOjQAYFAwO3hEEIIIUQASZJw4sQJdO3aFUlJ6nYkCiabOHjwILp16+b2MAghhBBiggMHDuD8889XfZ2CySY6dOgAoHnCMzMzXR4NIYQQQkSora1Ft27dwuu4GhRMNiG74TIzMymYCCGEEJ+hF07DoG9CCCGEEB0omAghhBBCdKBgIoQQQgjRgYKJEEIIIUQHC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3acaeMvExXzJHWiVcLm7JwZZyhYCIk/sz4eBte+/se1dd/enUPTL65wNb31BNqdha5tOtp3O6nehapJEbx8jXDwpWEEFeIl8m9sUnCkk3aZQOWbKrCU8WX2fr+8aw5ZJfb0073KYtUEqMkyjV
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.scatter(l, b)\n",
"plt.xlabel(r\"$l$\")\n",
"plt.ylabel(r\"$b$\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 185,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiAAAAGdCAYAAAArNcgqAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAgyElEQVR4nO3dfXBU5eG38e+GJMtL2IUE2JAxAayUQHlRo8KqVQupGSZaLdGqpVMURkaNKKRVSUdQ+DmG6lSoM7xUi7FOZah0BEEExdjG6TQghGZErREUmrRhl1rNLqRmCeR+/uiwDxsCZJPNHXZzfWbODDln9+S+53iSy5Ozuw5jjBEAAIBFST09AAAA0PsQIAAAwDoCBAAAWEeAAAAA6wgQAABgHQECAACsI0AAAIB1BAgAALAuuacH0FZra6saGho0cOBAORyOnh4OAADoAGOMjh49qqysLCUlnf/6xgUXIA0NDcrOzu7pYQAAgE6or6/XRRdddN7HXXABMnDgQEn/m4DL5erh0QAAgI4IBoPKzs4O/x4/nwsuQE792cXlchEgAADEmY7ePsFNqAAAwDoCBAAAWEeAAAAA6wgQAABgHQECAACsiypARo4cKYfDccZSXFwsSWpublZxcbEyMjKUlpamoqIi+f3+bhk4AACIX1EFyO7du3X48OHwsmPHDknS7bffLklasGCBtmzZog0bNqiyslINDQ2aMWNG7EcNAADimsMYYzr75Pnz5+vNN9/U/v37FQwGNXTo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"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.hist(V[:, 0], bins=\"auto\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 172,
"metadata": {},
"outputs": [],
"source": [
"if \"alpha\" in samples:\n",
" data = np.vstack([samples[\"alpha\"], samples[\"beta\"], l, b, Vmag]).T\n",
" labels = [r\"$\\alpha$\", r\"$\\beta$\", r\"$l$\", r\"$b$\", r\"$|\\bf{V}_{\\rm ext}|$\"]\n",
"else:\n",
" data = np.vstack([samples[\"beta\"], l, b, Vmag]).T\n",
" labels = [r\"$\\beta$\", r\"$l$\", r\"$b$\", r\"$|\\bf{V}_{\\rm ext}|$\"]\n",
"\n",
"# keys = samples.keys()\n",
"# data = np.vstack([samples[key] for key in keys]).T\n",
"# labels = list(keys)\n"
]
},
{
"cell_type": "code",
"execution_count": 173,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABH8AAASMCAYAAAARLSE1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3SU1bv28WvSMymUJBAghF4iBiGASFdQEZAiIAJGKSo/pYOoCCKiIiqCCBoVVBAjCiooXQWk9yZtaIEQmpBQ0iakzvsHb+YYgWQSUmDy/aw1S3hmP/u5JyTnnFxn73sbLBaLRQAAAAAAALBLDkVdAAAAAAAAAAoO4Q8AAAAAAIAdI/wBAAAAAACwY4Q/AAAAAAAAdozwBwAAAAAAwI4R/gAAAAAAANgxwh8AAAAAAAA7RvgDAAAAAABgxwh/AAAAAAAA7BjhDwAAAAAAgB0j/AEKSXR0tDp06CAPDw/VqlVLq1evztPYAQMGqFy5cvL29lZwcLCWLFmS5+cAAAAAAOwf4Q+Qj/r27as5c+bc9L1BgwbJ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flCQ999xz2rt3r06fPq358+fr888/19ChQ+Xh4ZHtZ1iwYIGaNm2qypUr3/B+v3795O3tLTc3Nz300EPauXNntp/jVjw9PdW5c2eNHz9eSUlJWrp0qfbt26fOnTvnamxsbKzmzZunhIQEpaWl6aefftJff/2lli1b5vo5AAAAAIDigW1fxdiGDRs0ceJEvfbaa3r//fclSf7+/urevbtGjx6tl156SSVKlLjl/Zs2bdJDDz1k07NOnjx503Al0/nz51WuXLkbrmdeO3fu3C3vfeyxx/TOO+/ovffe0+LFi63Xx44dq3fffTfbun7//XddunTphi1fLi4u6tatm9q3by9fX18dOnRIH330kVq0aKHNmzerfv362c57M2FhYerTp498fHwUEBCg+fPnq3Tp0pKkdu3aqUWLFhozZky2Y+Pi4jRr1iwNHDhQFotF1atX17x581SvXj2bngMAAAAAKH4MFovFUtRFoGh0795da9asUVRUlLUnzK5du9SwYUO5ubkpMjLyhq1U/3blyhXt2rXLpmc1b95cbm5ut3y/WrVqqlWrlpYvX57l+okTJ1StWjV9/PHH1j46NxMeHq7w8HB169ZNPj4+WrZsmWbPnq3p06dnu3qpd+/e+vnnn3X+/Hn5+Phk+xmOHz+uunXrqmXLllq5cmW2YwEAAAAAuFOw8qeYSk9P1x9//KGOHTvetBlwv379sg1+JKlUqVI3nJyVV+7u7kpOTr7h+rVr16zv38qPP/6oAQMG6OjRo9Yjzrt27aqMjAy99tpr6tWr102DnYSEBP32229q27ZtjsGPdP2Ur86dO2vhwoVKT0+Xo6OjrR8PAAAAAIAiQ/hTTJ04cULx8fEKCQnJcj06OlqSNGjQoBznSElJ0eXLl216np+fX7ZhSbly5bI0Kc50/vx5SVL58uVveW9YWJjq169vDX4yderUSXPmzNGePXtuGlL9+uuvtzzl61YqVqyolJQUJSYm3tCfCAAAAACAOxENn4upzJDH19c3y/VJkybd9PrNbN68WeXKlbPpld1pXZJUr149HT169IZjyrdt22Z9/1YuXLig9PT0G66npqZK0i1P6vr+++/l6empTp06ZVvbv504cUJubm55Ojo9OjpaHTp0kIeHh2rVqqXVq1fnaeyAAQNUrlw5eXt7Kzg4WEuWLLnh/g8//FAVK1aUl5eX6tevr/j4+FzXCwAAAACwD6z8KaYyGzkfOHDAem3evHlav369pP/bbpWd++67T3/++adNz/P398/2/e7du+ujjz7SzJkzNWrUKElScnKyZs+ercaNG6tixYrWsWazWVFRUfL19ZWvr69q1qypP/74Q0ePHlXNmjWt43744Qc5ODiobt26NzwvOjpaq1atUq9evWQ0Gm/6vp+fX5Zrf//9txYvXqx27drJwSH3uemgQYPk7+9vfXaPHj107NixmzZjzm7syJEjNWPGDLm6umrHjh16+OGHdeLECevWtc8++0wrV67Upk2bVLFiRe3fvz/H4+4BAAAAAPaLhs/FVEZGhqpXr66zZ89q9OjRcnBw0Pvvv69OnTppwYIF6tu3r0aOHKng4OBCq6lHjx5atGiRRowYoerVq+vbb7/V9u3btXr1autR5pK0du1aPfTQQxo/frzeeustrV+/Xq1bt5aPj48GDx4sHx8fLV26VCtWrNDzzz+vWbNm3fCsTz/9VEOGDNHKlSvVtm3bG95v3bq13N3d1bRpU5UpU0aHDh3SzJkz5ezsrC1btigoKChXny0hIUGlS5fWiRMnrNvTHnzwQfXp00f9+vXL89idO3eqRYsW2rZtm+rWrav09HRVrFhRGzZsULVq1XJVIwAAAADAPrHtq5hycHDQwoULFRISog8++ECffPKJXn75Zf3444/q37+/wsPDtXv37kKtae7cuRo+fLi+++47DR06VKmpqVq6dGmW4OdmWrZsqc2bN6tBgwYKCwvT8OHDFRERoYkTJ+rzzz+/6T3ff/+9ypQpc8uG1V26dFFMTIymTp2qgQMHav78+eratat27tyZ6+BHko4dOyZPT88sfYmCg4N18ODBPI0dOHCg3N3d1ahRI7Vu3doa0p05c0Zms1k///yzypYtq1q1at00/AIAAAAAFB+s/AEKwYYNG/TMM88oMjLSem3s2LG6dOmSvvjiizyNTU9P19q1a3XgwAENGzZM0vU+TM2aNVP//v316aef6tixY2rTpo0WLlyoFi1aFOhnBAAAAADcmVj5A9ym5s2by2Aw3PT1xhtvSJI8PT1vaGYdFxd308bRto51dHRUmzZttGrVKi1fvlyS5O7uLkl688035e7urrp166pnz57W9wEAAAAAxQ/hD3CbNm7cKIvFctPXu+++K0mqUaOGEhISshxnf+DAAdWpU+eG+XIzVrp+mtnx48c
"text/plain": [
"<Figure size 1180x1180 with 25 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = corner.corner(data, labels=labels, show_titles=True, title_fmt=\".3f\", title_kwargs={\"fontsize\": 12}, smooth=1)\n",
"fig.savefig(f\"../plots/corner.png\", dpi=300, bbox_inches=\"tight\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Vizualize the results"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 20/20 [00:00<00:00, 113.74it/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"<KeysViewHDF5 ['Vext_x', 'Vext_y', 'Vext_z', 'alpha', 'alpha_cal', 'beta', 'beta_cal', 'e_mu_intrinsic', 'mag_cal', 'sigma_v']>\n"
]
}
],
"source": [
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n",
"catalogue = \"LOSS\"\n",
"simname = \"csiborg2_random\"\n",
"\n",
"nsims = paths.get_ics(simname)\n",
"\n",
"Vx = []\n",
"Vy = []\n",
"Vz = []\n",
"beta = []\n",
"sigma_v = []\n",
"alpha = []\n",
"\n",
"alpha_cal = []\n",
"beta_cal = []\n",
"mag_cal = []\n",
"e_mu_intrinsic = []\n",
"\n",
"\n",
"with File(f\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/flow_samples_{catalogue}_{simname}_smooth_0.hdf5\", 'r') as f:\n",
" for i, nsim in enumerate(tqdm(nsims)):\n",
" if i == 0:\n",
" print(f[f\"sim_{nsim}\"].keys())\n",
"\n",
" Vx.append(f[f\"sim_{nsim}/Vext_x\"][:])\n",
" Vy.append(f[f\"sim_{nsim}/Vext_y\"][:])\n",
" Vz.append(f[f\"sim_{nsim}/Vext_z\"][:])\n",
" alpha.append(f[f\"sim_{nsim}/alpha\"][:])\n",
" beta.append(f[f\"sim_{nsim}/beta\"][:])\n",
" sigma_v.append(f[f\"sim_{nsim}/sigma_v\"][:])\n",
"\n",
" alpha_cal.append(f[f\"sim_{nsim}/alpha_cal\"][:])\n",
" beta_cal.append(f[f\"sim_{nsim}/beta_cal\"][:])\n",
" mag_cal.append(f[f\"sim_{nsim}/mag_cal\"][:])\n",
" e_mu_intrinsic.append(f[f\"sim_{nsim}/e_mu_intrinsic\"][:])\n",
"\n",
"Vx = np.hstack(Vx)\n",
"Vy = np.hstack(Vy)\n",
"Vz = np.hstack(Vz)\n",
"alpha = np.hstack(alpha)\n",
"beta = np.hstack(beta)\n",
"sigma_v = np.hstack(sigma_v)\n",
"\n",
"alpha_cal = np.hstack(alpha_cal)\n",
"beta_cal = np.hstack(beta_cal)\n",
"mag_cal = np.hstack(mag_cal)\n",
"e_mu_intrinsic = np.hstack(e_mu_intrinsic)\n",
"\n",
"Vmag = np.sqrt(Vx**2 + Vy**2 + Vz**2)\n",
"\n",
"V = np.vstack([Vx, Vy, Vz]).T\n",
"V = csiborgtools.cartesian_to_radec(V)\n",
"l, b = csiborgtools.flow.radec_to_galactic(V[:, 1], V[:, 2])\n",
"\n",
"\n",
"data = np.vstack([alpha, beta, Vmag, l, b, sigma_v, alpha_cal, beta_cal, mag_cal, e_mu_intrinsic]).T\n",
"labels = [r\"$\\alpha$\", r\"$\\beta$\", r\"$|\\bf{V}_{\\rm ext}|$\", r\"$l$\", r\"$b$\", r\"$\\sigma_v$\", r\"$\\alpha_{\\rm cal}$\", r\"$\\beta_{\\rm cal}$\", r\"$M$\", r\"$\\sigma_\\mu$\"]"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAACIwAAAimCAYAAACB28hMAAAAO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UcdJUmKxWLt1sZisW99HwAAAAAAAAAAAADAwSupvwsApF2jXF555RVdf/31GjlypJ566imdfvrpev/993Xsscf2ep/t27frN7/5jZxOZ6fn//nPf+rMM8/U4Ycfrttuu02pqanavHmztm/f3un6n/3sZzryyCPbHRsxYkTvH0y7Ooykp6e3O5aenv6tR8VMmzZNs2fP1t133y1JevLJJ1VQUCCXy6XMzEw99NBDuvbaa/Xee+/pgw8+0LBhw77VfQAAAAAAAAAAAAAABy8CI+h3K1eu1AsvvKD7779fN954oyRp9uzZGjt2rH7xi1/o448/7vVeN954o4466ihFo1H5fL525+rq6jR79mydccYZeuWVV2Q299xg57jjjtOMGTO6XfPDH/5QH374oSQpHA7rpZde0vXXXy9Juummm3Tqqaeqrq6uQy2pqam9fq646upqnXHGGfrTn/6k//mf/9HatWt12mmnady4cZo4caJef/11XXvttbr77rt1xBFH6LzzzmvX2QQAAAAAAAAAAAAAAImRNAnvxRdf1MSJE2W321VSUqJly5YpFovp0EMPNTpY7GuvvPKKLBaLLr/8cuOYzWbTpZdeqk8++UTbtm3r1T7//ve/9corr2jhwoWdnl+6dKmqqqp09913y2w2KxQKqbW1tcd96+vr1dLS0uX5N998UzU1NaqpqdGFF16oRYsWGa9vuukmjRw5UsFgUBUVFcY1a9as0aGHHtqr52pr8+bNcjqdmjFjhiwWi8aPH68pU6bogw8+kCSNHz9eH3zwgfx+v9555x1t2bJF3/ve9/b4PgAAAAAAAAAAAACAgxuBkQR266236vzzz9eECRP0wAMPKBqNavbs2Xrrrbe0fft2zZ07t8trm5ub5fP5evXVUyjjq6++0qhRozqMbYkHHVatWtXjs0SjUV177bW67LLLNG7cuE7XLFu2TOnp6aqoqNDo0aOVmpqq9PR0XXXVVWpsbOz0mp/85CdKT0+XzWbT1KlT9X//93891rK71NRUnXXWWZo/f74aGhr05ptv6uuvv9ZZZ53V5TUtLS1qbGxUNBpt9/2oUaMUDof1xhtvKBaLad26dVqxYoXxzF9//bUaGxsVDod1//33q7W1Vaeddtoe1wwAAAAAAAAAAAAAOLgxkiZBrVixQnfffbd++ctf6t5775Uk5efna8aMGbrpppt01VVXKSMjo8vrP/roI02dOrVX99q6dauKi4u7PL9jxw4VFBR0OB4/VllZ2eM9HnvsMZWVlWnZsmVdrtm4caNaWlp01lln6dJLL9U999yj5cuX6w9/+INqamr05z//2VibkpKic845R6effrpcLpfWrVunBx54QMcdd5w+/vhjHX744T3W1NaiRYt08cUXKycnR4WFhXrxxReVnZ1tnJ82bZqOO+443XLLLZKkX//617rjjjuM83fffbeWLFmiOXPm6KWXXtIvf/lLzZo1S9nZ2Zo3b55OOeUUSdKSJUu0ZMkStba26vvf/75ef/31PaoTAAAAAAAAAAAAAJAYTLFYLNbfRaDvzZgxQ//6179UXl6u1NRUSdIXX3yhI444QjabTaWlpRowYECX1wcCAX3xxRe9utexxx4rm83W5fnhw4dr9OjReuutt9od37Jli4YPH67f/va3uv7667u83u/3a9SoUbrlllt0ww03SJJOPPFE+Xw+rVmzpt19tmzZoiuvvFKPPvqocfzKK6/U448/rm+++UYjR47s8j6bNm3S+PHjdfzxx+sf//hHT48NAAAAAAAAAAAAAMB+iw4jCSgajeqf//ynzjzzTCMs0tZPfvKTbsMikpSVlWV0tfiu7Ha7IpFIh+PxMTF2u73b62+99VZlZ2fr2muv7fE+knTBBRe0O37hhRfq8ccf1yeffNJtYGTEiBE666yz9OqrryoajcpisXR7PwAAAAAAAAAAAAAA9lcERhLQli1bVF9fr4kTJ7Y77vV6JUnXXHNNj3s0NTWpurq6V/fLzc3tNlxRUFCgioqKDsd37NghSRo4cGCX127cuFGLFy/WwoUL242uaWxsVHNzs0pLS5Wenq7s7GwNHDhQa9eu7RCGycvLk7Sra0pPBg8erKamJoVCIaWnp/e4HgAAAAAAAAAAAACA/ZG5vwtA34sHQ1wuV7vj99xzT6fHO/Pxxx+roKCgV1/btm3rdq/DDjtM33zzjerq6tod/+yzz4zzXamoqFBra6t+9rOfaejQocbXZ599pm+++UZDhw7VnXfeKUmaNGmScU1b8aBJbm5uj8+9ZcsW2Wy2TjuzdMfr9eqMM86Q0+nU6NGj9d5773W7/tFHH9XEiROVnJysBQsWdLrmk08+kdls1q9//es9ug4AAAAAAAAAAAAAADqMJKCMjAxJ0po1a4xjS5cu1b///W9J/x0F050JEybo3Xff7dX98vPzuz0/Y8YMPfDAA1q8eLFuvPFGSVIkEtGSJUs0efJkDR482FgbDodVXl4ul8sll8ulsWPH6rXXXuuw56233qr6+nr97ne/0/DhwyVJM2fO1L333qsnn3xSJ510krH2iSeeUFJSkk488UTjmNfr7RAg+c9//qO//vWvmjZtmszmPctaXXPNNcrPz5fX69WyZcs0c+ZMbdy4UdnZ2Z2uLygo0IIFC7R06dJOz7e2turnP/+5jjzyyD26DgAAAAAAAAAAAAAAicBIQiopKdHQoUP1+9//Xg6HQ2azWffee69mzpypl156SQsWLNC8efM0bty4LvfIysrSKaecslfqmTx5ss4991zdfPPN8ng8GjFihJ5++mmVlpbqySefbLd25cqVmjp1qubPn68FCxbI5XLp7LPP7rDnwoULJanducMPP1yXXHKJ/vSnP6mlpUUnnHCCli9frpdfflk333xzu9E35513nux2u6ZMmaK
"text/plain": [
"<Figure size 2230x2230 with 100 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = corner.corner(data, labels=labels, show_titles=True, title_fmt=\".3f\", title_kwargs={\"fontsize\": 12})\n",
"fig.suptitle(f\"{catalogue}, {simname}\")\n",
"fig.savefig(f\"../plots/corner_{catalogue}_{simname}.png\", dpi=300, bbox_inches=\"tight\")"
]
},
{
"cell_type": "code",
"execution_count": 210,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"294.53874356626227"
]
},
"execution_count": 210,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.mean(l)"
]
},
{
"cell_type": "code",
"execution_count": 299,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.38958"
]
},
"execution_count": 299,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.906 * 0.43"
]
},
{
"cell_type": "code",
"execution_count": 214,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj4AAAGdCAYAAAASUnlxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAsQ0lEQVR4nO3df3RU9Z3/8VcC5oc/JoCRTIKBRM1KFSQ14DCUFrfMMbixx1S3J1BOoSxHVhc50EDZhGLQPe4JxaVlKdRI9xxx95TCsq3YIua7aVDcltkgIVSxyoINGypMADmZ4Cjhx3y+f7gZHUhCJr8mM5/n45w5wXvf9+ZzP9659zWfe+cmwRhjBAAAYIHEaDcAAABgoBB8AACANQg+AADAGgQfAABgDYIPAACwBsEHAABYg+ADAACsQfABAADWGBrtBgyUYDCoEydO6KabblJCQkK0mwMAALrBGKNz584pKytLiYm9H6+xJvicOHFC2dnZ0W4GAADogePHj+vWW2/t9XqsCT433XSTpM86zuFwRLk1AACgO1pbW5WdnR06j/eWNcGn/fKWw+Eg+AAAEGP66jYVbm4GAADWIPgAAABrEHwAAIA1CD4AAMAaBB8AAGANgg8AALAGwQcAAFiD4AMAAKxB8AEAANYg+AAAAGsQfAAAgDUIPgAAwBoEHwAAYA2CDwAAsAbBB0BU5JS9Gu0mALAQwQdA1BGCAAwUgg8AALAGwQfAgPviCA+jPQAGEsEHQL/JKXuVYANgUCH4AOh3kYzwEJQA9CeCD4B+0Z0AQ8gBMNAIPgAGDEEHQLQRfAD0uY4CDqEHwGBA8AEAANYg+ADoE70d0eEr7gAGAsEHwKBxZeBp/2+CEIC+QvABMCgRdgD0B4IPgEGNAASgLxF8AMQMQhCA3iL4AOhThBMAgxnBB0CvDcRNyAQqAH2B4AOgRwgiAGIRwQcAAFiD4AMgpjDSBKA3CD4AAMAaBB8APZZT9mrURmAY+QHQEwQfAABgDYIPgJjDaA+AnupR8Nm4ca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qCvz98RjfhcuHBB9fX1YUEjMTFRHo9HXq+3w2W8Xu9VwaSwsDBU39jYKJ/PF1aTlpYml8sVqrn55pt155136l//9V8VCAR06dIlvfDCCxo5cqQKCgo6/L1tbW1qbW0NewG2IvR0H30FxLeIgs+ZM2d0+fJlZWRkhE3PyMjo9JKTz+frsr79Z1c1CQkJ+u1vf6uGhgbddNNNSklJ0Y9+9CNVV1dr+PDhHf7eyspKpaWlhV7Z2dmRbCoAAIhDMfGtLmOMFi5cqJEjR+q//uu/tG/fPhUXF+sb3/iGTp482eEy5eXl8vv9odfx48cHuNUAAGCwiSj4pKena8iQIWpubg6b3tzcLKfT2eEyTqezy/r2n13V7N69Wzt37tTWrVv1la98Rffee69++tOfKjU1VS+99FKHvzc5OVkOhyPsBdiISzcA8LmIgk9SUpIKCgpUW1sbmhYMBlVbWyu3293hMm63O6xekmpqakL1ubm5cjqdYTWtra2qq6sL1XzyySefNTYxvLmJiYkKBoORbAIAALDY0EgXKC0t1dy5czVx4kTdd999WrdunQKBgObNmydJmjNnjkaNGqXKykpJ0uLFizVt2jStXbtWRUVF2rp1q/bv369NmzZJ+uz+nSVLlujZZ59VXl6ecnNz9dRTTykrK0vFxcWSPgtPw4cP19y5c1VRUaHU1FT97Gc/U2Njo4qK+AYGAADonoiDT0lJiU6fPq2Kigr5fD7l5+eruro6dHNyU1NT2MjMlClTtGXLFq1cuVIrVqxQXl6eduzYoXHjxoVqli9frkAgoAULFqilpUVTp05VdXW1UlJSJH12ia26ulo/+MEP9PWvf10XL17U3Xf
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.hist(V[:, 0], bins=\"auto\", density=True)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 219,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.61461765 0.095553815\n",
"198.02641 36.928383\n",
"294.53874356626227 -5.542468825545464\n"
]
}
],
"source": [
"print(beta.mean(), beta.std())\n",
"print(np.mean(V[:, 0]), np.std(V[:, 0]))\n",
"print(l.mean(), b.mean())"
]
},
{
"cell_type": "code",
"execution_count": 213,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj8AAAGxCAYAAACN/tcCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAADSsElEQVR4nOydd5wV1fn/P+fMzC3blw6CgFhBsfcCKoqCYEGIsUTRGBNLBNF8YxJjEpOoERXFFrvJL8aICtIRQVEUqSIgCoqA9Lp9b5mZc35/zMyt03b3bj/vvAh472fPnLl39s5zz3me50M45xwCgUAgEAgE7QTa3BMQCAQCgUAgaEpE8CMQCAQCgaBdIYIfgUAgEAgE7QoR/AgEAoFAIGhXiOBHIBAIBAJBu0IEPwKBQCAQCNoVIvgRCAQCgUDQrpCbewItDcYYdu7cicLCQhBCmns6AoFAIBAIfMA5R1VVFXr06AFK3dd2RPCTwc6dO9GrV6/mnoZAIBAIBIJ6sG3bNvTs2dNVI4KfDAoLCwEYL15RUVEzz0YgEAgEAoEfKisr0atXr8R93A0R/GRgbXUVFRWJ4EcgEAgEglaGn5QVkfAsEAgEAoGgXSGCH4FAIBAIBO0KEfwIBAKBQCBoV4jgRyAQCAQCQbtCBD8CgUAgEAjaFSL4EQgEAoFA0K4QwY9AIBAIBIJ2hQh+BAKBQCAQtCtE8CMQCAQCgaBdITo8CwQCgQDxmIqP/rsYi6cuxalDT8RFNw5COD/U3NMSCBoFwjnnzT2JlkRlZSWKi4tRUVEh7C0EAkGbp3xfBWa+MB9Tn56NygNVIJSAc468wjBG/mooLr/zEnQ6pGNzT1Mg8KQu928R/GQggh+BQNBemP3Sh5h81yvQNR2cZd8KqGRkRtz4l5/g2vuvaurpCQR1oi73b5HzIxAIBO2ULxe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SOqvQQCgUAgELQrxMqPoE3TGqtBGGNYPudLzH39Ixx2bG9c9qvsvBnGGFbM+wpzX1uI3sf0xMjbh6K0a0kDjuq9IqGrOlZ9uAaX3HIBOvfsmPZcrry9OOdYt/hbHNxT4anVVB1rP/0Guzbvqbe31zdLv8P05+aioDgfl991KXoe0T1Ls2H593j/ubnIKwjjirsuRc8je2RpNq7chO0bd3oejzOOjSt/wNb129C7f696zXnz2q2Y9sxccM5x5V2Xou9x9WvIt3X9Nkx7Zi60uIrL77gUh5/Yt17j5Iqdm3bj/WfmomJ/JUbePhT9zzzKUeuVB9ZUWAnuuzbvwbBbL8KJFxwrGky2EkTCcwYi4bltYFcNAgBKQLatBmkJRGtjmP+vRZjy+HTs2rQHVCIANxI4h9wwCKPGX4buh3XBh//+BG9PnI6d3+82/K24sSU15PpzMWr8ZfW6Gb759/fw5t/fQzwSd8ylAIzjEEIwaMxZuPqey9D3uENtvb3qmkSqqRo+mbIEb0+cjk2rt9jaZdhBKQHnqJO3l67p+GzaMkyZOB3fLvvemDMxbqhnDD/ZGOfso/HFjBV4e+J0fLNkIySZggNgGsNpw07E6Akjcey5x2DpzJWY8vh0fP3ZhjrNmTGOky8aiNH3jsRJQwZ6ztkKdqdMnI7VH62DJFPzXBhOOP9YjL53JE4ZerxnSwLOOVZ9uAZTJk7Hyvlr0sY57txjMPrekU3a2sAKdt95YgY+n74clBpVe7rGcOQp/TDm3pE456rTIclS4mfWLf4Gj419Fjs37TGSm1MCodTk/LEP/RRX3HVpo8x748pNeOeJmVj09ueJx5jO0Lt/T4y+d6RobdBM1OX+LYKfDETw0/ppSDVIc/HVx1/jwSv/gZrKWuOBjGlbVViyIkFTdRACZJ6apTn36jPwx7cn1HkONRU1mPPKQrz75Ezs33HQVZs1nwZ4e21dvw33DfmLrUmnX/x6e+3avAcTBj+IfdsOuHqEyQEZWlzLurk
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.hexbin(l, b, gridsize=50, mincnt=1)\n",
"plt.xlabel(r\"$l$\")\n",
"plt.ylabel(r\"$b$\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjUAAAGdCAYAAADqsoKGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAD3KElEQVR4nOzdeXhcZdn48e/ZZk8yWZqk6ULpRlvaUqF0YReQIiBUZBVEEeEFQVFeQeHHovK+oiAKSgVRVFwQ3F7Agkih7G2BtlRoaUvp3mZfJsnsZ/v9caaZTGfSjQIt3J/rykVyznPOnMl1Mb3zPPdz34rrui5CCCGEEPs59cN+ACGEEEKIvUGCGiGEEEJ8JEhQI4QQQoiPBAlqhBBCCPGRIEGNEEIIIT4SJKgRQgghxEeCBDVCCCGE+EiQoEYIIYQQHwn6h/0AHxTHcWhsbKSsrAxFUT7sxxFCCCHELnBdl97eXhoaGlDVHc/FfGyCmsbGRoYNG/ZhP4YQQggh9sDmzZsZOnToDsd8bIKasrIywPullJeXf8hPI4QQQohd0dPTw7Bhw/r+Hd+Rj01Qs23Jqby8XIIaIYQQYj+zK6kjkigshBBCiI8ECWqEEEII8ZEgQY0QQgghPhIkqBFCCCHER8IeBTVz5sxhxIgRBAIBpk+fzmuvvbbD8X/9618ZN24cgUCASZMm8eSTTxac/+53v8u4ceMIh8NUVlZy4okn8uqrrxaM6ezs5IILLqC8vJxoNMoll1xCPB7fk8cXQgghxEfQbgc1jzzyCNdccw233HILS5cu5ZBDDmHWrFm0traWHL9gwQLOP/98LrnkEt544w1mz57N7NmzWb58ed+YsWPHcs899/DWW2/x8ssvM2LECE466STa2tr6xlxwwQWsWLGCefPmMXfuXF588UUuu+yyPXjLQgghhPgoUlzXdXfngunTp3P44Ydzzz33AF6l3mHDhvG1r32N73znO0Xjzz33XBKJBHPnzu07NmPGDKZMmcJ9991X8jV6enqoqKjgmWee4YQTTmDlypVMmDCB119/nalTpwLw1FNPccopp7BlyxYaGhp2+tzb7tnd3S1buoUQQoj9xO78+71bMzXZbJYlS5Zw4okn5m+gqpx44oksXLiw5DULFy4sGA8wa9asAcdns1nuv/9+KioqOOSQQ/ruEY1G+wIagBNPPBFVVYuWqbbJZDL09PQUfAkhhBDio2u3gpr29nZs26aurq7geF1dHc3NzSWvaW5u3qXxc+fOJRKJEAgE+OlPf8q8efOoqanpu0dtbW3BeF3XqaqqGvB1b7vtNioqKvq+pEWCEEII8dG2z+x++uQnP8myZctYsGABJ598Muecc86AeTq74vrrr6e7u7vva/PmzXvxaYUQQgixr9mtoKampgZN02hpaSk43tLSQn19fclr6uvrd2l8OBxm9OjRzJgxgwceeABd13nggQf67rF9gGNZFp2dnQO+rt/v72uJIK0RhBBCiI++3QpqfD4fhx12GM8++2zfMcdxePbZZ5k5c2bJa2bOnFkwHmDevHkDju9/30wm03ePWCzGkiVL+s7Pnz8fx3GYPn367rwFIYQQQnxE7XZDy2uuuYYvfvGLTJ06lWnTpnHXXXeRSCS4+OKLAbjooosYMmQIt912GwBXX301xx57LHfeeSennnoqDz/8MIsXL+b+++8HIJFI8L//+7+cfvrpDB48mPb2dubMmcPWrVs5++yzARg/fjwnn3wyl156Kffddx+maXLVVVdx3nnn7dLOJyGEEEJ89O12UHPuuefS1tbGzTffTHNzM1OmTOGpp57qSwbetGkTqpqfADriiCN46KGHuPHGG7nhhhsYM2YMjz76KBMnTgRA0zRWrVrFgw8+SHt7O9XV1Rx++OG89NJLHHzwwX33+dOf/sRVV13FCSecgKqqfO5zn+NnP/vZe33/Qoj9XDrdSNbsxGdUEQjIHzlCfJztdp2a/ZXUqRHioyedbmThopNwnBSqGmTmjKclsBHiI+Z9q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iP2a7XozLN90f8TdIyweGDEUJW2jpG1wCmdfzPZuUp0GSlc+1+aOf78DwLoDTwPgL7/8D4+/sZWUafO140eTMm26Uk7R65qqN/3Tlmp/X96XEGL3SVAjhNivZDNtJY9X08boINQZpSegzYTG2ut+zYanBxG+M4CS8Y7POrgOAFc1AHg0kOFH/15NwFCZOCSfN5O2o9RaCpodAGBd2ToArnn+mp0mFwshPhgS1Agh9hvpdCNvvnUlAIpi7HS8krIA6DRNrIyKmzGpntCLYioouTybqlDhfSwFQiPLmfNf0/uqESfiDq93XM8X4wFqu46g167BUbxZoIy968nFQoj3lwQ1Qoj9QjrdSCz2Oo6bBmBQzVd2eo2xxmt0+b03NuaPhXdeDVgN6AyqCPT93BXL4OBjgd9ERSPtlO/u4wshPgCSKCyE2Oel040sXHQSjpNCVcYDoGnlwMDdubNTqrhwxCB+n4pjbWxhvaHTv2qNrjmU9Vr4/bGiazW7jfZkM7V4CchZ0wIUelS3aGz/Z8yanfiMKgIBqTIsxIdBZmqEEPu8rNmJ46Q4eMJPmDxpzoDjYvEsr22NAeAGNaaPqAKgfdg8vlPr7WDqVr2PvVE1Maa9EWPmstsBcJT8vu9w7G9cN+9c2pNeEnBzbO2Ony/TxsJFJ/H662ewcNFJpNONe/ZGhRDviQQ1Qoj9Rig8Cp9/EADxeLzo/A/+tpzv/2M5rqbg9+tU6BoAllHHSUlvYjqpevM1qgLroiG0Npfqbpdk8N2++2SCh5Kx06xrWQrA72IvA6BoyZLPta55K46TYsSIK3GcFFmzcy+9YyHE7pCgRgixX+nt9Zacli71Ag5Ty6+im7ZDdlIlN33xE7x83ETGRYIEFOituYJ/jPhOwX2spEbmgQqUJyr56a9sqjfn8258ps97rYQ3U3NEcDQAipot+Uw3zI3TkaoEu3YvvUshxJ6QoEYIsV9Jp71E4UMPPRSAjOErON/
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"for i in range(len(x)):\n",
" plt.hist(x[i], bins=\"auto\", density=True, histtype=\"step\")\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test bias"
]
},
{
"cell_type": "code",
"execution_count": 437,
"metadata": {},
"outputs": [],
"source": [
"from jax.lax import cond"
]
},
{
"cell_type": "code",
"execution_count": 488,
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
"def bias(rho_norm, b):\n",
" def bias_small(rho_norm, b):\n",
" return jnp.log((1 + jnp.exp((1 - b + b * rho_norm))) / (1 + jnp.exp((1 - b))))\n",
"\n",
" def bias_large(rho_norm, b):\n",
" return 1 - b + b * rho_norm - jnp.log(1 + jnp.exp(1 - b))\n",
"\n",
" return jnp.where(rho_norm < 3, \n",
" bias_small(rho_norm, b), \n",
" bias_large(rho_norm, b))\n",
"\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 489,
"metadata": {},
"outputs": [],
"source": [
"rho_norm = jnp.linspace(0, 100, 100)\n",
"b = 2\n",
"y = bias(rho_norm, b)"
]
},
{
"cell_type": "code",
"execution_count": 490,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([ 0. , 1.0148089, 2.7738497, 4.7473445, 6.767546 ,\n",
" 8.787747 , 10.80795 , 12.828152 , 14.848353 , 16.868557 ,\n",
" 18.888758 , 20.90896 , 22.929163 , 24.949364 , 26.969566 ,\n",
" 28.989767 , 31.00997 , 33.03017 , 35.050373 , 37.07057 ,\n",
" 39.090775 , 41.110977 , 43.13118 , 45.151382 , 47.171585 ,\n",
" 49.191784 , 51.211987 , 53.23219 , 55.25239 , 57.272594 ,\n",
" 59.292793 , 61.312996 , 63.3332 , 65.3534 , 67.373604 ,\n",
" 69.39381 , 71.41401 , 73.43421 , 75.45441 , 77.47461 ,\n",
" 79.49481 , 81.515015 , 83.53522 , 85.55542 , 87.57562 ,\n",
" 89.595825 , 91.61603 , 93.63623 , 95.65643 , 97.67663 ,\n",
" 99.69683 , 101.71703 , 103.737236 , 105.75744 , 107.77764 ,\n",
" 109.797844 , 111.81805 , 113.83825 , 115.85845 , 117.87865 ,\n",
" 119.89885 , 121.91905 , 123.939255 , 125.95946 , 127.97966 ,\n",
" 129.99986 , 132.02007 , 134.04027 , 136.06047 , 138.08067 ,\n",
" 140.10088 , 142.12108 , 144.14128 , 146.16148 , 148.18169 ,\n",
" 150.20187 , 152.22208 , 154.24228 , 156.26248 , 158.28268 ,\n",
" 160.30289 , 162.32309 , 164.34329 , 166.3635 , 168.3837 ,\n",
" 170.4039 , 172.4241 , 174.4443 , 176.46451 , 178.48471 ,\n",
" 180.50491 , 182.52512 , 184.54532 , 186.56552 , 188.58572 ,\n",
" 190.60593 , 192.62613 , 194.64632 , 196.66652 , 198.68674 ], dtype=float32)"
]
},
"execution_count": 490,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y"
]
},
{
"cell_type": "code",
"execution_count": 485,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([ 0. , 1.0148089, 2.7738497, 4.753666 , 6.768387 ,\n",
" 8.787859 , 10.807965 , 12.828154 , 14.848354 , 16.868557 ,\n",
" 18.888758 , 20.90896 , 22.929163 , 24.949364 , 26.969566 ,\n",
" 28.989767 , 31.00997 , 33.03017 , 35.050373 , 37.07057 ,\n",
" 39.090775 , 41.110977 , 43.13118 , 45.151382 , 47.171585 ,\n",
" 49.191784 , 51.211987 , 53.23219 , 55.25239 , 57.272594 ,\n",
" 59.292793 , 61.312996 , 63.3332 , 65.3534 , 67.373604 ,\n",
" 69.39381 , 71.41401 , 73.43421 , 75.45441 , 77.47461 ,\n",
" 79.49481 , 81.515015 , 83.53522 , 85.55542 , 87.57562 ,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf,\n",
" inf, inf, inf, inf, inf], dtype=float32)"
]
},
"execution_count": 485,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bias_small(rho_norm, b)"
]
},
{
"cell_type": "code",
"execution_count": 487,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGdCAYAAAA44ojeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAABIpUlEQVR4nO3dd1RTd+MG8CcBEnbYS0Fw4sSBIlpXpc46cWPFarUqTlq1uKq1Fls7Ha2d2uGq1lFttVVw1IqoKCoOFEVBGQ6EMANJ7u+P921+L3UiCTeB53NOzmnu/SZ5+B5LHu6UCIIggIiIiMiISMUOQERERPRvLChERERkdFhQiIiIyOiwoBAREZHRYUEhIiIio8OCQkREREaHBYWIiIiMDgsKERERGR1zsQM8D61Wi4yMDNjZ2UEikYgdh4iIiJ6BIAjIz8+Hl5cXpNInbyMxyYKSkZEBb29vsWMQERHRc0hPT0ft2rWfOMYkC4qdnR2A//yA9vb2IqchIiKiZ6FUKuHt7a37Hn8Skywo/+zWsbe3Z0EhIiIyMc9yeAYPkiUiIiKjw4JCRERERocFhYiIiIwOCwoREREZHRYUIiIiMjosKERERGR0WFCIiIjI6FSooERHR6Nt27aws7ODm5sbBg4ciOTk5HJjSkpKEBERAWdnZ9ja2iI0NBTZ2dnlxqSlpaFv376wtraGm5sbZs+eDbVaXfmfhoiIiKqFChWUw4cPIyIiAsePH8f+/ftRVlaGHj16oLCwUDdm1qxZ2L17N7Zu3YrDhw8jIyMDgwcP1q3XaDTo27cvSktLcezYMXz//fdYv349Fi1apL+fioiIiEyaRBAE4XlffPfuXbi5ueHw4cPo3Lkz8vLy4Orqio0bN2LIkCEAgMuXL6Nx48aIi4tD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Yxq11DsWEaPBYWIiMgA1BotVsZcxaqDKRCEtvCwzMXyHhPQtS7LybNgQSEiItKzpKx0RPz2KW5e7QpAipHtfPB2v49haWEmdjSTwYJCRESkRzGXMjDz71cAi/uwcQfe6xaJAS1riR3L5FT4SrJHjhxBv3794OXlBYlEgp07d5ZbL5FIHvlYsWKFboyvr+9D65cvX17pH4aIiEgsZRot3t93GeO/P4PiOy/BQl0bXw56jeXkOVV4C0phYSECAgIwbtw4DB48+KH1mZmZ5Z7v3bsX48ePR2hoaLnl77zzDiZMmKB7bmdnV9EoRERERiEx8wYW7krE+Rv/uTz9yCYDMLf3G7CVW4qczHRVuKD07t0bvXv3fux6Dw+Pcs937dqFbt26oW7duuWW29nZPTSWiIjI1Hx9IgYrk+ZBI7GHneUMLB/cBn1b8HL1lWXQmwVmZ2fjt99+w/jx4x9at3z5cjg7O6NVq1ZYsWIF1Gr1Y99HpVJBqVSWexAREYmpVK3Fu3su4r1dd6EVpLCykOH7Cc1YTvTEoAfJfv/997Czs3toV9D06dPRunVrODk54dixY4iKikJmZiY+/vjjR75PdHQ0lixZYsioREREz+zqnRzM3noJiem5AOzQy3kxFvfuDDu5ldjRqg2JIAjCc79YIsGOHTswcODAR6739/fHSy+9hFWrVj3xfb777ju8/vrrKCgogFwuf2i9SqWCSqXSPVcqlfD29kZeXh7s7e2fNz4REVGFfXh0G76/8iEK08fAVqiHFUMD0LMpD1l4FkqlEgqF4pm+vw22BeWvv/5CcnIytmzZ8tSxQUFBUKvVuHHjBho1avTQerlc/sjiQkREVFVUag2if7+MzTd2wkJRCPfa8dg6eCxqO1qLHa1aMlhB+fbbb9GmTRsEBAQ8dWxiYiKkUinc3NwMFYeIiOi53bxfiKkbz+D87TxAOghtPBvj6wFvwlrGP54NpcIFpaCgACkpKbrnqampSEx
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.plot(rho_norm, y)\n",
"plt.plot(rho_norm, bias_small(rho_norm, b), ls=\"--\")\n",
"plt.plot(rho_norm, bias_large(rho_norm, b), ls=\"dotted\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 462,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([[1.3646735 , 1.434935 , 1.5887474 , 1.6949235 , 1.7769545 ,\n",
" 1.8709289 , 2.0290222 , 2.1513133 , 2.2334485 , 2.329708 ,\n",
" 2.444497 , 2.5160108 , 2.5457559 , 2.5692239 , 2.608365 ,\n",
" 2.6157517 , 2.5902514 , 2.5320826 , 2.4516525 , 2.3783646 ,\n",
" 2.3570633 , 2.2927842 , 2.235333 , 2.1849432 , 2.131144 ,\n",
" 2.1050715 , 2.1284485 , 2.1777897 , 2.2121887 , 2.2108288 ,\n",
" 2.2272425 , 2.2835732 , 2.2929268 , 2.2634182 , 2.241768 ,\n",
" 2.2274647 , 2.1347542 , 2.0022526 , 1.8764566 , 1.757152 ,\n",
" 1.5877327 , 1.4179734 , 1.2245289 , 1.0326 , 0.83725584,\n",
" 0.9779409 , 0.8560009 , 0.7459278 , 0.64249325, 0.5510863 ,\n",
" 0.4705007 , 0.40490875, 0.3523176 , 0.3036849 , 0.25979096,\n",
" 0.22670034, 0.2001784 , 0.17650758, 0.15544249, 0.1421564 ,\n",
" 0.1319982 , 0.12369715, 0.11719201, 0.11655279, 0.1178802 ,\n",
" 0.12243555, 0.12922992, 0.13944156, 0.15134403, 0.16509394,\n",
" 0.1822752 , 0.20241688, 0.22445495, 0.24860011, 0.2747241 ,\n",
" 0.3021833 , 0.32956758, 0.3581138 , 0.38779044, 0.4175948 ,\n",
" 0.44733912, 0.47730353, 0.5037043 , 0.5280483 , 0.54990727,\n",
" 0.5693671 , 0.5882731 , 0.5948174 , 0.59384704, 0.5889778 ,\n",
" 0.581055 , 0.5679292 , 0.5492731 , 0.5233676 , 0.4954697 ,\n",
" 0.46466196, 0.43128756, 0.39837906, 0.36807328, 0.34046337,\n",
" 0.31282854, 0.2916725 , 0.2727041 , 0.25453895, 0.24449702,\n",
" 0.24894878, 0.25541925, 0.2639165 , 0.27725202, 0.30834335,\n",
" 0.35066515, 0.39812556, 0.45682377, 0.5331358 , 0.6178547 ,\n",
" 0.71351516, 0.82063544, 0.93213975, 0.7524649 , 0.91292727,\n",
" 1.0464138 , 1.1508375 , 1.251418 , 1.3491758 , 1.380678 ,\n",
" 1.4025079 , 1.4121331 , 1.3930808 , 1.3075174 , 1.2249244 ,\n",
" 1.1454424 , 1.0572306 , 0.92409194, 0.79356396, 0.99048895,\n",
" 0.90620065, 0.828229 , 0.76082796, 0.698414 , 0.6505554 ,\n",
" 0.61402965, 0.5859119 , 0.5657008 , 0.5566434 , 0.553449 ,\n",
" 0.5563643 , 0.5653806 , 0.58270925, 0.6048739 , 0.6295522 ,\n",
" 0.65922254, 0.69377667, 0.7332983 , 0.7763519 , 0.8221179 ,\n",
" 0.8646504 , 0.9119135 , 0.9640299 , 0.7129375 , 0.7891277 ,\n",
" 0.8571147 , 0.9190582 , 0.9803752 , 1.0396756 , 1.0979573 ,\n",
" 1.1553053 , 1.1901921 , 1.2196769 , 1.2462472 , 1.2697977 ,\n",
" 1.2838 , 1.2984327 , 1.3102382 , 1.3194026 , 1.3225473 ,\n",
" 1.3196949 , 1.3108543 , 1.306914 , 1.3042039 , 1.294299 ,\n",
" 1.2772909 , 1.260877 , 1.2417816 , 1.2328533 , 1.2146448 ,\n",
" 1.1977972 , 1.1745423 , 1.1424965 , 1.1101197 , 1.101576 ,\n",
" 1.0878228 , 1.0645813 , 1.0333818 , 0.9999348 , 0.9850849 ,\n",
" 0.97065103, 0.9509536 , 0.92941177, 0.90072215, 0.8717872 ,\n",
" 0.89219344, 0.91042507, 0.92014444, 0.9214734 , 0.9279727 ,\n",
" 0.9602722 , 1.0090538 , 1.0460545 , 1.0889293 , 1.1205827 ,\n",
" 1.1391929 , 1.1663109 , 1.1970347 , 1.209669 , 1.2047967 ,\n",
" 1.187488 , 1.1674637 , 1.1264628 , 1.0695738 , 1.0057136 ,\n",
" 0.938321 , 0.8566655 , 0.7593492 , 0.9830673 , 0.91409945,\n",
" 0.8435176 , 0.7711419 , 0.70559967, 0.6515862 , 0.5985839 ,\n",
" 0.54632187, 0.502273 , 0.45877022, 0.42054328, 0.3934341 ,\n",
" 0.37144205, 0.34999198, 0.3290352 , 0.31012294, 0.30171677,\n",
" 0.2962771 , 0.29083773, 0.28842846, 0.28969994, 0.2920595 ,\n",
" 0.2989802 , 0.31210732, 0.3281337 , 0.34449434, 0.36123806,\n",
" 0.3927679 , 0.4286105 , 0.4655993 , 0.5053859 , 0.5691393 ,\n",
" 0.6362327 , 0.7067257 , 0.78761345, 0.8970398 , 0.6997818 ,\n",
" 0.8535489 , 1.0259563 , 1.2127107 , 1.3874727 , 1.5501367 ,\n",
" 1.7126855 , 1.867709 , 2.001937 , 2.1140966 , 2.1916142 ,\n",
" 2.2460651 , 2.2813406 , 2.297223 , 2.2536044 , 2.196093 ,\n",
" 2.1253767 , 2.03259 , 1.8823694 , 1.7347625 , 1.6018292 ,\n",
" 1.4532942 , 1.283286 , 1.1178659 , 0.9570924 , 0.8172244 ,\n",
" 0.6897191 , 0.9147335 , 0.8344159 , 0.7673473 , 0.7086063 ,\n",
" 0.6641469 , 0.6225449 , 0.5973549 , 0.57440835, 0.5516249 ,\n",
" 0.5317883 , 0.53176755, 0.52977276, 0.5252905 , 0.5225403 ,\n",
" 0.5306233 , 0.537339 , 0.5404994 , 0.5452957 , 0.5526741 ,\n",
" 0.55304235, 0.5479818 , 0.55197227, 0.55319256, 0.5490432 ,\n",
" 0.53936017, 0.5228505 , 0.51295424, 0.51168084, 0.5088841 ,\n",
" 0.5002767 , 0.4915954 , 0.48361063, 0.49827686, 0.515961 ,\n",
" 0.5374632 , 0.5629945 , 0.5906428 , 0.6248773 , 0.68398076,\n",
" 0.7490516 , 0.81219375, 0.8711733 , 0.93306047, 0.70086324,\n",
" 0.7925049 , 0.8672184 , 0.9352511 , 0.9940311 , 1.0134267 ,\n",
" 1.0167335 , 1.0081466 , 0.98725164, 0.94359004, 0.88869536,\n",
" 0.8169855 , 0.7289902 , 0.968997 , 0.90388423, 0.8363196 ,\n",
" 0.7754801 , 0.7210487 , 0.6658874 , 0.6120377 , 0.5709876 ,\n",
" 0.5380987 , 0.5059658 , 0.47608382, 0.45786625, 0.4429148 ,\n",
" 0.42846784, 0.41462535, 0.40961948, 0.40622896, 0.40261546,\n",
" 0.39951095, 0.3999179 , 0.40015367, 0.40194058, 0.40492177,\n",
" 0.41054347, 0.4160852 , 0.42165357, 0.43058476, 0.44315138,\n",
" 0.45663595, 0.47077337, 0.49090838, 0.5150634 , 0.53872305,\n",
" 0.56145823, 0.58853346, 0.6170561 , 0.64647895, 0.67653644,\n",
" 0.69559836, 0.71325165, 0.7297187 , 0.74179244, 0.74279547,\n",
" 0.7412879 , 0.73549235, 0.72251487, 0.7011512 , 0.6794939 ,\n",
" 0.6576475 , 0.634315 , 0.62078434, 0.6265948 , 0.6586482 ,\n",
" 0.75736463, 0.86079174, 0.94762903, 0.99869275]], dtype=float32)"
]
},
"execution_count": 462,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bias(loader._los_density[0], 2.)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 436,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjkAAAG0CAYAAADQLTb2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAACpOUlEQVR4nOzdd3iUVdrH8e+UzGTSe2+Q0DvSkaqIKAa7rgXXim1Fsbv23h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4cOt+rpCCHE2UxSF7Ecfo3zuXFAUvGJiiH1rJqb+/T3dtTZBQk4Hs2LFCtfHH3744Rl73dbch0cIIcSxrLm5HL7uOmzZOQAYe/ci8Z//RCf7lbm0680As7KyuOGGGwgNDcVkMtGnTx82bdrk6W4JIYQQraps3jwOnD/BFXB8R40i6dtvJeAcpd2O5JSUlDBy5EjGjRvHwoULCQ8PZ//+/QQHB3u6a0IIIUSrUBwOsh580FVcjFZL5NNPE3LtNZ7tWBvVbkPOa6+9Rnx8PJ9//rnrWqdOnTzYIyGEEKL12EpKOHz1NWpxMaALDSXx639jTErybMfasHY7XTVnzhwGDRrEVVddRUREBAMGDOCTTz457mNqamooLy9vcBNCCCHauuqNG0mbcqkr4Piddx4pq1ZKwDmBdhtyDh06xIcffkiXLl1YtGgRd911F/fddx9ffvllk4955ZVXCAwMdN3i4+PPYI+FEEKIk+Ow2ch96SXSb/ortvx8DJ06kfDlF8T/3/tom9j7TLhplHa6LMZgMDBo0CB+//1317X77ruPjRs3snb
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"b = 1.4\n",
"\n",
"rho = np.linspace(0, 3, 100)\n",
"\n",
"def bias(rho, b):\n",
" return np.log((1 + np.exp((1 - b + b * rho))) / (1 + np.exp((1 - b))))\n",
"\n",
"def linear_bias(rho, b):\n",
" return (1 - b + b * rho)\n",
"\n",
"plt.figure()\n",
"cols = plt.rcParams['axes.prop_cycle'].by_key()['color']\n",
"for i, b in enumerate([0.5, 1, 1.5, 3]):\n",
" plt.plot(rho, bias(rho, b), label=f\"b = {b}\", c=cols[i])\n",
" plt.plot(rho, 1 - b + b * rho - np.log(1 + np.exp(1 - b)), ls=\"--\", c=cols[i])\n",
" # plt.plot(rho, linear_bias(rho, b), ls=\"--\", c=cols[i])\n",
" \n",
"\n",
"plt.axline((1, 1), slope=1, color=\"red\", linestyle=\"dotted\")\n",
"plt.axhline(0, color=\"black\", linestyle=\"--\")\n",
"plt.xlabel(r\"$\\rho / \\langle \\rho \\rangle$\")\n",
"plt.ylabel(r\"$1 + \\delta_g$\")\n",
"plt.legend()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 133,
"metadata": {},
"outputs": [],
"source": [
" def get_field(kind):\n",
" folder = \"/mnt/extraspace/rstiskalek/catalogs\"\n",
" from os.path import join\n",
" if kind == \"density\":\n",
" fpath = join(folder, \"twompp_density_carrick2015.npy\")\n",
" return np.load(fpath).astype(np.float32)\n",
" elif kind == \"velocity\":\n",
" fpath = join(folder, \"twompp_velocity_carrick2015.npy\")\n",
" field = np.load(fpath).astype(np.float32)\n",
"\n",
" # Because the Carrick+2015 data is in the following form:\n",
" # \"The velocities are predicted peculiar velocities in the CMB\n",
" # frame in Galactic Cartesian coordinates, generated from the\n",
" # \\(\\delta_g^*\\) field with \\(\\beta^* = 0.43\\) and an external\n",
" # dipole \\(V_\\mathrm{ext} = [89,-131,17]\\) (Carrick et al Table 3)\n",
" # has already been added.\"\"\n",
" field[0] -= 89\n",
" field[1] -= -131\n",
" field[2] -= 17\n",
" field /= 0.43\n",
"\n",
" return field"
]
},
{
"cell_type": "code",
"execution_count": 135,
"metadata": {},
"outputs": [],
"source": [
"density = get_field(\"density\")\n",
"velocity = get_field(\"velocity\")"
]
},
{
"cell_type": "code",
"execution_count": 136,
"metadata": {},
"outputs": [],
"source": [
"from h5py import File"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 137,
"metadata": {},
"outputs": [],
"source": [
"with File(\"/mnt/extraspace/rstiskalek/catalogs/Carrick2015_unscaled.hdf5\", 'w') as f:\n",
" f.create_dataset(\"density\", data=density)\n",
" f.create_dataset(\"velocity\", data=velocity)\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv_csiborg",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}