mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 17:28:02 +00:00
more renaming
This commit is contained in:
parent
a9e98f5a2d
commit
a47847cb7c
4 changed files with 381 additions and 1937 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
352
scripts/test_paths.ipynb
Normal file
352
scripts/test_paths.ipynb
Normal file
|
@ -0,0 +1,352 @@
|
||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"id": "5a38ed25",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T21:53:10.387523Z",
|
||||||
|
"start_time": "2022-10-20T21:53:08.558627Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"try:\n",
|
||||||
|
" import csiborgtools\n",
|
||||||
|
"except ModuleNotFoundError:\n",
|
||||||
|
" import sys\n",
|
||||||
|
" sys.path.append(\"../\")\n",
|
||||||
|
" import csiborgtools\n",
|
||||||
|
" \n",
|
||||||
|
" \n",
|
||||||
|
"%load_ext autoreload\n",
|
||||||
|
"%autoreload 2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 23,
|
||||||
|
"id": "7accd798",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:00:25.350404Z",
|
||||||
|
"start_time": "2022-10-20T22:00:24.775748Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"simpath = csiborgtools.io.get_sim_path(9844)\n",
|
||||||
|
"Nsnap = 1016\n",
|
||||||
|
"# csiborgtools.io.read_info(1016, simpath)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 59,
|
||||||
|
"id": "131c3107",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:25:59.104572Z",
|
||||||
|
"start_time": "2022-10-20T22:25:59.074460Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"box = csiborgtools.units.BoxUnits(Nsnap, simpath)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 61,
|
||||||
|
"id": "b1a11aa6",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:26:12.931468Z",
|
||||||
|
"start_time": "2022-10-20T22:26:12.671686Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"3.765003070876428e+19"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 61,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"box.box2solarmass(1)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 55,
|
||||||
|
"id": "19f39a80",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:24:59.563137Z",
|
||||||
|
"start_time": "2022-10-20T22:24:59.530173Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"3.749e+19"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 55,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"3.749e19"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 57,
|
||||||
|
"id": "5d1413fd",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:25:17.251057Z",
|
||||||
|
"start_time": "2022-10-20T22:25:17.223543Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"0.9957495198343349"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 57,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"box.solarmass2box(3.749e19)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "90cf9d61",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "b53e8166",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "b3eeca5b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 49,
|
||||||
|
"id": "93d32800",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:09:12.915516Z",
|
||||||
|
"start_time": "2022-10-20T22:09:12.856213Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"0.9988759675724455"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 49,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"box.kpc2box(677.7 / 0.705 * 1000)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 43,
|
||||||
|
"id": "66d3e98f",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T22:06:46.471218Z",
|
||||||
|
"start_time": "2022-10-20T22:06:46.437023Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"678.4626139789958"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 43,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"box.box2kpc(1) / 1000 * 0.705"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "ef00a04c",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "d201838b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"filename = \"/mnt/extraspace/hdesmond/ramses_out_9844/output_01016/info_01016.txt\""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "d012a21b",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "547f7944",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T19:52:22.548299Z",
|
||||||
|
"start_time": "2022-10-20T19:52:22.544342Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"results_filepath = '/mnt/extraspace/deaglan/H-AGN/'\n",
|
||||||
|
"sugata_filepath = '/mnt/extraspace/jeg/greenwhale/Sugata/'\n",
|
||||||
|
"\n",
|
||||||
|
"def info_dir():\n",
|
||||||
|
" return sugata_filepath + 'INFO/'\n",
|
||||||
|
"\n",
|
||||||
|
"def info_file(nout):\n",
|
||||||
|
" return info_dir() + 'info_' + str(nout).zfill(5) + '.txt'\n",
|
||||||
|
"\n",
|
||||||
|
"def h_agn_particle_directory(nout):\n",
|
||||||
|
" return sugata_filepath + 'H-AGN/output_' + str(nout).zfill(5) + '/'\n",
|
||||||
|
"\n",
|
||||||
|
"def cosmo_dir():\n",
|
||||||
|
" return './data/'\n",
|
||||||
|
"\n",
|
||||||
|
"def cosmo_file(nout):\n",
|
||||||
|
" return cosmo_dir() + 'cosmo_table_' + str(nout).zfill(5) + '.txt'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "30630635",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T19:52:22.777853Z",
|
||||||
|
"start_time": "2022-10-20T19:52:22.774584Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"info_dir()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "a3fc21b2",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T19:56:35.946185Z",
|
||||||
|
"start_time": "2022-10-20T19:56:35.943643Z"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"filename = \"/mnt/extraspace/hdesmond/ramses_out_9844/output_01016/info_01016.txt\""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "fae40a32",
|
||||||
|
"metadata": {
|
||||||
|
"ExecuteTime": {
|
||||||
|
"end_time": "2022-10-20T20:05:04.410987Z",
|
||||||
|
"start_time": "2022-10-20T20:05:04.403721Z"
|
||||||
|
},
|
||||||
|
"scrolled": false
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"e"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "de7e3ae7",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3.8.0 ('venv_galomatch': virtualenv)",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"vscode": {
|
||||||
|
"interpreter": {
|
||||||
|
"hash": "f29d02a8350410abc2a9fb79641689d10bf7ab64afc03ec87ca3cf6ed2daa499"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ from tqdm import trange
|
||||||
from astropy.cosmology import FlatLambdaCDM
|
from astropy.cosmology import FlatLambdaCDM
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import galomatch
|
import csiborgtools
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
import sys
|
import sys
|
||||||
sys.path.append("../")
|
sys.path.append("../")
|
||||||
|
@ -30,19 +30,21 @@ except ModuleNotFoundError:
|
||||||
|
|
||||||
def load_mmain_convert(n):
|
def load_mmain_convert(n):
|
||||||
srcdir = "/users/hdesmond/Mmain"
|
srcdir = "/users/hdesmond/Mmain"
|
||||||
arr = galomatch.io.read_mmain(n, srcdir)
|
arr = csiborgtools.io.read_mmain(n, srcdir)
|
||||||
|
|
||||||
galomatch.utils.convert_mass_cols(arr, "mass_cl")
|
csiborgtools.utils.convert_mass_cols(arr, "mass_cl")
|
||||||
galomatch.utils.convert_position_cols(arr, ["peak_x", "peak_y", "peak_z"])
|
csiborgtools.utils.convert_position_cols(
|
||||||
galomatch.utils.flip_cols(arr, "peak_x", "peak_z")
|
arr, ["peak_x", "peak_y", "peak_z"])
|
||||||
|
csiborgtools.utils.flip_cols(arr, "peak_x", "peak_z")
|
||||||
|
|
||||||
d, ra, dec = galomatch.utils.cartesian_to_radec(arr)
|
d, ra, dec = csiborgtools.utils.cartesian_to_radec(arr)
|
||||||
arr = galomatch.utils.add_columns(arr, [d, ra, dec], ["dist", "ra", "dec"])
|
arr = csiborgtools.utils.add_columns(
|
||||||
|
arr, [d, ra, dec], ["dist", "ra", "dec"])
|
||||||
return arr
|
return arr
|
||||||
|
|
||||||
|
|
||||||
def load_mmains(N=None, verbose=True):
|
def load_mmains(N=None, verbose=True):
|
||||||
ids = galomatch.io.get_csiborg_ids("/mnt/extraspace/hdesmond")
|
ids = csiborgtools.io.get_csiborg_ids("/mnt/extraspace/hdesmond")
|
||||||
N = ids.size if N is None else N
|
N = ids.size if N is None else N
|
||||||
if N > ids.size:
|
if N > ids.size:
|
||||||
raise ValueError("`N` cannot be larger than 101.")
|
raise ValueError("`N` cannot be larger than 101.")
|
||||||
|
@ -62,11 +64,11 @@ def load_mmains(N=None, verbose=True):
|
||||||
|
|
||||||
def load_planck2015(max_comdist=214):
|
def load_planck2015(max_comdist=214):
|
||||||
cosmo = FlatLambdaCDM(H0=70.5, Om0=0.307, Tcmb0=2.728)
|
cosmo = FlatLambdaCDM(H0=70.5, Om0=0.307, Tcmb0=2.728)
|
||||||
fpath = ("/mnt/zfsusers/rstiskalek/galomatch/"
|
fpath = ("/mnt/zfsusers/rstiskalek/csiborgtools/"
|
||||||
+ "data/HFI_PCCS_SZ-union_R2.08.fits")
|
+ "data/HFI_PCCS_SZ-union_R2.08.fits")
|
||||||
return galomatch.io.read_planck2015(fpath, cosmo, max_comdist)
|
return csiborgtools.io.read_planck2015(fpath, cosmo, max_comdist)
|
||||||
|
|
||||||
|
|
||||||
def load_2mpp():
|
def load_2mpp():
|
||||||
cosmo = FlatLambdaCDM(H0=70.5, Om0=0.307, Tcmb0=2.728)
|
cosmo = FlatLambdaCDM(H0=70.5, Om0=0.307, Tcmb0=2.728)
|
||||||
return galomatch.io.read_2mpp("../data/2M++_galaxy_catalog.dat", cosmo)
|
return csiborgtools.io.read_2mpp("../data/2M++_galaxy_catalog.dat", cosmo)
|
||||||
|
|
Loading…
Reference in a new issue