csiborgtools/notebooks/test.ipynb

130 lines
134 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import numpy\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import h5py\n",
"%matplotlib inline\n",
"\n",
"\n",
"import csiborgtools\n",
"\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"d0 = np.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_interpolated/TNG300-1_TNG300-1_density_PCS_00000_1024_scatter0.0.npz\")\n",
"d1 = np.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_interpolated/TNG300-1_TNG300-1_density_PCS_00000_1024_scatter1.0.npz\")\n",
"d2 = np.load(\"/mnt/extraspace/rstiskalek/csiborg_postprocessing/field_interpolated/TNG300-1_TNG300-1_density_PCS_00000_1024_scatter2.0.npz\")\n",
"\n",
"val0 = d0[\"val\"]\n",
"val1 = d1[\"val\"]\n",
"val2 = d2[\"val\"]\n",
"\n",
"\n",
"with h5py.File(\"/mnt/extraspace/rstiskalek/TNG300-1/postprocessing/subhalo_catalogue_099.hdf5\", 'r') as f:\n",
" mstar = f[\"SubhaloMassType\"][:, 4] * 1e10\n",
" mhi = f[\"m_neutral_H\"][:]\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SignificanceResult(statistic=-0.1217955937334526, pvalue=0.0)\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAicAAAGhCAYAAAC6URSFAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6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mWMfExGTFY4YPTa4FhXJflpoTU+w+oHhDopT7YbW+QJphHRMTkxWPGT40yWaxcIUvLC+q9ZG9jQNdI7zYM8HfHuiet91811+ucNBi4yqlCWE+Srkfssd4I4Z5TOPExMTkurAa9V9uxEVgJZFrgc6c868d6l1U62PhNgTGAjLhuDpvu6Vcfwe7xxkPyHzp+R6iCWWBkWRs666O6gXXR77cl+xr6UruhxvR0DfDOiYmJiZFslpj/deapYbscoUrMuf8ro5qHj/UW1DrI3sby5GnEk0ofOn5HpornTRWODl+aWZehY9RjrypwUNS0QteH5ercVQisros19JqCfOYOScmJiYmV4HVsgiUynLn/zxzapjxoFywDLaYfaZKh0cRuHoJsMVglDALCNy3uY5nT43ywpvjfOV3O2mtcqfLkavdNm5fX5Pz+sgsEY7ISlFaJ/nGslpztW7InBNTvt7ExOR6U2x56mpjucMC+7Y25C2DLWWfB7vHicgKdslS0IApFGpbjlDcga5RjvbNAHC418eZ4SANFU5ODASAy+XIn3zXprzXR2aJcHYX41K4EUM4uTA9JyYmJiZvcYpVbV1qSWw+z8lSlWIPdI0COg92NqfyQYIyl6Yj7FzjZe/meg73+tLjLCUUZ2w7oajYJAsPdjYB8Pnnugl
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from scipy.stats import spearmanr\n",
"\n",
"k = 1\n",
"\n",
"x = mhi\n",
"y = val1[:, k]\n",
"\n",
"m = (x > 0) & (y > 0)\n",
"x = x[m]\n",
"y = y[m]\n",
"\n",
"\n",
"\n",
"plt.figure()\n",
"print(spearmanr(x, y))\n",
"plt.scatter(x, y, s=0.1)\n",
"\n",
"plt.xscale(\"log\")\n",
"plt.yscale(\"log\")\n",
"plt.show()\n",
"\n"
]
},
{
"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.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}