mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 23:08:02 +00:00
369 lines
151 KiB
Text
369 lines
151 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Matching of haloes to clusters"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from matplotlib import cm\n",
|
||
|
"from matplotlib.colors import Normalize\n",
|
||
|
"from scipy import stats\n",
|
||
|
"\n",
|
||
|
"from match_clusters import *\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2\n",
|
||
|
"%matplotlib inline"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Plot $R - \\log M$ as a function of significance"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 79,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"cat = csiborgtools.read.CSiBORG2Catalogue(\n",
|
||
|
" 17417, 99, \"main\", bounds={\"totmass\": (1e12, None)})\n",
|
||
|
"pos = cat[\"cartesian_pos\"]\n",
|
||
|
"logmass = np.log10(cat[\"totmass\"])\n",
|
||
|
"\n",
|
||
|
"model = csiborgtools.match.MatchingProbability(pos, logmass)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 78,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAm8AAAHWCAYAAAAhG26oAAAAOXRFWHRTb2Z0d2FyZQ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N4IgiAIoovDOlYgUb4bU/4nj9uH0evtP8xCBfWlN+dVW4VEERLzTzMhmvEduh9UbUoQBEEQXZ22l7XdoHw39bg9vKnOK42FTDsY8jdHNLeNizk3tgbRnFeKut2BHTt24LzzzkNlZSV69OiBSy65BE18XnkAEydOhOM42uvyyy/fRU+cHF1KvN1+++2+D2zMmDHieFtbG6ZNm4ZevXqhvLwcU6dORW1tbQ6fmCAIgiB2AUpz3nj5boka8dqKGYqXt2P84Rtw4Dc3+o4J4RbbNqcuuFl4sU4sWDjvvPOwYsUKzJ8/Hy+++CLefPNNXHbZZQmvu/TSS7Fp0ybxuuuuuzrtGdOhS4k3ANhvv/20D+ztt98Wx6655hrMmzcPzzzzDBYuXIiNGzdiypQpOXzarsOMGTNw6KGHoqKiAn379sWZZ56JlStX5vqxCIIgiAxhrA2IrjdXlePxm/QmEnTFa6NgeUB7vzzhtjE1pGo05+U5b12dTz/9FK+88gr+9Kc/4bDDDsNRRx2FBx98EE899RQ2btwY99rS0lL0799fvCorK3fRUydHlxNv+fn52gfWu3dvAEB9fT0effRR3HPPPfjGN76B8ePH47HHHsN///tfLF68OMdPnXsWLlyIadOmYfHixZg/fz46Ojpw4oknorm5OdePRhAEQWQAC38ACHGWuL+bPB6c78ZDpICDbWeW492Ph2DVHb1ga86rFSsob8oLFrLx6gz
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 2 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"xrange = np.linspace(13, 15.2, 250)\n",
|
||
|
"log_p_values = np.linspace(-3, -0.25, 1000)\n",
|
||
|
"cmap = cm.viridis\n",
|
||
|
"norm = Normalize(vmin=log_p_values.min(), vmax=log_p_values.max())\n",
|
||
|
"sm = cm.ScalarMappable(cmap=cmap, norm=norm)\n",
|
||
|
"sm.set_array([]) # Necessary for the colorbar to use the ScalarMappable\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.figure(), plt.gca()\n",
|
||
|
"for p in log_p_values:\n",
|
||
|
" y = [model.inverse_cdf(10**p, x) for x in xrange]\n",
|
||
|
" ax.plot(xrange, y, color=cmap(norm(p)))\n",
|
||
|
"\n",
|
||
|
"ls = [\":\", \"--\", \"-.\"]\n",
|
||
|
"for n in range(1, 4):\n",
|
||
|
" p = stats.norm.sf(n) * 2\n",
|
||
|
" y = [model.inverse_cdf(p, x) for x in xrange]\n",
|
||
|
" ax.plot(xrange, y, color=\"red\", label=fr\"${n}\\sigma$\", linestyle=ls[n-1])\n",
|
||
|
"\n",
|
||
|
"ax.set_xlabel(r\"$\\log M_{\\mathrm{FoF}} ~ [M_\\odot / h]$\")\n",
|
||
|
"ax.set_ylabel(r\"$R ~ [\\mathrm{Mpc} / h]$\")\n",
|
||
|
"ax.set_ylim(1, 55)\n",
|
||
|
"ax.legend()\n",
|
||
|
"cbar = fig.colorbar(sm, ax=ax, label=r\"$\\log p$\", pad=0)\n",
|
||
|
"ax.set_xlim(xrange.min(), xrange.max())\n",
|
||
|
"fig.tight_layout()\n",
|
||
|
"fig.savefig(\"../../plots/matching_probability.png\", dpi=450)\n",
|
||
|
"fig.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Test matching"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 95,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Opening catalogues: 0%| | 0/20 [00:00<?, ?it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Opening catalogues: 100%|██████████| 20/20 [00:08<00:00, 2.38it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"simname = \"csiborg2_varysmall\"\n",
|
||
|
"bounds = {\"totmass\": (1e12, None)}\n",
|
||
|
"\n",
|
||
|
"cats = open_cats(simname, bounds)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 96,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"100%|██████████| 20/20 [00:04<00:00, 4.90it/s]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"model = csiborgtools.match.MatchCatalogues(cats)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 109,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"14.94250410616808\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"cluster = csiborgtools.clusters[\"Coma\"]\n",
|
||
|
"x0 = cluster.cartesian_pos(cats[0].boxsize)\n",
|
||
|
"logmass0 = np.log10(cluster.mass)\n",
|
||
|
"print(logmass0)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 110,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Matching catalogues: 100%|██████████| 20/20 [00:00<00:00, 556.37it/s]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"{0: 3, 1: 3, 2: 2, 3: 3, 4: 3, 5: 3, 6: 2, 7: 2, 8: 3, 9: 3, 10: 2, 11: 2, 12: 3, 13: 3, 14: 3, 15: 3, 16: 3, 17: 3, 18: 2, 19: 3}\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"ps, indxs = model(x0, logmass0, pvalue_threshold=0.05, rmax=30)\n",
|
||
|
"print(indxs)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 111,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"dx = np.asarray([np.linalg.norm(cats[i][\"cartesian_pos\"][indx] - x0) for i, indx in indxs.items()])\n",
|
||
|
"logM = np.asarray([np.log10(cats[i][\"totmass\"][indx]) for i, indx in indxs.items()])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 112,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{0: 1.7277742548227337e-05,\n",
|
||
|
" 1: 2.3773062338916517e-05,\n",
|
||
|
" 2: 1.649682964910415e-05,\n",
|
||
|
" 3: 2.2792332201482246e-05,\n",
|
||
|
" 4: 2.0781930465618714e-05,\n",
|
||
|
" 5: 1.998976678019293e-05,\n",
|
||
|
" 6: 1.9442165546501577e-05,\n",
|
||
|
" 7: 1.544348716120414e-05,\n",
|
||
|
" 8: 2.1642747228156622e-05,\n",
|
||
|
" 9: 1.8945898574984632e-05,\n",
|
||
|
" 10: 2.0662255376224792e-05,\n",
|
||
|
" 11: 1.7147290344965427e-05,\n",
|
||
|
" 12: 1.9652646111256722e-05,\n",
|
||
|
" 13: 2.681115460911876e-05,\n",
|
||
|
" 14: 2.087873974021548e-05,\n",
|
||
|
" 15: 2.025383691772742e-05,\n",
|
||
|
" 16: 2.3353221836774907e-05,\n",
|
||
|
" 17: 2.0315974653239977e-05,\n",
|
||
|
" 18: 1.8199303817634238e-05,\n",
|
||
|
" 19: 2.0844772995021188e-05}"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 112,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"ps"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 114,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAGdCAYAAAAxCSikAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtx0lEQVR4nO3df3DU5YHH8c8mQhadZDFqspsSIFoFYzAFx2CgnicFk2hTcr1pkRHFE6nH4FUO9Tw6pzHVuRx6OGMrE+spRhstLd4RJpZLB1HhlGiKgTlDbqgwERA2cIJsEmgik33uDyZ7rMmSbMjuPrv7fs3sjN/vPt8vz8Pjuh+/z491GGOMAAAALJYS6woAAAAMhcACAACsR2ABAADWI7AAAADrEVgAAID1CCwAAMB6BBYAAGA9AgsAALDeRbGuwGjx+/06cuSI0tPT5XA4Yl0dAAAwDMYYdXV1KScnRykpoZ+jJExgOXLkiHJzc2NdDQAAMAKHDh3ShAkTQr6fMIElPT1d0tkGZ2RkxLg2AABgODo7O5Wbmxv4Hg8lYQJL/zBQRkYGgQUAgDgz1HQOJt0CAADrhRVYqqurdeONNyo9PV1ZWVmqqKjQ3r17h7xuw4YNmjp1qpxOp6ZNm6bNmzcHvW+M0RNPPCGPx6Nx48Zp7ty5+uyzz8JrCQAASFhhBZZt27Zp+fLl+uijj7RlyxadOXNGt912m06dOhXymh07dmjhwoVasmSJdu3apYqKClVUVKi1tTVQ5plnntEvfvELvfjii/r44491ySWXqKSkRD09PSNvGQAASBgOY4wZ6cX/+7//q6ysLG3btk1/8Rd/MWiZBQsW6NS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Zs6cqa+++krPPfecWltb9dprrwXu8fOf/1w33XSTvv3tb+vkyZN69tlndeDAAd1///2j0EQAABDvwg4sO3fu1K233ho4XrlypSRp8eLFqq2tldfr1cGDBwPv9/X1ac2aNdq7d6/GjBmjW2+9VTt27NDkyZMDZb766istXbpUHR0duvTSS3XDDTdox44dys/Pv4Cm2a/Pb9TcfkLHunqUle5UUV6mUlPYfwYAgG+6oEm3NhnupB1bNLZ6VdXQJq+vJ3DO43KqsjxfpQUMhQEAkoM1k24xUGOrV8vqWoLCiiR1+Hq0rK5Fja3eGNUMAAA7EViirM9vVNXQpsEea/Wfq2poU58/IR58AQAwKggsUdbcfmLAk5VzGUleX4+a209Er1IAAFiOwBJlx7pCh5WRlAMAIBkQWKIsK905dKEwygEAkAwILFFWlJcpj8upUIuXHTq7WqgoLzOa1QIAwGoElihLTXGosvzs/jLfDC39x5Xl+ezHAgBR1Oc3atp/XJt2H1bT/uMsfLBQ2BvH4cKVFnhUs2jGgH1Y3OzDAgBRx75Y8YGN42KInW4BILb698X65hdh/3+JaxbNILRE2HC/v3nCEkOpKQ4VX3VZrKsBAElpqH2xHDq7L9a8fDf/M2kB5rAAAJIS+2LFFwILACApsS9WfCGwAACSEvtixRcCCwAgKbEvVnwhsAAAkhL7YsUXAgsAIGn174vldgUP+7hdTpY0W4ZlzQCApFZa4NG8fDf7YlmOwAIASHrsi2U/hoQAAID1CCwAAMB6BBYAAGA9AgsAALAegQUAAFiPVUIAgvT5Dcs7AViHwAIgoLHVq6qGtqBfsPW4nKosz2cDLQAxxZAQAElnw8qyupagsCJJHb4eLatrUWOrN0Y1AwACCwCdHQaqamiTGeS9/nNVDW3q8w9WAgAij8ACQM3tJwY8WTmXkeT19ai5/UT0KgUA5yCwANCxrtBhZSTlAGC0EVgAKCvdOXShMMoBwGgjsABQUV6mPC6nQi1edujsaqG
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(np.arange(len(dx)), dx)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 98,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"ps, dlog, indxs = model.cdf_per_halo(x0, logmass0)\n",
|
||
|
"r = np.linalg.norm(pos - x0.reshape(1, -1), axis=1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 99,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"None None [[15.430657 15.189978 15.118925 ... 12.098506 12.76248 12.336433]]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"p, k = model.match_halo(x0, logmass0, pvalue_threshold=0.1, max_absdlogmass=1)\n",
|
||
|
"print(p, k, logmass[k])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 111,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiMAAAGdCAYAAADAAnMpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAABlQElEQVR4n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mWLVu49dZbKSgoYMKECQCMHz+eSZMmVT7+3//+N1999RW7du1i9erVXHfddezdu5ebbrqp5j4LkRrmdrt5/rudgDUqEu0noyIVGkXWY2zF6MgCdWUVkdoVUN0njB07lszMTB544AHS0tJITk5m7ty5lYta9+3bh91+vMY5cuQIN998M2lpaURHR9OzZ0+WLFlCx47ed+y6+I8fd2ezdv9RggLsTDjXuw/DO1O3XtiKD1bsY9mubFbuyaZXUozpSCLio2xuL5gQzs3NJTIykpycHK0fkTpxw+vL+W5bJtf2bcYjY7qYjmPMfZ+u54MV+xnUMZ6Xx/cyHUdEvMzpvn/rbBqRn9lyKJfvtmVit8EfzvevtSI/d/P5LbHZrPUzOzLyTccRER+lYkTkZ15caK0VGdqlEc0bhBlOY1arhvVJ6WBNwb7y/S7DaUTEV6kYETnB/uxCvlh/CIBbL/CPviK/5ZYLrNGhz1YfJCO3yHAaEfFFKkZETvDaD7txutyc1zrW507mPVM9m8fQq3k0JU4Xry/ZYzqOiPggFSMi5fKKSvl4pXVMgb+vFfm5iq/HO8v2kl9cZjiNiPgaFSMi5T5ZdYD84jJax9VnQJt
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.plot(xrange, y)\n",
|
||
|
"plt.plot(xrange, y2)\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 71,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"x, y = model.pdf_marginalized(xrange, 14.0, 42.5, 4)"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"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
|
||
|
}
|