mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 22:28:03 +00:00
191 lines
198 KiB
Text
191 lines
198 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Generate a mock peculiar velocity catalogue from CSiBORG haloes."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"from h5py import File\n",
|
||
|
"from scipy.interpolate import interp1d\n",
|
||
|
"from astropy.cosmology import FlatLambdaCDM\n",
|
||
|
"\n",
|
||
|
"import csiborgtools\n",
|
||
|
"\n",
|
||
|
"%matplotlib inline\n",
|
||
|
"%load_ext autoreload\n",
|
||
|
"%autoreload 2\n",
|
||
|
"\n",
|
||
|
"SPEED_OF_LIGHT = 299_792.458 "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def dist2redshift(dist, cosmo):\n",
|
||
|
" x = np.linspace(0., 1., int(1e5))\n",
|
||
|
" y = cosmo.comoving_distance(x).value\n",
|
||
|
" return interp1d(y, x, kind=\"cubic\")(dist)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"nsim = 17417\n",
|
||
|
"nsnap = 99\n",
|
||
|
"kind = \"main\"\n",
|
||
|
"cat = csiborgtools.read.CSiBORG2SUBFINDCatalogue(nsim, nsnap, kind)\n",
|
||
|
"\n",
|
||
|
"cosmo = FlatLambdaCDM(H0=100, Om0=0.3111)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"dist, RA, dec = [cat[\"spherical_pos\"][:, i] for i in range(3)]\n",
|
||
|
"Vx, Vy, Vz = [cat[\"cartesian_vel\"][:, i] for i in range(3)]\n",
|
||
|
"vrad = csiborgtools.flow.project_Vext(Vx, Vy, Vz, np.deg2rad(RA), np.deg2rad(dec))\n",
|
||
|
"zcosmo = dist2redshift(dist, cosmo)\n",
|
||
|
"zobs = (1 + zcosmo) * (1 + vrad / SPEED_OF_LIGHT) - 1\n",
|
||
|
"\n",
|
||
|
"data = {\"r_hMpc\": dist,\n",
|
||
|
" \"RA\": RA,\n",
|
||
|
" \"DEC\": dec,\n",
|
||
|
" \"vrad\": vrad,\n",
|
||
|
" \"zcosmo\": zcosmo,\n",
|
||
|
" \"zobs\": zobs}"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAG1CAYAAAARLUsBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAADdCklEQVR4nOzdd7xcZZ348c8508uduVNu7yU9IY0Q0gClhGKJyApYUGRdu7i4uOK6oouKurIrCi4LP1B0RRFQVMBQoklIQUgjpCe39zu993N+f0xmuDe56femkOf9es0r5Nxnzpwz4ZXzzfN8n+9XUlVVRRAEQRAE4Twin+kLEARBEARBON1EACQIgiAIwnlHBECCIAiCIJx3RAAkCIIgCMJ5RwRAgiAIgiCcd0QAJAiCIAjCeUcEQIIgCIIgnHdEACQIgiAIwnlHBECCIAiCIJx3RAAkCIIgCMJ556wIgB588EEaGxsxGo0sXLiQ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M0+2LsXrvEMlMlmWtTh7b0MvXl7fy4s5hhoJRnt8+QCga4/ndHi5qsFNuM1HtsFDvshR3j51Sn69kMj/rs3hxPviprMz/fqLaZhwHEQAJgiAIwgQ51SWw9W0+ppRb+P3WfipKDMiyRK3DVFyCKsz6dHhjzK21s7M/zFA4yfSqEvyJLLUOM/3hFN3+BHqtht0DEXYPRvniZU3c/9cDbO/x8tTWIXxJla6wQotLz2tdYRY2OUln1eKyGXDyfb42bYL58+EHPwBFgY9+FHbuhPe856S+k/EiAiBBEARBmCANThNbeoI0OE0n9f7FzU7W7Pf
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(zcosmo, zobs, s=0.01)\n",
|
||
|
"\n",
|
||
|
"plt.axline((0, 0), slope=1, color=\"red\", linestyle=\"--\")\n",
|
||
|
"plt.xlabel(r\"$z_{\\rm cosmo}$\")\n",
|
||
|
"plt.ylabel(r\"$z_{\\rm obs}$\")\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlQAAAGxCAYAAACk+SiFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9d5Qk533fC3+qc849Oe7MZgCbkBZYAKREESAlWRRBWpJFUVembcmSKVG0j1/yvn5NX18fU5bMe2UFm6IsK5iSSBEEKYoEAYIgCWxC2ARs3sl5pnOsjlX1/lFTvT2z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ACl9XMoeEEmqYxGi8wGi/QG3Jek9BZ7/zd6CrpTruVgaiH/oj7uuzzXrkubgZCUAkEgpvGeFKmXK1Tril39Q38RriXNrrwLR/DveKm6Qw4SRUrdAacjCdlSpUaw7HCNbvIbof5uxHNjG+H47pbEIJKIBDcNPrCLhw2Cw6r+a6+gd+Ip/6NLnzLx3CvuGk2RT0MtvrYFPXQG3Jydi5Ph8/GTKZ0Tefkdpi/GyHUb4fjulsQgkogENwwli8AN+IJ+3bkRjz1b3Th2+gY7pbstOZ5Gk/K7Ozwkyrp2X53uiVGuOdub4SgEggEN4x7dQG4HZ76NzqGu/VcSWh0BV2YTKabek5uhEAV7rnbGyGoBALBDUMsAHcOd+O56o+4cdgsgJ79dzMtcLd7g2RjHDd7Xu5mhKASCAQ3jJWsJLfLgiJYyloWrTvxnBljnk7rwubwSPKmWeCMpswL+cp1bZB8Pa2Ixr4ODScoVW9tXau7BSGoBALBTeVudS3dzdyJ52w
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"plt.figure()\n",
|
||
|
"plt.scatter(zcosmo, zobs - zcosmo, s=0.01)\n",
|
||
|
"\n",
|
||
|
"plt.axhline(0, color=\"red\", linestyle=\"--\")\n",
|
||
|
"plt.xlabel(r\"$z_{\\rm cosmo}$\")\n",
|
||
|
"plt.ylabel(r\"$z_{\\rm obs} - z_{\\rm cosmo}$\")\n",
|
||
|
"\n",
|
||
|
"plt.show()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"mask = (cat[\"totmass\"] > 5e12) & (cat[\"totmass\"] < 1e13) & cat[\"Central\"] & (cat[\"dist\"] < 135.5)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"choice = np.random.choice(np.arange(len(cat))[mask], size=100)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"fname = f\"/mnt/extraspace/rstiskalek/catalogs/PV_mock_CB2_{nsim}_small.hdf5\"\n",
|
||
|
"with File(fname, \"w\") as f:\n",
|
||
|
" for key, value in data.items():\n",
|
||
|
" f.create_dataset(key, data=value[choice])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"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
|
||
|
}
|