mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-23 05:08:03 +00:00
444 lines
352 KiB
Text
444 lines
352 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 219,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"The autoreload extension is already loaded. To reload it, use:\n",
|
||
|
" %reload_ext autoreload\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from h5py import File\n",
|
||
|
"%matplotlib inline\n",
|
||
|
"\n",
|
||
|
"from jax import numpy as jnp\n",
|
||
|
"import jax\n",
|
||
|
"\n",
|
||
|
"from numpyro.infer import MCMC, NUTS, util\n",
|
||
|
"\n",
|
||
|
"import csiborgtools\n",
|
||
|
"\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## LOS density & radial velocity plots "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"14:31:30: reading the catalogue.\n",
|
||
|
"14:31:30: reading the interpolated field.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 1/1 [00:00<00:00, 6.08it/s]\n",
|
||
|
"/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:102: 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": [
|
||
|
"14:31:31: calculating the radial velocity.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 452/452 [00:00<00:00, 23479.46it/s]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"14:31:31: reading the catalogue.\n",
|
||
|
"14:31:31: reading the interpolated field.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 101/101 [00:22<00:00, 4.53it/s]\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"14:31:53: calculating the radial velocity.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 452/452 [00:02<00:00, 171.48it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fpath = \"/mnt/extraspace/rstiskalek/catalogs/A2.h5\"\n",
|
||
|
"\n",
|
||
|
"loader_carrick = csiborgtools.flow.DataLoader(\"Carrick2015\", \"A2\", fpath, paths, ksmooth=None)\n",
|
||
|
"loader_csiborg = csiborgtools.flow.DataLoader(\"csiborg1\", \"A2\", fpath, paths, ksmooth=1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 8,
|
||
|
"metadata": {},
|
||
|
"out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RjQahWmaWLZsGWzbhm3bunyOhobG7iOfB1pbm3PtbBZoaZnWofF4HHfffTduuOEGtLh8hlumVqtV3Hnnnbjwwgt3yUbato3f/e532LZtG0444QQAwO9//3vEYjF89KMfnXD8+eefjwMPPBA/+tGPcPHFF094v1qt4vvf/z6AMTWY+NGPfoSzzz4bRx11lGs7tH1vDB1aoKGxhyEajSKZTKqkLwDqfw0NDY29AZs3b4Zt2zj44IMbHvOqV70Kn/zkJ/GOd7wDvb29OPfcc/GVr3wFw8PDU55/xYoVaG1tRSAQwOtf/3p87nOfwymnnAIAeP755wEAhxxyiOtnDz74YHUMcckll6C1tRXBYBAf+chHsHr1alx00UXq/eeffx4HHXRQ3Wfe8pa3oLW1Fa2trTjppJOmbPPeCq3IamjsYSgUCrAsC6VSScVh2fYk2WEaGhoa00UkMqaMNuva08R0bd4NN9yAa665Bvfddx8efvhh3HLLLfjCF76ABx54AIcddljDz/3pT39CW1sbSqUSHnnkEVx99dXo7u7GVVddNeM2AMC//du/4ayzzsJLL72Ej3zkI7j55pvR3d096We+9a1vIZfL4eabb8YDDzww7WvtbdBEVkNjAcGITO0+sm17ghKriayGhsaswDCm7d5vJg444AAYhoHnnntuymN7enrwtre9DW9729vwhS98AUcddRS++tWv4vbbb2/4mTVr1qCzsxMAcOihh+Lhhx/GDTfcgKuuugoHHnggAODZZ591VUqfffZZrF27tu61pUuXYv/998f++++PW2+9Feeddx42btyI/v5+9X02bdpU95lly5YBwJSEd2+HDi2YI+iqBRozhREw0HltJzqv7YQRcCe0TgWW1Qs0kdXQ0Nib0N3djXPOOQfr169XFQgkGtWFDQQCeMUrXuH6mcng9XrVJjSvfe1r0d3dja997WsTjrvrrrvwwgsv4JJLLml4ruOPPx7HHHMMbrjhBvXaJZdcgj/84Q/429/+NqN2aWgiO2fQO3tpzAWcRFbHxmpoaOytWL9+PUzTxPHHH4+f//zneOGFF/Dss8/i5ptvxoknnohf//rXeNe73oVf//rXeP7557Fp0yZ89atfxW9+8xu86U1vmvTcIyMjGBoawtatW3HHHXfgBz/4gfpMS0sL/uM//gO/+tWvcOWVV+Kpp57Cli1b8P3vfx+XXXYZLrzwwrr4Vzd8+MMfxn/8x39g586dAICPfOQjOPHEE3HmmWfi3//93/HEE0/g5Zdfxu9+9zv89re/hdfrVZ/NZrPYsGEDNmzYAAB4+eWXsWHDBmzbtm03enPPhQ4t0NDYg+AksqwhqxVZDQ2NvQ377bcfnnjiCdxwww249tprMTg4iL6+PhxzzDH49re/jX333ReRSATXXnsttm/fjmAwiAMOOADf+9738A//8A+TnpuJVz6fDytXrsR73/te/Ou//qt6/8ILL8T999+PG264Aa95zWtQLBZxwAEH4FOf+hQ+/OEPT1ll4HWvex3WrFmDG264Ad/61rcQCoVw77334utf/zpuvfVWfOITn4BlWVizZg3OPfdcfOQjH1Gffeyxx3D66aerv6+55hoAwLvf/W7cdtttM+zFPR+GrWfAOUU6nUZHRwdSqRTa29ub3RyNBQy7YiP7o7Eki9ZLWmH4JxrCSqWC++67D/F4HLZt4/DDD0d3dze6u7sRCoXmu8kaGhp7OIrFIl5++WWsWbNG2xCNXcZk42iueZBWZDU0FgpsoLq1qn53g1OB1etQDQ0NDY29GTpGVkOjySgWi4hGo6hUKlMeW61W68irrlqgoaGhobE3QxNZDY0mIx6Po1KpNMyyleBmCJZlwTAMXbVAQ0NDQ2OvhiaycwRdfktjOpBVB6Yio5VKBdlsFpVKRam3JLIaGhoaGhp7IzSRnSPo8lsa0wFjXqeDcrk
|
||
|
"text/plain": [
|
||
|
"<Figure size 700x700 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# ks = [115, 53, 77, 105, 26, 61, 86, 29, 80, 21]\n",
|
||
|
"\n",
|
||
|
"k = 50\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(101):\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",
|
||
|
"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",
|
||
|
"# 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, :], 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/example_los.png\", dpi=500, bbox_inches=\"tight\")\n",
|
||
|
"\n",
|
||
|
"fig.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Test running a model"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 220,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"10:31:41: reading the catalogue.\n",
|
||
|
"10:31:41: reading the interpolated field.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 1/1 [00:00<00:00, 6.57it/s]\n",
|
||
|
"/mnt/users/rstiskalek/csiborgtools/csiborgtools/flow/flow_model.py:102: 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",
|
||
|
" simname, catalogue, ksmooth, paths)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"10:31:41: calculating the radial velocity.\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 452/452 [00:00<00:00, 24805.05it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/PV_compilation_Supranta2019.hdf5\"\n",
|
||
|
"fpath_data = \"/mnt/extraspace/rstiskalek/catalogs/A2.h5\"\n",
|
||
|
"loader = csiborgtools.flow.DataLoader(\"Carrick2015\", \"A2\", fpath_data, paths, ksmooth=0)\n",
|
||
|
"Omega_m = csiborgtools.simname2Omega_m(\"Carrick2015\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 221,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"los_overdensity = loader.los_density[:, 0, :]\n",
|
||
|
"los_velocity = loader.los_radial_velocity[:, 0, :]\n",
|
||
|
"\n",
|
||
|
"# # PV calibration\n",
|
||
|
"# RA = loader.cat[\"RA\"]\n",
|
||
|
"# dec = loader.cat[\"DEC\"]\n",
|
||
|
"# zCMB = loader.cat[\"z_CMB\"]\n",
|
||
|
"\n",
|
||
|
"# mB = loader.cat[\"mB\"]\n",
|
||
|
"# x1 = loader.cat[\"x1\"]\n",
|
||
|
"# c = loader.cat[\"c\"]\n",
|
||
|
"\n",
|
||
|
"# e_mB = loader.cat[\"e_mB\"]\n",
|
||
|
"# e_x1 = loader.cat[\"e_x1\"]\n",
|
||
|
"# e_c = loader.cat[\"e_c\"]\n",
|
||
|
"\n",
|
||
|
"# PV no calibration\n",
|
||
|
"RA = loader.cat[\"RA\"]\n",
|
||
|
"dec = loader.cat[\"DEC\"]\n",
|
||
|
"z_obs = loader.cat[\"z_obs\"]\n",
|
||
|
"\n",
|
||
|
"r_hMpc = loader.cat[\"r_hMpc\"]\n",
|
||
|
"e_r_hMpc = loader.cat[\"e_rhMpc\"]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 222,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"model = csiborgtools.flow.SD_PV_validation_model(los_overdensity, los_velocity, RA, dec, z_obs, r_hMpc, e_r_hMpc, loader.rdist, Omega_m)\n",
|
||
|
"\n",
|
||
|
"# model_old = csiborgtools.flow.SN_PV_validation_model_old"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 223,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{'ll': Array(-3291.0427, dtype=float32)}"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 223,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"true_samples = {'Vext_x': jnp.array(0.0, dtype=jnp.float32),\n",
|
||
|
" 'Vext_y': jnp.array(0.0, dtype=jnp.float32),\n",
|
||
|
" 'Vext_z': jnp.array(0.0, dtype=jnp.float32),\n",
|
||
|
" 'alpha': jnp.array(1, dtype=jnp.float32),\n",
|
||
|
" 'beta': jnp.array(1, dtype=jnp.float32),\n",
|
||
|
" 'sigma_v': jnp.array(112, dtype=jnp.float32),\n",
|
||
|
" }\n",
|
||
|
"\n",
|
||
|
"util.log_likelihood(model, true_samples)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 228,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"nuts_kernel = NUTS(model)\n",
|
||
|
"mcmc = MCMC(nuts_kernel, num_warmup=500, num_samples=500, chain_method=\"sequential\")\n",
|
||
|
"rng_key = jax.random.PRNGKey(0)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 229,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"sample: 100%|██████████| 1000/1000 [01:15<00:00, 13.27it/s, 3 steps of size 7.11e-01. acc. prob=0.88]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"mcmc.run(rng_key)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 231,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
" mean std median 5.0% 95.0% n_eff r_hat\n",
|
||
|
" Vext_x -62.10 18.47 -61.58 -97.45 -36.33 655.27 1.00\n",
|
||
|
" Vext_y 24.97 27.82 24.77 -12.97 78.06 669.10 1.00\n",
|
||
|
" Vext_z 3.54 25.23 2.67 -37.75 42.72 495.87 1.00\n",
|
||
|
" alpha 1.64 0.21 1.65 1.29 1.98 473.75 1.00\n",
|
||
|
" beta 0.83 0.06 0.84 0.73 0.94 542.08 1.00\n",
|
||
|
" sigma_v 158.64 14.09 158.77 133.78 180.44 627.47 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": 232,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAi4AAAGdCAYAAAA1/PiZAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB7JElEQVR4nO3de3wU9bk/8M9uyIVEEgiBJERKwk2IXCIgMQbrkYaCUATbc+SiolTxqMSjUKugXIsarS1iC0pFUH8qF7VeaKGxEEQFgzmHixpBrkEQk0gSSEKABLLz+yPMsruZ2fnO7Mxeks/79eKlhNnZmd3NzjPf7/M8X5skSRKIiIiIQoA90AdAREREJIqBCxEREYUMBi5EREQUMhi4EBERUchg4EJEREQhg4ELERERhQwGLkRERBQyGLgQERFRyGgT6AMwg8PhwI8//oh27drBZrMF+nCIiIhIgCRJqK2tRZcuXWC3i42ltIjA5ccff0TXrl0DfRhERERkwPHjx3HllVcKbdsiApd27doBaDrx2NjYAB8NERERiaipqUHXrl2d13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7/xw/ftzq0yAiPxHp3MtuvUStl67AJSEhAWFhYSgvL3f7eXl5OZKSkhQf06lTJ3z44Yeoq6vD999/j++++w5XXHEFunfvrvo87du3R+/evXHo0CHFf4+MjERsbKzbHyK6LJQX4yyrEetHJLodEbUsunJcIiIiMHjwYBQUFGD8+PEAmpJzCwoKkJub6/WxUVFRSElJwYULF/D3v/8dt912m+q2Z86cweHDh3HnnXfqOTwiQuCSWs2qAKo6U6+9kY7
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(samples[\"alpha\"], samples[\"beta\"])\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Vizualize the results"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 49,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"with File(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/peculiar_velocity/flow_samples_A2_Carrick2015.hdf5\", 'r') as f:\n",
|
||
|
" beta = f[\"sim_0/Vext_z\"][:]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 50,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAj0AAAGdCAYAAAD5ZcJyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA6hUlEQVR4nO3df1yV9f3/8ScgB1DjhxIcJVSW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ba2Vna7vd0+drvdp/pz5XA4JEmVlZVnXc/pee3JyclRQ0ODZ/r000/Pa0wAAODS5VPosdlsSk5OVnFxsaettbVVxcXFSk1NbbdPamqqV70kFRUVnbH+XJ2+rb1fv36e9bz33nted5EVFRUpPDxcV199dbvLCAkJUXh4uNcEAAC6J59Pb2VnZ2vy5MkaNWqUUlJStGrVKrndbk2ZMkWSNGnSJMXFxSkvL0+SNGvWLI0ZM0YrVqxQZmamNm7cqF27dmnt2rWeZR49elRVVVWqqamRJO3fv1+SPHdpffzxx9qwYYN+/OMfq2/fvtq7d6/mzJmjG264Qddcc40kaezYsbr66qs1ceJELVu2TE6nU/Pnz9eMGTMUEhJyfnsJQLdRWXeiQ/2ietkUFxl2gUcD4GLyOfSMHz9ehw8f1sKFC+V0OpWUlKRt27Z5LhquqqpSYOBXB5BGjx6tDRs2aP78+Zo3b56GDBmiwsJCJSYmemq2bNniCU2SdOedd0qScnNztWjRItlsNm3fvt0TsOLj43X77bdr/vz5nj5BQUHaunWr7r33XqWmpqpXr16aPHmyHnn
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.hist(beta, bins=\"auto\", density=True, histtype=\"step\")\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "venv_csiborg",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.11.7"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|