2022-11-06 20:53:58 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 1,
|
|
|
|
"id": "5a38ed25",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
2022-11-20 14:11:35 +00:00
|
|
|
"end_time": "2022-11-20T12:48:39.822802Z",
|
|
|
|
"start_time": "2022-11-20T12:48:03.992510Z"
|
2022-11-06 20:53:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"%matplotlib notebook\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"try:\n",
|
|
|
|
" import csiborgtools\n",
|
|
|
|
"except ModuleNotFoundError:\n",
|
|
|
|
" import sys\n",
|
|
|
|
" sys.path.append(\"../\")\n",
|
|
|
|
" import csiborgtools\n",
|
|
|
|
"import utils\n",
|
|
|
|
"%load_ext autoreload\n",
|
|
|
|
"%autoreload 2\n",
|
|
|
|
"\n",
|
|
|
|
"import joblib\n",
|
|
|
|
"from os.path import join"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-11-20 14:11:35 +00:00
|
|
|
"execution_count": 2,
|
|
|
|
"id": "f39874e4",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:48:39.888076Z",
|
|
|
|
"start_time": "2022-11-20T12:48:39.824849Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from astropy.cosmology import FlatLambdaCDM, z_at_value\n",
|
|
|
|
"from astropy import units"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 6,
|
|
|
|
"id": "d243cc59",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:48:50.480986Z",
|
|
|
|
"start_time": "2022-11-20T12:48:46.442880Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"Nsim = 9844\n",
|
|
|
|
"Nsnap = 1016\n",
|
|
|
|
"# data, box = utils.load_processed(Nsim, Nsnap)\n",
|
|
|
|
"data, box = utils.load_processed(Nsim, Nsnap)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 10,
|
|
|
|
"id": "344e6b96",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:49:41.830512Z",
|
|
|
|
"start_time": "2022-11-20T12:49:41.793552Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"X = np.vstack([data[\"peak_{}\".format(p)] for p in (\"x\", \"y\", \"z\")]).T"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 12,
|
|
|
|
"id": "d8bb7dce",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:51:00.688105Z",
|
|
|
|
"start_time": "2022-11-20T12:51:00.262736Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from sklearn.neighbors import NearestNeighbors"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 13,
|
|
|
|
"id": "71026a85",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:51:22.817846Z",
|
|
|
|
"start_time": "2022-11-20T12:51:22.762451Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"neighbors = NearestNeighbors()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 14,
|
|
|
|
"id": "3ca4a7b7",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:51:52.857117Z",
|
|
|
|
"start_time": "2022-11-20T12:51:52.659741Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/html": [
|
|
|
|
"<style>#sk-container-id-1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\
|
|
|
|
],
|
|
|
|
"text/plain": [
|
|
|
|
"NearestNeighbors()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 14,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"neighbors.fit(X)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 19,
|
|
|
|
"id": "6e5ec9c8",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:52:50.459988Z",
|
|
|
|
"start_time": "2022-11-20T12:52:50.429353Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"(array([[0. , 0.00441153, 0.00459373, 0.00568435, 0.00596298]]),\n",
|
|
|
|
" array([[ 0, 186, 513, 130, 1795]]))"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 19,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"p = X[0, :]\n",
|
|
|
|
"\n",
|
|
|
|
"neighbors.kneighbors(p.reshape(-1,3))"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 16,
|
|
|
|
"id": "304d53aa",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:52:31.826535Z",
|
|
|
|
"start_time": "2022-11-20T12:52:31.796380Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"array([-0.04183578, -0.21976852, -0.05943659])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 16,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 8,
|
|
|
|
"id": "a65dac24",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-20T12:49:09.617079Z",
|
|
|
|
"start_time": "2022-11-20T12:49:09.416602Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/plain": [
|
|
|
|
"array([-0.21976852, -0.15894653, -0.16384361, ..., -0.23763191,\n",
|
|
|
|
" -0.23351993, -0.23352051])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"execution_count": 8,
|
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"data[\"peak_y\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "45b638ac",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "26c64abc",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "07bc45e2",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T15:18:08.182242Z",
|
|
|
|
"start_time": "2022-11-18T15:18:08.106196Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"zcosmo = box.box2cosmoredshift(data[\"dist\"])\n",
|
|
|
|
"z"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "adf5dbb6",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T15:20:26.613020Z",
|
|
|
|
"start_time": "2022-11-18T15:20:25.738527Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"zpec = box.box2pecredshift(*[data[p] for p in [\"vx\", \"vy\", \"vz\", \"peak_x\", \"peak_y\", \"peak_z\"]])\n",
|
|
|
|
"zobs = box.box2obsredshift(*[data[p] for p in [\"vx\", \"vy\", \"vz\", \"peak_x\", \"peak_y\", \"peak_z\"]])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "841bd579",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T15:26:30.294302Z",
|
|
|
|
"start_time": "2022-11-18T15:26:29.051227Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"m = zcosmo < 0.05\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"# plt.scatter(zcosmo[m], zcosmo[m] - zobs[m], s=0.05)\n",
|
|
|
|
"plt.scatter(zcosmo[m], zpec[m], s=0.05, rasterized=True)\n",
|
|
|
|
"t = np.linspace(0, zcosmo[m].max())\n",
|
|
|
|
"\n",
|
|
|
|
"plt.axhline(0, c=\"red\", ls=\"--\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.xlabel(r\"$z_{\\rm cosmo}$\")\n",
|
|
|
|
"plt.ylabel(r\"$z_{\\rm pec}$\")\n",
|
|
|
|
"plt.tight_layout()\n",
|
|
|
|
"plt.savefig(\"../plots/redshift.png\", dpi=450)\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "b4f27150",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "842b2a29",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "1540f703",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "990e9b54",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "72c00ec7",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T13:52:31.564378Z",
|
|
|
|
"start_time": "2022-11-18T13:52:31.208987Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"data[\"\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "41d9b43b",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "da80d88a",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "a0cfe3e9",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "cced3507",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T10:38:41.921571Z",
|
|
|
|
"start_time": "2022-11-18T10:38:41.546722Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Ob0=0.05)\n",
|
|
|
|
"\n",
|
|
|
|
"cosmo.comoving_distance()\n",
|
|
|
|
"\n",
|
|
|
|
"x = 10000 * units.Mpc\n",
|
|
|
|
"\n",
|
|
|
|
"z_at_value(cosmo.comoving_distance, x)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "efe4bae7",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T10:54:22.472019Z",
|
|
|
|
"start_time": "2022-11-18T10:54:21.945010Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"from astropy import constants"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "3b3868ec",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-18T10:54:45.746052Z",
|
|
|
|
"start_time": "2022-11-18T10:54:45.700198Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"constants.c.value * 1e-8"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "b4a75a77",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:10:20.623153Z",
|
|
|
|
"start_time": "2022-11-14T16:10:20.196639Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"n_sims = csiborgtools.io.get_csiborg_ids(\"/mnt/extraspace/hdesmond\")"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "90c6750f",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:12:35.876806Z",
|
|
|
|
"start_time": "2022-11-14T16:12:35.846171Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"np.where(n_sims == 7660)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "2dc01da8",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:15:52.261474Z",
|
|
|
|
"start_time": "2022-11-14T16:15:50.624885Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"for n_sim in n_sims:\n",
|
|
|
|
" simpath = csiborgtools.io.get_sim_path(n_sim)\n",
|
|
|
|
" maxsnap = csiborgtools.io.get_maximum_snapshot(simpath)\n",
|
|
|
|
" box = csiborgtools.units.BoxUnits(maxsnap, simpath)\n",
|
|
|
|
" print(maxsnap, box._aexp)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "192853c4",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "0c145fbc",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "f21964e5",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "84ea4faf",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:00:41.737065Z",
|
|
|
|
"start_time": "2022-11-14T16:00:40.928532Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"simpath = csiborgtools.io.get_sim_path(7660)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "13268041",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:00:41.805562Z",
|
|
|
|
"start_time": "2022-11-14T16:00:41.739425Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"simpath"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "c2d53934",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:01:06.640894Z",
|
|
|
|
"start_time": "2022-11-14T16:01:06.230907Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"box = csiborgtools.units.BoxUnits(999, simpath)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "345a01d3",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-14T16:01:51.638849Z",
|
|
|
|
"start_time": "2022-11-14T16:01:51.185358Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"box._aexp\n"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "61ec5596",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "14d2b61d",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "a7e78419",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-10T06:40:31.103185Z",
|
|
|
|
"start_time": "2022-11-10T06:40:30.996113Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"planck = utils.load_planck2015(200)\n",
|
|
|
|
"mcxc = utils.load_mcxc(200)\n",
|
|
|
|
"\n",
|
|
|
|
"indxs = csiborgtools.io.match_planck_to_mcxc(planck, mcxc)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "185c6c03",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-10T07:36:22.652521Z",
|
|
|
|
"start_time": "2022-11-10T07:36:14.980728Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"groups = utils.load_2mpp_groups()\n",
|
|
|
|
"\n",
|
|
|
|
"Nsim = 9844\n",
|
|
|
|
"Nsnap = 1016\n",
|
|
|
|
"\n",
|
|
|
|
"data = utils.load_processed(Nsim, Nsnap)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "272befd5",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "b15427bb",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-10T07:38:28.598904Z",
|
|
|
|
"start_time": "2022-11-10T07:38:28.427656Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"m = data[\"m500\"] > 1e13\n",
|
|
|
|
"plt.scatter(data[\"ra\"][m], data[\"dec\"][m], label=\"CSiBORG\", s=3)\n",
|
|
|
|
"plt.scatter(groups[\"RA\"], groups[\"DEC\"], label=\"2M++ galaxy groups\", s=3, marker=\"x\")\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "2489d85e",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "2442bec3",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T21:43:04.928922Z",
|
|
|
|
"start_time": "2022-11-09T21:43:04.521323Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "7af8a421",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T21:46:29.948541Z",
|
|
|
|
"start_time": "2022-11-09T21:46:28.979688Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"RAcoma = (12 + 59/60 + 48.7 / 60**2) * 15\n",
|
|
|
|
"DECcoma = 27 + 58 / 60 + 50 / 60**2\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"RAvirgo = (12 + 27 / 60) * 15\n",
|
|
|
|
"DECvirgo = 12 + 43/60\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.scatter(mcxc[\"RAdeg\"], mcxc[\"DEdeg\"], label=\"MCXC\")\n",
|
|
|
|
"plt.scatter(planck[\"RA\"], planck[\"DEC\"], label=\"Plank\",s=8, c=\"red\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.scatter(RAcoma, DECcoma, label=\"Coma\", s=30, marker=\"x\")\n",
|
|
|
|
"plt.scatter(RAvirgo, DECvirgo, label=\"Virgo\", s=30, marker=\"x\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.legend(framealpha=0.5)\n",
|
|
|
|
"plt.xlabel(\"RA\")\n",
|
|
|
|
"plt.ylabel(\"DEC\")\n",
|
|
|
|
"plt.title(\"Clusters below 200 Mpc\")\n",
|
|
|
|
"plt.savefig(\"../plots/clusters_radec.png\", dpi=450)\n",
|
|
|
|
"\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "01f5c4b3",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "1b0a0f9e",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "d6ef387a",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T21:40:24.392358Z",
|
|
|
|
"start_time": "2022-11-09T21:40:23.480949Z"
|
|
|
|
},
|
|
|
|
"scrolled": false
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.scatter(mcxc[\"COMDIST\"], mcxc[\"M500\"], label=\"MCXC\")\n",
|
|
|
|
"# yerr = np.vstack([planck[\"MSZ\"] - planck[\"MSZ_ERR_LOW\"],\n",
|
|
|
|
"# planck[\"MSZ_ERR_UP\"] - planck[\"MSZ\"]])\n",
|
|
|
|
"yerr = np.vstack([planck[\"MSZ_ERR_LOW\"], planck[\"MSZ_ERR_UP\"]])\n",
|
|
|
|
"plt.errorbar(planck[\"COMDIST\"], planck[\"MSZ\"], yerr, label=\"Plank\", fmt=\" \", capsize=3, color=\"red\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.yscale(\"log\")\n",
|
|
|
|
"plt.legend()\n",
|
|
|
|
"plt.title(\"Clusters below 200 Mpc\")\n",
|
|
|
|
"plt.xlabel(r\"$D_{\\rm c} / \\mathrm{Mpc}$\")\n",
|
|
|
|
"plt.ylabel(r\"$M_{\\rm 500c} / M_\\odot$\")\n",
|
|
|
|
"# plt.savefig(\"../plots/clusters_mass_dist.png\", dpi=450)\n",
|
|
|
|
"\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "d7e113a8",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:59:03.390824Z",
|
|
|
|
"start_time": "2022-11-09T15:59:02.962263Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"d[\"RAdeg\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "e7ae386e",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "9fa1dc0e",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "22cb8bfd",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:56:10.087582Z",
|
|
|
|
"start_time": "2022-11-09T15:56:10.062895Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"d.dtype.names"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "84639e39",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:56:47.929058Z",
|
|
|
|
"start_time": "2022-11-09T15:56:47.737531Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"d[\"Cat\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "d4a98c60",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:55:12.287185Z",
|
|
|
|
"start_time": "2022-11-09T15:55:12.124019Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"type(d[\"MCXC\"])"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "b32906be",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:55:49.218385Z",
|
|
|
|
"start_time": "2022-11-09T15:55:49.099991Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"np.asanyarray([\"aasdasdaasdasdasdad\", \"bsdfadadfasddsgasdg\"]).dtype"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "be1920a5",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "2c173e6a",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:54:17.529059Z",
|
|
|
|
"start_time": "2022-11-09T15:54:17.220209Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"d[\"MCXC\"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "40c7ab70",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "5284fc28",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-09T15:47:57.986432Z",
|
|
|
|
"start_time": "2022-11-09T15:47:57.575714Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"plt.figure()\n",
|
|
|
|
"# plt.scatter(d[\"RAdeg\"], d[\"DEdeg\"], s=1)\n",
|
|
|
|
"plt.scatter(d[\"z\"], d[\"M500\"], s=1)\n",
|
|
|
|
"\n",
|
|
|
|
"plt.yscale(\"log\")\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "7cfb2a1d",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "b01c6134",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
2022-11-06 20:53:58 +00:00
|
|
|
"id": "267eb013",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-06T10:20:27.266576Z",
|
|
|
|
"start_time": "2022-11-06T10:20:24.523404Z"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"Nsim = 9844\n",
|
|
|
|
"Nsnap = 1016\n",
|
|
|
|
"\n",
|
|
|
|
"data = utils.load_processed(Nsim, Nsnap)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-11-20 14:11:35 +00:00
|
|
|
"execution_count": null,
|
2022-11-06 20:53:58 +00:00
|
|
|
"id": "f8c6d928",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-06T10:24:20.697506Z",
|
|
|
|
"start_time": "2022-11-06T10:24:19.631208Z"
|
|
|
|
}
|
|
|
|
},
|
2022-11-20 14:11:35 +00:00
|
|
|
"outputs": [],
|
2022-11-06 20:53:58 +00:00
|
|
|
"source": [
|
|
|
|
"bins = np.arange(11.8, 15.4, 0.2)\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure()\n",
|
|
|
|
"x, mu, std = csiborgtools.match.number_density(data, \"m200\", bins, 200, True)\n",
|
|
|
|
"plt.errorbar(x, mu, std, capsize=4, label=r\"$M_{200c}$\")\n",
|
|
|
|
"\n",
|
|
|
|
"x, mu, std = csiborgtools.match.number_density(data, \"m500\", bins, 200, True)\n",
|
|
|
|
"plt.errorbar(x, mu, std, capsize=4, label=r\"$M_{500c}$\")\n",
|
|
|
|
"\n",
|
|
|
|
"x, mu, std = csiborgtools.match.number_density(data, \"totpartmass\", bins, 200, True)\n",
|
|
|
|
"plt.errorbar(x, mu, std, capsize=4, label=r\"$M_{\\rm tot}$\")\n",
|
|
|
|
"\n",
|
|
|
|
"x, mu, std = csiborgtools.match.number_density(data, \"mass_mmain\", bins, 200, True)\n",
|
|
|
|
"plt.errorbar(x, mu, std, capsize=4, label=r\"$M_{\\rm mmain}$\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.legend()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.yscale(\"log\")\n",
|
|
|
|
"plt.xscale(\"log\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.ylabel(r\"$\\phi / (\\mathrm{Mpc}^{-3})~\\mathrm{dex}$\")\n",
|
|
|
|
"plt.xlabel(r\"$M_{\\rm x}$\")\n",
|
|
|
|
"plt.tight_layout()\n",
|
|
|
|
"plt.savefig(\"../plots/HMF.png\", dpi=450)\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-11-20 14:11:35 +00:00
|
|
|
"execution_count": null,
|
2022-11-06 20:53:58 +00:00
|
|
|
"id": "985d46c9",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-06T10:20:46.078113Z",
|
|
|
|
"start_time": "2022-11-06T10:20:44.524929Z"
|
|
|
|
}
|
|
|
|
},
|
2022-11-20 14:11:35 +00:00
|
|
|
"outputs": [],
|
2022-11-06 20:53:58 +00:00
|
|
|
"source": [
|
|
|
|
"nfw = csiborgtools.fits.NFWProfile()\n",
|
|
|
|
"m200_nfw = nfw.enclosed_mass(data[\"r200\"], data[\"Rs\"], data[\"rho0\"])\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"plt.figure()\n",
|
|
|
|
"\n",
|
|
|
|
"plt.scatter(data[\"m200\"], m200_nfw, s=1)\n",
|
|
|
|
"t = np.linspace(1e11, 1e15)\n",
|
|
|
|
"plt.plot(t, t, c=\"red\", ls=\"--\", lw=1.5)\n",
|
|
|
|
"plt.xscale(\"log\")\n",
|
|
|
|
"plt.yscale(\"log\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.xlabel(r\"$M_{200c}$\")\n",
|
|
|
|
"plt.ylabel(r\"$M_{\\mathrm{NFW}, 200c}$\")\n",
|
|
|
|
"plt.tight_layout()\n",
|
|
|
|
"plt.savefig(\"../plots/enclosed_vs_nfw.png\", dpi=450)\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "8923ca86",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-11-20 14:11:35 +00:00
|
|
|
"execution_count": null,
|
2022-11-06 20:53:58 +00:00
|
|
|
"id": "6eb8ba93",
|
|
|
|
"metadata": {
|
|
|
|
"ExecuteTime": {
|
|
|
|
"end_time": "2022-11-06T10:22:19.498275Z",
|
|
|
|
"start_time": "2022-11-06T10:22:17.953025Z"
|
|
|
|
},
|
|
|
|
"scrolled": false
|
|
|
|
},
|
2022-11-20 14:11:35 +00:00
|
|
|
"outputs": [],
|
2022-11-06 20:53:58 +00:00
|
|
|
"source": [
|
|
|
|
"logm200 = np.log10(data[\"m200\"])\n",
|
|
|
|
"conc = data[\"conc\"]\n",
|
|
|
|
"\n",
|
|
|
|
"N = 10\n",
|
|
|
|
"bins = np.linspace(logm200.min(), logm200.max(), N)\n",
|
|
|
|
"x = [0.5*(bins[i] + bins[i + 1]) for i in range(N-1)]\n",
|
|
|
|
"y = np.full((N - 1, 3), np.nan)\n",
|
|
|
|
"for i in range(N - 1):\n",
|
|
|
|
" mask = (logm200 >= bins[i]) & (logm200 < bins[i + 1]) & np.isfinite(conc)\n",
|
|
|
|
" y[i, :] = np.percentile(conc[mask], [14, 50, 84])\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
" \n",
|
|
|
|
" \n",
|
|
|
|
"fig, axs = plt.subplots(nrows=2, sharex=True, figsize=(6.4, 6.4 * 1))\n",
|
|
|
|
"fig.subplots_adjust(hspace=0)\n",
|
|
|
|
"axs[0].plot(x, y[:, 1], c=\"red\", marker=\"o\")\n",
|
|
|
|
"axs[0].fill_between(x, y[:, 0], y[:, 2], color=\"red\", alpha=0.25)\n",
|
|
|
|
"axs[1].hist(logm200, bins=\"auto\", log=True)\n",
|
|
|
|
"\n",
|
|
|
|
"for b in bins:\n",
|
|
|
|
" for i in range(2):\n",
|
|
|
|
" axs[i].axvline(b, c=\"orange\", lw=0.5)\n",
|
|
|
|
"\n",
|
|
|
|
"axs[0].set_ylim(2, 10)\n",
|
|
|
|
"axs[1].set_xlabel(r\"$M_{200c}$\")\n",
|
|
|
|
"axs[0].set_ylabel(r\"$c_{200c}$\")\n",
|
|
|
|
"axs[1].set_ylabel(r\"Counts\")\n",
|
|
|
|
"\n",
|
|
|
|
"plt.tight_layout(h_pad=0)\n",
|
|
|
|
"plt.savefig(\"../plots/mass_concentration.png\", dpi=450)\n",
|
|
|
|
"plt.show()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": null,
|
|
|
|
"id": "be26cbcc",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "venv_galomatch",
|
|
|
|
"language": "python",
|
|
|
|
"name": "venv_galomatch"
|
|
|
|
},
|
|
|
|
"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"
|
|
|
|
},
|
|
|
|
"vscode": {
|
|
|
|
"interpreter": {
|
|
|
|
"hash": "f29d02a8350410abc2a9fb79641689d10bf7ab64afc03ec87ca3cf6ed2daa499"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 5
|
|
|
|
}
|