csiborgtools/notebooks/powerspectrum_test.ipynb

722 lines
1,009 KiB
Text
Raw Normal View History

Add pynbody and other support (#92) * Simplify box units * Move old scripts * Add printing * Update readers * Disable boundscheck * Add new ordering * Clean up imports * Enforce dtype and add mass to quijote * Simplify print statements * Fix little typos * Fix key bug * Bug fixing * Delete boring comments * Improve ultimate clumps for PHEW * Delete boring comments * Add basic reading * Remove 0th index HID * Add flipping of X and Z * Updates to halo catalogues * Add ordered caching * Fix flipping * Add new flags * Fix PHEW empty clumps * Stop over-wrriting * Little improvements to angular neighbours * Add catalogue masking * Change if-else statements * Cache only filtered data * Add PHEW cats * Add comments * Sort imports * Get Quijote workign * Docs * Add HMF calculation * Move to old * Fix angular * Add great circle distance * Update imports * Update impotrts * Update docs * Remove unused import * Fix a quick bug * Update compatibility * Rename files * Renaming * Improve compatiblity * Rename snapsht * Fix snapshot bug * Update interface * Finish updating interface * Update all paths * Add old scripts * Add basic halo * Update imports * Improve snapshot processing * Update ordering * Fix how CM positions accessed * Add merger paths * Add imports * Add merger reading * Add making a merger tree * Add a basic merger tree reader * Add imports * Add main branch walking + comments + debuggin * Get tree running * Add working merger tree walking along main branch * Add units conversion for merger data * Add hid_to_array_index * Update merger tree * Add mergertree mass to PHEWcat * Edit comments * Add this to track changes... * Fix a little bug * Add mergertree mass * Add cache clearing * Improve summing substructure code * Littbe bug * Little updates to the merger tree reader * Update .giignore * Add box selection * Add optional deletingf of a group * add to keep track of changes * Update changes * Remove * Add manual tracker * Fix bug * Add m200c_to_r200c * Add manual halo tracking * Remove skipped snapshots * update cosmo params to match csiborg * remove old comments * Add SDSSxALFALFA * Fix bugs * Rename * Edit paths * Updates * Add comments * Add comment * Add hour conversion * Add imports * Add new observation class * Add selection * Add imports * Fix small bug * Add field copying for safety * Add matching to survey without masking * Add P(k) calculation * Add nb * Edit comment * Move files * Remove merger import * Edit setup.yp * Fix typo * Edit import warnigns * update nb * Update README * Update README * Update README * Add skeleton * Add skeleton
2023-12-07 14:23:32 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"\n",
"import csiborgtools\n",
"from h5py import File\n",
"from gc import collect"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"with File(\"/mnt/extraspace/rstiskalek/csiborg2/snapshot_099.hdf5\", 'r') as f:\n",
" # print(f[\"Header\"].attrs[\"BoxSize\"])\n",
" mhigh = f[\"Header\"].attrs[\"MassTable\"][1]\n",
" pos1 = f['PartType1']['Coordinates'][:]\n",
" pos5 = f['PartType5']['Coordinates'][:]\n",
" mass5 = f['PartType5']['Masses'][:]\n",
"\n",
"mass1 = np.ones(len(pos1)) * mhigh * 1e10\n",
"mass5 *= 1e10\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"80"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pos = np.concatenate((pos1, pos5), axis=0)\n",
"mass = np.concatenate((mass1, mass5), axis=0).astype(np.float32)\n",
"\n",
"del pos1, pos5, mass1, mass5\n",
"collect()\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Using PCS mass assignment scheme with weights\n",
"Time taken = 58.325 seconds\n",
"\n"
]
}
],
"source": [
"import MAS_library as MASL\n",
"\n",
"\n",
"# density field parameters\n",
"grid = 512 #the 3D field will have grid x grid x grid voxels\n",
"BoxSize = 677.7 #Mpc/h ; size of box\n",
"MAS = 'PCS' #mass-assigment scheme\n",
"verbose = True #print information on progress\n",
"\n",
"# define 3D density field\n",
"delta = np.zeros((grid,grid,grid), dtype=np.float32)\n",
"# construct 3D density field\n",
"MASL.MA(pos, delta, BoxSize, MAS, verbose=verbose, W=mass)\n"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"# np.save(\"delta_8600_PCS.npy\", delta)\n",
"delta_new = np.load(\"delta_8600_PCS.npy\")\n",
"\n",
"delta_old = np.load(\"/mnt/extraspace/rstiskalek/CSiBORG/environment/density_PCS_08596_grid512.npy\").T"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"delta_new /= np.mean(delta_new)\n",
"delta_new -= 1\n",
"delta_old /= np.mean(delta_old)\n",
"delta_old -= 1\n",
"\n",
"# delta_new = np.log10(delta_new)\n",
"# delta_old = np.log10(delta_old)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"imin = 256 - 50\n",
"imax = 256 + 50\n",
"\n",
"delta_new_central = np.zeros_like(delta_new)\n",
"delta_new_central[imin:imax, imin:imax, imin:imax] = delta_new[imin:imax, imin:imax, imin:imax]\n",
"\n",
"delta_old_central = np.zeros_like(delta_old)\n",
"delta_old_central[imin:imax, imin:imax, imin:imax] = delta_old[imin:imax, imin:imax, imin:imax]"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"# plt.figure()\n",
"# plt.imshow(delta_new_central[:, 256, :], origin='lower')\n",
"\n",
"# plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing power spectrum of the field...\n",
"Time to complete loop = 8.08\n",
"Time taken = 14.80 seconds\n",
"\n",
"Computing power spectrum of the field...\n",
"Time to complete loop = 8.02\n",
"Time taken = 14.54 seconds\n"
]
}
],
"source": [
"knew, pknew = csiborgtools.field.power_spectrum(delta_new_central, 677.7, \"PCS\", threads=2)\n",
"kold, pkold = csiborgtools.field.power_spectrum(delta_old_central, 677.7, \"PCS\", threads=2)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"import camb\n",
"from camb import model \n",
"\n",
"pars = camb.CAMBparams()\n",
"h = 0.705\n",
"pars.set_cosmology(H0=h*100, ombh2=0.04825 * h**2, omch2=(0.307 - 0.04825) * h**2)\n",
"pars.InitPower.set_params(ns=0.9611)\n",
"#Note non-linear corrections couples to smaller scales than you want\n",
"pars.set_matter_power(redshifts=[0.], kmax=40)\n",
"\n",
"#Non-Linear spectra (Halofit)\n",
"pars.NonLinear = model.NonLinear_both\n",
"results = camb.get_results(pars)\n",
"results.calc_power_spectra(pars)\n",
"kh_nonlin, z_nonlin, pk_nonlin = results.get_matter_power_spectrum(minkh=1e-3, maxkh=50, npoints = 200)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkoAAAHLCAYAAAA3J7d5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB7nElEQVR4nO3de3zO9f/H8cd1XTtvjNmYOc35zDQmyik0lKLorKF0kpKOOkl9U+nwU1lJYTpJhApJ5FQJyYQ5n88MM7t2vq7P748rV60Zs9N1bXveb7fdvtfn/Xl/Pp/Xta6v67X30WQYhoGIiIiI5GJ2dQAiIiIi7kqJkoiIiEgelCiJiIiI5EGJkoiIiEgelCiJiIiI5EGJkoiIiEgelCiJiIiI5EGJkoiIiEgelCiJiIiI5EGJkoiUGSaTiZdeesnVYeQQHh7O4MGDS/y5L730EiaTicTExBJ/tkhZokRJRErMwoUL3S6RERG5GCVKIlJiFi5cyNixY10dRonavn07H3/8savDEJECUqIkIm4pOzubzMzMEnlWeno6dru9WO7t7e2Np6dnsdxbRIqfEiWRcurw4cPcc889hIWF4e3tTd26dXnwwQdzJCdJSUmMHDmSWrVq4e3tTYMGDXjjjTdyJBX79u3DZDLx1ltvMXnyZOrXr4+3tzft2rVj3bp1znqDBw8mNjYWcIwlOv/z33tMmDDBeY+EhAQyMzN58cUXiYyMJDAwEH9/fzp16sSyZcsK9L6XL1+OyWTiq6++4vnnn6dGjRr4+fmRnJwMwJo1a+jVqxeBgYH4+fnRpUsXfv311wvep23btvj4+FC/fn0++ugj57igf7vQGKU9e/YwcOBAgoKC8PPz48orr2TBggUXjPPrr7/m1VdfpWbNmvj4+NC9e3d27dqV7/ebmJjILbfcQsWKFalSpQqPPvoo6enpOepkZ2fzyiuvOH/v4eHhPPvss2RkZABgGAbdunUjJCSEEydOOK/LzMykZcuW1K9fH6vVmu+YREoTD1cHICIl78iRI0RFRZGUlMR9991HkyZNOHz4MLNnzyY1NRUvLy9SU1Pp0qULhw8f5v7776d27dr89ttvjB49mqNHjzJhwoQc9/zyyy85d+4c999/PyaTifHjx3PTTTexZ88ePD09uf/++zly5Ag//fQTn3322QXjmjZtGunp6dx33314e3sTFBREcnIyn3zyCbfffjvDhg3j3LlzTJkyhejoaNauXUtERESBfgevvPIKXl5ePPHEE2RkZODl5cXPP/9M7969iYyMZMyYMZjNZqZNm8Y111zDqlWriIqKAmDDhg306tWL6tWrM3bsWGw2Gy+//DIhISGXfO7x48fp2LEjqampPPLII1SpUoXp06dzww03MHv2bPr375+j/uuvv47ZbOaJJ57g7NmzjB8/njvvvJM1a9bk633ecssthIeH89prr/H777/z3nvvcebMGT799FNnnXvvvZfp06czYMAAHn/8cdasWcNrr73G1q1bmTt3LiaTialTp9KqVSseeOAB5syZA8CYMWPYsmULy5cvx9/fP7+/epHSxRCRcufuu+82zGazsW7dulzn7Ha7YRiG8corrxj+/v7Gjh07cpx/5plnDIvFYhw4cMAwDMPYu3evARhVqlQxTp8+7az37bffGoDx/fffO8uGDx9uXOifnfP3qFixonHixIkc57Kzs42MjIwcZWfOnDGqVatmDB06NEc5YIwZM+ai733ZsmUGYNSrV89ITU3N8b4bNmxoREdHO38HhmEYqampRt26dY2ePXs6y/r27Wv4+fkZhw8fdpbt3LnT8PDwyPX+6tSpY8TExDiPR44caQDGql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ZjP9+vXj+++/548//sh1/nxLxS233MLq1av58ccfc9VJSkoiOzv7sp99fmZUUlJSvq8536Ly7xaUNWvWsHr16st+/sVERkZSv3593nrrLVJSUnKdP3nypDOeHj16MG/ePI4cOeI8v2vXLn744YdLPqdPnz6sXbs2R/xWq5XJkycTHh5Os2bNiuDd/OP8kgznvf/++wDO8VR9+vQByDWL8Z133gHguuuuc5YNGzYMu93OlClTmDx5Mh4eHtxzzz0Fbt0SKQ3UoiRSDo0bN47FixfTpUsX7rvvPpo2bcrRo0eZNWsWv/zyC5UqVeLJJ5/ku+++4/rrr2fw4MFERkZitVrZtGkTs2fPZt++fQQHB1/WcyMjIwF45JFHiI6OxmKxcNttt130muuvv545c+bQv39/rrvuOvbu3cukSZNo1qzZBROagjKbzXzyySf07t2b5s2bM2TIEGrUqMHhw4dZtmwZFStW5Pvvvwcc+6gtXryYq666igcffBCbzcbEiRNp0aIF8fHxF33OM888w4wZM+jduzePPPIIQUFBTJ8+nb179/LNN99gNhft36979+7lhhtuoFevXqxevZrPP/+cO+64g9atWwPQunVrYmJimDx5MklJSXTp0oW1a9cyffp0+vXrR7du3QDH0g0LFiwgLi6OmjVrAo6k66677uLDDz/koYceKtK4RdyGS+fciYjL7N+/37j77ruNkJAQw9vb26hXr54xfPjwHFPRz507Z4wePdpo0KCB4eXlZQQHBxsdO3Y03nrrLSMzM9MwjH+m9r/55pu5nsF/putnZ2cbI0aMMEJCQgyTyeScSn+xe9jtdmPcuHFGnTp1DG9vb6NNmzbG/PnzjZiYGKNOnToXfd6FnJ92P2vWrAue37Bhg3HTTTcZVapUMby9vY06deoYt9xyi7F06dIc9ZYuXWq0adPG8PLyMurXr2988sknxuOPP274+PjkqPff5QEMwzB2795tDBgwwKhUqZLh4+NjREVFGfPnz89XnOd/V9OmTbvo+zy/PEBCQoIxYMAAo0KFCkblypWNhx9+2EhLS8tRNysryxg7dqxRt25dw9PT06hVq5YxevRoIz093TAMwzh48KARGBho9O3bN9d
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.plot(knew, pknew, label=\"New Gadget4\")\n",
"plt.plot(kold, pkold, label=\"Old RAMSES\")\n",
"\n",
"# m = (kh_nonlin > knew.min()) & (kh_nonlin < knew.max())\n",
"# plt.plot(kh_nonlin[m], pk_nonlin[0, :][m], label=\"CAMB\")\n",
"\n",
"kmax = 2 * np.pi / 677.6 * (512 / 2)\n",
"\n",
"plt.axvline(kmax, color=\"k\", ls=\"--\", label=\"Nyquist\")\n",
"\n",
"plt.xlabel(\"k [h/Mpc]\")\n",
"plt.ylabel(\"P(k) [Mpc/h]$^3$\")\n",
"\n",
"plt.yscale(\"log\")\n",
"plt.xscale(\"log\")\n",
"\n",
"plt.legend()\n",
"\n",
"plt.title(\"central region box\")\n",
"plt.savefig(\"../plots/pk_comparison_central_box.png\", dpi=300, bbox_inches=\"tight\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing correlation function of the field...\n",
"Time to complete loop = 1.48\n",
"Time taken = 54.30 seconds\n"
]
}
],
"source": [
"import numpy as np\n",
"import Pk_library as PKL\n",
"\n",
"# correlation function parameters\n",
"BoxSize = 677.7 #Mpc/h\n",
"MAS = ['PCS', 'PCS']\n",
"axis = 0\n",
"threads = 2\n",
"\n",
"# compute cross-correlaton function of the two fields\n",
"CCF = PKL.XXi(delta_new, delta_old, BoxSize, MAS, axis, threads)\n",
"\n",
"# get the attributes\n",
"r = CCF.r3D #radii in Mpc/h\n",
"xxi0 = CCF.xi[:,0] #monopole\n",
"xxi2 = CCF.xi[:,1] #quadrupole\n",
"xxi4 = CCF.xi[:,2] #hexadecapole\n",
"Nmodes = CCF.Nmodes3D #number of modes"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhE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l7kTMDFuoMSVEdnGVYKQy3eNSYVdY0TkikRRRP7uCvx5w1E0tBjgq5AhZ+oIPJoxAkoftx72SSQJtgj1gC1CROQqzlxswtLPDmD7yYsAgMTYAXhp7gSMjgqWuDIi+7FFiIiIbGJuBfrDV0fQpDfCz1eOp24djQU/Gw6FnLPBiPqCQcgKdo0RkSuo1eqx9NMD2NQ2Fih9eBheumsCt8YgchB2jfWAXWNEJJUtZRew5JMDqG7QwVchw5Jpo/HQ9VdBzlYg8gDNzc244YYbAABFRUXw9/d36PXZNUZE5KZaWo1YseEo3t9hWhhxZEQQXr93IhKi+csYeQ5/f3/s3r1b6jIYhIiIXMnhc/V4fG0pTlxoBADMvy4eS7OugZ8v1wUicgYGISIiFyAIIt7+7hRe2VSGVqOIwcEqvHJ3Im4cNVjq0og8GoOQFRwsTUT95VxdM3I/KsXOU7UAgGljI7FizgSEBSolrozIeZqampCQkAAAOHLkCAICAiSpg4Ole8DB0kTkLKIo4rO9Z7H8y8NoaDEgQKnAczMTMC8llpukksfjOkJERF7sQkMLfvfZIXxz1DQtPil2APLuSUJ8OKfFE/UnBiEion62/sB5PF1wEJeaWuGrkOE3t4zCr6ZcBR8Ft8gg6m8MQkRE/eSSVo9nPj+Erw6cBwCMjQ7Bq/MScU0Uu92JpMIgZAUHSxORI/3vSBWWfXYQNY06KOSmjVIXT+VGqURS42DpHnCwNBH1RX1zK/7w5RF8uvcnAKb
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.plot( 1 / r, xxi0, label=\"monopole\")\n",
"plt.yscale(\"log\")\n",
"plt.xscale(\"log\")\n",
"plt.xlabel(\"r [Mpc/h]\")\n",
"plt.ylabel(\"Cross corr\")\n",
"plt.axvline(2.65, color=\"k\", ls=\"--\", label=\"Nyquist\")\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 87,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<KeysViewHDF5 ['GroupAscale', 'GroupFirstSub', 'GroupLen', 'GroupLenPrevMostBnd', 'GroupLenType', 'GroupMass', 'GroupMassType', 'GroupNsubs', 'GroupOffsetType', 'GroupPos', 'GroupVel', 'Group_M_Crit200', 'Group_M_Crit500', 'Group_M_Mean200', 'Group_M_TopHat200', 'Group_R_Crit200', 'Group_R_Crit500', 'Group_R_Mean200', 'Group_R_TopHat200']>\n"
]
}
],
"source": [
"with File(\"/mnt/extraspace/rstiskalek/csiborg2/fof_subhalo_tab_099.hdf5\", 'r') as f:\n",
" print(f[\"Group\"].keys())\n",
" x = f[\"Group/GroupMass\"][:] * 1e10\n",
" pos = f[\"Group/GroupPos\"][:]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
"x0 = np.ones(3) * 676.6 / 2\n",
"\n",
"d = np.linalg.norm(pos - x0, axis=1)\n",
"m = d < 100"
]
},
{
"cell_type": "code",
"execution_count": 93,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAicAAAGdCAYAAADJ6dNTAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAd90lEQVR4nO3db2xV93kH8MdAMUoW3IJXGycQb+uSyW1qS2AoUyvBZoV4Eazp2tK9SB1eIG0y3ST3H0warNIqUmnLmNSrRe2aoWnahCY1TAobWmsloptYMXieWlmtSkUyJ8wGGtUOzmYy++5FZyeAMb729b2/4/P5SFfKvef4nMc6Cv7q+f25NcVisRgAAIlYUe0CAADeSTgBAJIinAAASRFOAICkCCcAQFKEEwAgKcIJAJAU4QQASMqqahdQ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fiYz4aRQKERLS0u0t7dXuxQAYAllJpzYvp680EEB8s6cE6gyQQTgZpnpnAAA+aBzAomzsgfIG50TyBDzUYA8EE4gg4QUYDkzrAOJEj6AvNI5AQCSIpwAAEkRTgCApAgnAEBShBPIMKt2gOXIah1YBqYDymybtN0aXmzkBqROOIFlSkcFyKrMDOsUCoVoaWmJ9vb2apcCACyhzIST7u7uGBwcjL6+vmqXAgAsIcM6sIwYygGWA+EEcmauAGOyLJCCzAzrAAD5IJwAM+ybAqRAOAEAkiKcAABJEU4AgKQIJ8C8mI8CVIpwAtxGEAGqSTgBAJIinAAASbFDLHBHhnaAatA5ARbEvBRgqQgnAEBSDOsAJdEtAZaazglQdoZ
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.hist(np.log10(x[m]), bins=\"auto\")\n",
"\n",
"plt.yscale(\"log\")\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"dx = (delta_new - delta_old.T) / delta_old.T"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAGsCAYAAACrTh/yAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAzZElEQVR4nO3de3xU9Z3/8fckkHAJMzGQZJKaIHghUEBs1DBeuigpAdHVJfJAlwpaVlc28aHGWoml4LVRqmJVlG5XAbeltOyj0IqKxHBxq+FiNCsipMIPTQpMQuWRG5oLme/vD2TKSE5kmMntzOvZx/fxIOf6PafI+eTz+Z7vcRhjjAAAQESJ6u4OAACArkcAAABABCIAAAAgAhEAAAAQgQgAAACIQAQAAABEIAIAAAAiEAEAAAARiAAAAIAIRAAA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JIqYFcBIGAVojAAAA2JZPUUwEZIEAAABgW23GobYQv+YX6v49FflSAAAiEBkAAIBttYXhLYA2SgAAAPQuPhMlX4iDAH02HQRICQAAgAhEBgAAYFuUAKwRAAAAbMun0Efx23V6MUoAAABEIDIAAADbCs9EQPb8XZkAAABgW+GZCtieAYA9rwoAAHSIDAAAwLZ8csinUAcB2nMqYAIAm/LJx5fxAEQ8SgDWCABsioc/AIRrHgB7/ntqz6sCAAAdIgMAALAtn3HIF+pEQDb9HDABAADAtnxhKAHYdR4Ae14VAADoEBkAAIBthedzwPb8XZk
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure()\n",
"plt.imshow(dx[:, :, 256], origin=\"lower\")\n",
"plt.colorbar()\n",
"\n",
"thetas = np.linspace(0, 2 * np.pi, 1000)\n",
"rad = 0.22 * 512\n",
"plt.plot(rad * np.cos(thetas) + 256, rad * np.sin(thetas) + 256, color=\"red\", ls=\"--\")\n",
"\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_24992/1715643559.py:6: RuntimeWarning: divide by zero encountered in log10\n",
" axs[2].imshow(np.log10(np.abs(dx[:, :, 256])))\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAz8AAAEUCAYAAAAFoYifAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9WYxmW5bfh/32cOZvjikzb+adauqqLnZ1s9ndkkVIhE2YDwYNWjJAGDZA0M+kbLcAg5QBDpBh2gYM0wb5aAj2i0FZkGDJJmnTDVI0KY5Nssiu7prunJmRGdM3n3nv7Yd1vi9usdRkUV1d1dcVC7iozK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bD6h6vY7RJCHFOsBbVeGga/M0G+/YzQj5GJTuYn/Dq955z8s8qLAGVjTFFB0ZD3xO2NaxLQt+jswy/b4myDHSMunhEiMyxYNB3W+zYQ5YStjs5/JzD7BuK0NFeTEnsgvrzbxHf7VG1w9/toQlQr7EYVCSJt5ktUOs9zmuoHfrVBqZjjAqY9Q5qh7vbQNdj0hTVazi7AKNRdSu/P5uglIZHb8CqIexLQhtQLYQOdBMgHdFnOcnzFew7lFKEpkV1SoqgxhOaltC26MkENcm5+YXHzH99I/fXdWhv0N+5xPz0u7TzBGxK9vEdYVURqopp5XCPTtDjGfp6A7c7VJZiTi/w252sySGMzSCOpGgOAV/fSWKzb2F/h73bw8kMpWLssoHJHLUq7wvOoNHFiNA0aBVJcn4IZeDZE9woJtpO0WWL2pWSCEcaqhodFyijJSEaGgYA7nSOud3KOwa/42kfv9k+kp4/wkbyzofh3oe+Bweh81BXsrc4jTaxrIlaEj9V5KjxnFB
"text/plain": [
"<Figure size 1000x600 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(1, 3, figsize=(10, 6))\n",
"\n",
"\n",
"axs[0].imshow(np.log10(delta_new[:, :, 256] + 2))\n",
"axs[1].imshow(np.log10((delta_old.T)[:, :, 256] + 2))\n",
"axs[2].imshow(np.log10(np.abs(dx[:, :, 256])))\n",
"\n",
"thetas = np.linspace(0, 2 * np.pi, 1000)\n",
"rad = 0.22 * 512\n",
"for i in range(2):\n",
" axs[i].plot(rad * np.cos(thetas) + 256, rad * np.sin(thetas) + 256, color=\"red\", ls=\"--\")\n",
" axs[i].axvline(256, color=\"red\", ls=\"--\", alpha=0.5)\n",
" axs[i].axhline(256, color=\"red\", ls=\"--\", alpha=0.5)\n",
" \n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"102.4"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.2 * 512"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-11-23 11:17:00.672141: opening `/mnt/extraspace/rstiskalek/CSiBORG/processed_output/parts_FOF_07444.hdf5`.\n"
]
}
],
"source": [
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n",
"cat = csiborgtools.read.CSiBORGCatalogue(7444, paths, \"halofinder_catalogue\", \"FOF\")"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiYAAAGdCAYAAAAmK7htAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAg2ElEQVR4nO3df0xd9eH/8RcFLr1gy6XwLQUKZdqowTpIWsq6H9I6Yr9s6dK6ue67pcNuq3G7bGWQRvvHxC1L+tm++XZd3EmMRm2WbRkz0S7TRCNYrZpqaetVG2YrpqvsY+GWyo/ei3INnO8ffHonBVou3MN9n3ufj4QocHyf9zvXY5/CueedZtu2LQAAAAMsSvQEAAAALiNMAACAMQgTAABgDMIEAAAYgzABAADGIEwAAIAxCBMAAGAMwgQAABgjI9ETiNX4+Lg+/PBDLVmyRGlpaYmeDgAAmAXbtnXp0iUVFxdr0aKZfy7imjCxLEuWZSkSiej9999P9HQAAMAc9PT0aOXKlTN+P81tj6QfGhqSz+dTT0+Pli5dmujpAACAWRgeHlZpaakGBweVm5s743Gu+YnJZZd/fbN06VLCBAAAl7nWbRjc/AoAAIxBmAAAAGMQJgAAwBiuCRPLslRRUaHq6upETwUAADjEde/KGR4eVm5uroaGhrj5FQAAl5jtn9+u+YkJAABIfoQJAAAwBmECAACMQZgAAABjECYAAMAYhAkAADCGa8KE55gAAJD8eI4J4AL/PfixBsIRR8bOy/GoxO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t
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = np.arange(13, 15, 0.1)\n",
"\n",
"plt.figure()\n",
"plt.hist(np.log10(mass), bins=bins, log=True, histtype=\"step\")\n",
"plt.hist(np.log10(cat[\"totpartmass\"]), bins=bins, log=True, histtype=\"step\")\n",
"\n",
"\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-11-23 11:16:53.499291: opening `/mnt/extraspace/rstiskalek/CSiBORG/processed_output/parts_FOF_07444.hdf5`.\n"
]
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"pos_old = cat[\"snapshot_final/pos\"][:]"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"mass_old = cat[\"snapshot_final/mass\"][:]"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"with File(\"/mnt/zfsusers/rstiskalek/gadget4/examples/V04_DM/output/snapshot_004.hdf5\", 'r') as f:\n",
" pos_new = f[\"PartType1/Coordinates\"][:] / 677.7\n",
" mass_new = np.ones(len(pos_new)) * 1e10 * 158.061\n",
" # mass_new = f[\"PartType1/Mass\"][:] * 1e10"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {},
"outputs": [],
"source": [
"box = csiborgtools.read.CSiBORG1Box(951, 7444, paths)\n",
Add pynbody and other support (#92) * Simplify box units * Move old scripts * Add printing * Update readers * Disable boundscheck * Add new ordering * Clean up imports * Enforce dtype and add mass to quijote * Simplify print statements * Fix little typos * Fix key bug * Bug fixing * Delete boring comments * Improve ultimate clumps for PHEW * Delete boring comments * Add basic reading * Remove 0th index HID * Add flipping of X and Z * Updates to halo catalogues * Add ordered caching * Fix flipping * Add new flags * Fix PHEW empty clumps * Stop over-wrriting * Little improvements to angular neighbours * Add catalogue masking * Change if-else statements * Cache only filtered data * Add PHEW cats * Add comments * Sort imports * Get Quijote workign * Docs * Add HMF calculation * Move to old * Fix angular * Add great circle distance * Update imports * Update impotrts * Update docs * Remove unused import * Fix a quick bug * Update compatibility * Rename files * Renaming * Improve compatiblity * Rename snapsht * Fix snapshot bug * Update interface * Finish updating interface * Update all paths * Add old scripts * Add basic halo * Update imports * Improve snapshot processing * Update ordering * Fix how CM positions accessed * Add merger paths * Add imports * Add merger reading * Add making a merger tree * Add a basic merger tree reader * Add imports * Add main branch walking + comments + debuggin * Get tree running * Add working merger tree walking along main branch * Add units conversion for merger data * Add hid_to_array_index * Update merger tree * Add mergertree mass to PHEWcat * Edit comments * Add this to track changes... * Fix a little bug * Add mergertree mass * Add cache clearing * Improve summing substructure code * Littbe bug * Little updates to the merger tree reader * Update .giignore * Add box selection * Add optional deletingf of a group * add to keep track of changes * Update changes * Remove * Add manual tracker * Fix bug * Add m200c_to_r200c * Add manual halo tracking * Remove skipped snapshots * update cosmo params to match csiborg * remove old comments * Add SDSSxALFALFA * Fix bugs * Rename * Edit paths * Updates * Add comments * Add comment * Add hour conversion * Add imports * Add new observation class * Add selection * Add imports * Fix small bug * Add field copying for safety * Add matching to survey without masking * Add P(k) calculation * Add nb * Edit comment * Move files * Remove merger import * Edit setup.yp * Fix typo * Edit import warnigns * update nb * Update README * Update README * Update README * Add skeleton * Add skeleton
2023-12-07 14:23:32 +00:00
"\n",
"field_generator = csiborgtools.field.DensityField(box, \"PCS\")"
]
},
{
"cell_type": "code",
"execution_count": 117,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading particles for the density field: 97%|█████████▋| 30/31 [00:02<00:00, 13.90it/s]\n",
"Loading particles for the density field: 97%|█████████▋| 30/31 [00:58<00:01, 1.97s/it]\n"
]
}
],
"source": [
"field_new = field_generator(pos_new, mass_new, 128)\n",
"field_old = field_generator(pos_old, mass_old, 128)"
]
},
{
"cell_type": "code",
"execution_count": 127,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAz8AAAGQCAYAAACAgN5RAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9v69l25IWCn4RY8619s48ec+9dasomqZa6EnPwQE1P8roltpBwmgHDxPhF051G5QDwsLFgD8C/xk4JT2pDSQksLolWm21EHQVFLfqnpO5915rzjGijYgvRsy19zk373ului/rrCHlyTx7rzV/jB/x44svIsTMDPdxH/dxH/dxH/dxH/dxH/dxH3/Oh/6qH+A+7uM+7uM+7uM+7uM+7uM+7uPPYtydn/u4j/u4j/u4j/u4j/u4j/v4QYy783Mf93Ef93Ef93Ef93Ef93EfP4hxd37u4z7u4z7u4z7u4z7u4z7u4wcx7s7PfdzHfdzHfdzHfdzHfdzHffwgxt35uY/7uI/7uI/7uI/7uI/7uI8fxLg7P/dxH/dxH/dxH/dxH/dxH/fxgxh35+c+7uM+7uM+7uM+7uM+7uM+fhDj7vzcx33cx33cx33cx33cx33cxw9i3J2f+7iP+7iP+7iP+7iP+7iP+/hBjF+p8/Ov/tW/wl/5K38FDw8P+O3f/m38u3/3736Vj3Mf93Ef93EfP/Bx10v3cR/3cR9/vsevzPn51//6X+N3f/d38U//6T/Ff/gP/wF/7a/9Nfzdv/t38V//63/9VT3SfdzHfdzHffyAx10v3cd93Md9/PkfYmb2q7jxb//2b+Nv/a2/hX/5L/8lAGCMgd/6rd/CP/pH/wj/+B//4+/97hgD/+W//Bd8+PABIvJn8bj3cR/3cR/3AcDM8O233+Iv/aW/BNU/X8zp/zV6iZ+/66b7uI/7uI8/+/HL6Kblz+iZDuN6veLf//t/j9/7vd/Ln6kq/s7f+Tv4t//23776/OVyweVyyf//z//5P+Ov/tW/+mfyrPdxH/dxH/fxevyn//Sf8Jf/8l/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2e4t0CAZgAyYKqEHaGfbwzh3nDw8YH1YAQLu48woAyulXgS5uLOm1Q7srYx0LRE7+bsvie34Y0MMZG4CF0kU7A6cFWE+Qx/ew84rx/gz86AFYFfigwNcKW4D9PdAfDe1FcBrma1TezQ1y3+MSzo2pwFakEK4CH9vRoZQdaKOjYUCb+FkQYGjD3gRj8cfVzj3uZyCdmxFnL448jay8hwBDXQaMOOdjCcFrQOu+Xg/7wOlpRx8KfFpok+R1Tpvh9DxcwawylZUJLBwii30jzwY8hRG6+3lQGNrDApUTdBsQbO6YacOQ5kZsnPu8L6b4AoBmgqWHQaCAnC2Bm9EANMDO4ueB82QuexoNq3B+pLlsktWdwf0Ue/VRIO8N2F2e8DHutK7v1k3y/j0EpzSUQLAD8PMIQGAQ6QDiM9ywI3SKAGYNgMI6sD670YE2DX0ZCpHQTbpB4M4NrpIyjQCd6AJZ1yn7xnD5sp6hpzBomgNAjrv5+raUVQbdGmTIEZg7LZB1wWgCCecHwARDNEAPgTsABIbC8YEZWhuQ8wnSBtreIM2fTUP/jQ8njA9LATNcTuCluxzATGBOQ573DiO3h9Gm20Drw+dfO0QGRAektWn5UreNBW1bgCEY1jC0+XnONTPIasACd4DE5YEuChPFMMUJZwzz9dQzIAugzRzI2wxK3WRxDerY3hNEq4O6ftkU9on6qoJAPhMnNJxkiXc26DWcKjs6pVhizpYJnDnINtAGgO6OniNK3W0hUwfmTg8Y785hWIcOMkuA0pq6wUyBpb4xGhSKq8+zqgu34kDJ6EDfAVMY7TdR4LS63Dk/oj++xzg1yPsV+KrBToL91wXXrw26CfRngHwyyNWgnwZ0Czk
"text/plain": [
"<Figure size 1000x500 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ax = 0\n",
"fig, axs = plt.subplots(1, 2, figsize=(10, 5))\n",
"axs[0].imshow(np.mean(field_new, axis=ax))\n",
"axs[1].imshow(np.mean(field_old.T, axis=ax))\n",
"# axs[1].imshow(np.mean(field_new, axis=ax) - np.mean(field_old.T, axis=ax))\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Computing power spectrum of the field...\n",
"Time to complete loop = 0.17\n",
"Time taken = 0.19 seconds\n",
"\n",
"Computing power spectrum of the field...\n",
"Time to complete loop = 0.16\n",
"Time taken = 0.18 seconds\n"
]
}
],
"source": [
"delta_new = field_new / np.mean(field_new) - 1\n",
"delta_old = field_old / np.mean(field_old) - 1\n",
"\n",
"\n",
"knew, pnew = csiborgtools.field.power_spectrum(delta_new, box.boxsize, field_generator.MAS)\n",
"kold, pold = csiborgtools.field.power_spectrum(delta_old, box.boxsize, field_generator.MAS)"
]
},
{
"cell_type": "code",
"execution_count": 122,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA3kAAAGGCAYAAADGq0gwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB6SUlEQVR4nO3dd3hU1dbH8e+UTHohCSQQQq8RDB1REFAQQVGwVxBQrxpsXK+KV+W1IF4VFCGKBQQLAipiQ0QQBKSXIEgRpEMaENL7zPvHwECEYIBkTjL5fZ5nnmTO7HPOmmGYkzV777VNDofDgYiIiIiIiHgEs9EBiIiIiIiISPlRkiciIiIiIuJBlOSJiIiIiIh4ECV5IiIiIiIiHkRJnoiIiIiIiAdRkiciIiIiIuJBlOSJiIiIiIh4ECV5IiIiIiIiHsRqdADnym63c+jQIQIDAzGZTEaHIyIibuBwOMjMzKROnTqYzfp+EnQ9FBGpjsp6PaxySd6hQ4eIjo42OgwRETHA/v37qVu3rtFhVAq6HoqIVF//dD2sckleYGAg4HxiQUFBBkcjIiLukJGRQXR0tOsaILoeioic6qPfdjF2/g76tY7ktZtijQ6nhM0Hj3Hb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EZyOXNanIkq4Dn+8cYG9Q5cmd1TU3wqgJsIbXZ32IoADFb3+JwRrbBEYlIRWrcuDEbNmygV69ejBw5ktjYWDp06MCECRN44okneOmll4iNjWXcuHH873//o1WrVnz22WeMGTOmxHEuueQSPvjgA8aPH09sbCz
"text/plain": [
"<Figure size 900x400 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plt.subplots(1, 2, figsize=(9, 4))\n",
"axs[0].plot(knew, pnew, label=\"Gadget4\")\n",
"axs[0].plot(kold, pold, label=\"RAMSES\")\n",
"axs[0].set_yscale(\"log\")\n",
"axs[0].set_xscale(\"log\")\n",
"\n",
"axs[1].plot(knew, pnew / pold)\n",
"axs[1].axhline(1, color=\"k\", ls=\"--\")\n",
"axs[1].set_xscale(\"log\")\n",
"axs[1].set_ylim(0.75, 1.25)\n",
"\n",
"axs\n",
"\n",
"axs[0].set_xlabel(r\"$k ~ [h / \\mathrm{Mpc}]$\")\n",
"axs[1].set_xlabel(r\"$k ~ [h / \\mathrm{Mpc}]$\")\n",
"axs[1].set_ylabel(r\"$P(k)$\")\n",
"axs[0].legend()\n",
"\n",
"fig.tight_layout()\n",
"# plt.savefig(\"../plots/powerspectrum_test_7444.png\", dpi=300, bbox_inches=\"tight\")\n",
"\n",
"fig.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"csiborgtools.field.power_spectrum "
]
}
],
"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
}