csiborgtools/notebooks/perseus.ipynb

166 lines
25 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "5a38ed25",
"metadata": {
"ExecuteTime": {
"end_time": "2023-04-12T14:25:46.519408Z",
"start_time": "2023-04-12T14:25:03.003304Z"
},
"scrolled": true
},
"outputs": [],
"source": [
"import sys\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scienceplots\n",
"import astroquery\n",
"from tqdm import trange, tqdm\n",
"\n",
"sys.path.append(\"../\")\n",
"import csiborgtools\n",
"\n",
"%matplotlib widget \n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "79919270",
"metadata": {},
"outputs": [],
"source": [
"# # Norma\n",
"cluster = {\"RA\": (16 + 15 / 60 + 32.8 / 60**2) * 15,\n",
" \"DEC\": -60 + 54 / 60 + 30 / 60**2,\n",
" \"DIST\": 67.8}\n",
"\n",
"Xclust = np.array([cluster[\"DIST\"], cluster[\"RA\"], cluster[\"DEC\"]]).reshape(1, -1)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "96740b90",
"metadata": {},
"outputs": [],
"source": [
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n",
"nsims = paths.get_ics(False)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "90033fb1",
"metadata": {},
"outputs": [],
"source": [
"Xclust = np.array([cluster[\"DIST\"], cluster[\"RA\"], cluster[\"DEC\"]]).reshape(1, -1)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "194baa83",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 101/101 [00:44<00:00, 2.25it/s]\n"
]
}
],
"source": [
"matches = np.full(len(nsims), np.nan)\n",
"\n",
"for ii in trange(101):\n",
" cat = csiborgtools.read.CSiBORGHaloCatalogue(nsims[ii], paths, minmass=('M', 1e13))\n",
" dist, ind = cat.angular_neighbours(Xclust, ang_radius=5, rad_tolerance=10)\n",
" dist = dist[0]\n",
" ind = ind[0]\n",
"\n",
" if ind.size > 0:\n",
" matches[ii] = np.max(cat['M'][ind])\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "392f6eee",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6ff7d5b9dc2f4b3fa6f563ee91f59655",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAflklEQVR4nO3df3TV9X348Vf4kcCEBBMlISMBWltjtbAOK6a6ddXMyOH4o6Q/7HGWUk532hOpkLNV6dZST6fB7kxoK2D1ODw7p8zWP7CjntrDsonHs4AYxo6uk1ZrD1hMqG4kiCMw8vn+0a+p0UT5kZub3Pfjcc49x3zuzcfXy+Anz3NzbyjKsiwLAACSMS7fAwAAMLIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYgQgAEBiBCAAQGIEIABAYibke4CxrK+vLw4cOBBTp06NoqKifI8DAJyELMvi8OHDUV1dHePGpflcmAA8AwcOHIiampp8jwEAnIb9+/fHzJkz8z1GXgjAMzB16tSI+O0foNLS0jxPAwCcjJ6enqipqen/Pp4iAXgG3vixb2lpqQAEgDEm5ZdvpfmDbwCAhAlAAIDECEAAgMQIQACAxAhAAIDECEAAgMQIQACAxAhAAIDECEAAgMQIQACAxAhAAIDECEAAgMQIQACAxAhAAIDETMj3AABA7s2+7dF8j3DKfrVmUb5HKFieAQQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEhMwQbgN77xjSgqKhpwq6ur67//6NGj0dzcHBUVFTFlypRoamqKrq6uPE4MADAyCjYAIyIuvPDCePnll/tvTz75ZP99K1eujK1bt8bDDz8c27dvjwMHDsTixYvzOC0AwMiYkO8BcmnChAlRVVX1tuPd3d3xwAMPxObNm+OKK66IiIhNmzbFBRdcEDt27IhLL710pEcFABgxBf0M4C9+8Yuorq6O97znPXHjjTfGvn37IiKio6Mjjh8/Hg0NDf2Prauri9ra2mhvbx/yfL29vdHT0zPgBgAw1hRsAC5YsCAefPDBeOyxx2Ljxo3x4osvxh/90R/F4cOHo7OzM4qLi2PatGkDPqeysjI6OzuHPGdra2uUlZX132pqanK8BQDA8CvYHwEvXLiw/5/nzp0bCxYsiFmzZsUPf/jDmDx58mmdc9WqVdHS0tL/cU9PjwgEAMacgn0G8K2mTZsW73//++P555+PqqqqOHbsWBw6dGjAY7q6ugZ9zeAbSkpKorS0dMANAGCsSSYAX3vttXjhhRdixowZMX/+/Jg4cWK0tbX13793797Yt29f1NfX53FKAIDcK9gfAf/FX/xFXHPNNTFr1qw4cOBArF69OsaPHx+f+cxnoqysLJYtWxYtLS1RXl4epaWlsXz58qivr/cOYACg4BVsAL700kvxmc98Jl599dU499xz4/LLL48dO3bEueeeGxERa9eujXHjxkVTU1P09vZGY2NjbNiwIc9TAwDkXlGWZVm+hxirenp6oqysLLq7u70eEIB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QACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACSmYANw48aNMXfu3CgtLY3S0tKor6+Pn/zkJ/33Hz16NJqbm6OioiKmTJkSTU1N0dXVlceJAQBGRsEG4MyZM2PNmjXR0dERTz/9dFxxxRVx3XXXxX/+539GRMTKlStj69at8fDDD8f27dvjwIEDsXjx4jxPDQCQe0VZlmX5HmKklJeXx9/+7d/GJz7xiTj33HNj8+bN8YlPfCIiIp577rm44IILor29PS699NKTOl9PT0+UlZVFd3d3lJaW5nJ0ADgjs297NN8jnLJfrVmUk/P6/l3AzwC+2YkTJ+Khhx6KI0eORH19fXR0dMTx48ejoaGh/zF1dXVRW1sb7e3tQ56nt7c3enp6BtwAAMaagg7AZ555JqZMmRIlJSXxxS9+MbZs2RIf+MAHorOzM4qLi2PatGkDHl9ZWRmdnZ1Dnq+1tTXKysr6bzU1NTneAABg+BV0AJ5//vmxZ8+e2LlzZ3zpS1+KJUuWxM9+9rPTPt+qVauiu7u7/7Z///5hnBYAYGRMyPcAuVRcXBznnXdeRETMnz8/du3aFd/+9rfj05/+dBw7diwOHTo04FnArq6uqKqqGvJ8JSUlUVJSkuuxAQByqqCfAXyrvr6+6O3tjfnz58fEiROjra2
"text/html": [
"\n",
" <div style=\"display: inline-block;\">\n",
" <div class=\"jupyter-widgets widget-label\" style=\"text-align: center;\">\n",
" Figure\n",
" </div>\n",
" <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoA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IwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEhMwQbgN77xjSgqKhpwq6ur67//6NGj0dzcHBUVFTFlypRoamqKrq6uPE4MADAyCjYAIyIuvPDCePnll/tvTz75ZP99K1eujK1bt8bDDz8c27dvjwMHDsTixYvzOC0AwMiYkO8BcmnChAlRVVX1tuPd3d3xwAMPxObNm+OKK66IiIhNmzbFBRdcEDt27IhLL710pEcFABgxBf0M4C9+8Yuorq6O97znPXHjjTfGvn37IiKio6Mjjh8/Hg0NDf2Prauri9ra2mhvbx/yfL29vdHT0zPgBgAw1hRsAC5YsCAefPDBeOyxx2Ljxo3x4osvxh/90R/F4cOHo7OzM4qLi2PatGkDPqeysjI6OzuHPGdra2uUlZX132pqanK8BQDA8CvYHwEvXLiw/5/nzp0bCxYsiFmzZsUPf/jDmDx58mmdc9WqVdHS0tL/cU9PjwgEAMacgn0G8K2mTZsW73//++P555+PqqqqOHbsWBw6dGjAY7q6ugZ9zeAbSkpKorS0dMANAGCsSSYAX3vttXjhhRdixowZMX/+/Jg4cWK0tbX13793797Yt29f1NfX53FKAIDcK9gfAf/FX/xFXHPNNTFr1qw4cOBArF69OsaPHx+f+cxnoqysLJYtWxYtLS1RXl4epaWlsXz58qivr/cOYACg4BVsAL700kvxmc98Jl599dU499xz4/LLL48dO3bEueeeGxERa9eujXHjxkVTU1P09vZGY2NjbNiwIc9TAwDkXlGWZVm+hxirenp6oqysLLq7u70eEIBRbfZtj+Z7hFP2qzWLcnJe378Teg0gAAC/JQABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIwABABIjAAEAEiMAAQASIw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RGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACRGAAIAJEYAAgAkRgACACSmYANw48aNMXfu3CgtLY3S0tKor6+Pn/zkJ/33Hz16NJqbm6OioiKmTJkSTU1N0dXVlceJAQBGRsEG4MyZM2PNmjXR0dERTz/9dFxxxRVx3XXXxX/+539GRMTKlStj69at8fDDD8f27dvjwIEDsXjx4jxPDQCQe0VZlmX5HmKklJeXx9/+7d/GJz7xiTj33HNj8+bN8YlPfCIiIp577rm44IILor29PS699NKTOl9PT0+UlZVFd3d3lJaW5nJ0ADgjs297NN8jnLJfrVmUk/P6/l3AzwC+2YkTJ+Khhx6KI0eORH19fXR0dMTx48ejoaGh/zF1dXVRW1sb7e3tQ56nt7c3enp6BtwAAMaagg7AZ555JqZMmRIlJSXxxS9+MbZs2RIf+MAHorOzM4qLi2PatGkDHl9ZWRmdnZ1Dnq+1tTXKysr6bzU1NTneAABg+BV0AJ5//vmxZ8+e2LlzZ3zpS1+KJUuWxM9+9rPTPt+qVauiu7u7/7Z///5hnBYAYGRMyPcAuVRcXBznnXdeRETMnz8/du3aFd/+9rfj05/+dBw7diwOHTo04FnArq6uqKqqGvJ8JSUlUVJSkuu
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = np.log10(matches[~np.isnan(matches)])\n",
"\n",
"\n",
"plt.figure()\n",
"plt.hist(x, bins=10)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9cc660b0",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv_galomatch",
"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.8.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}