csiborgtools/notebooks/field_prop.ipynb
Richard Stiskalek 9e4b34f579
Overlap fixing and more (#107)
* Update README

* Update density field reader

* Update name of SDSSxALFAFA

* Fix quick bug

* Add little fixes

* Update README

* Put back fit_init

* Add paths to initial snapshots

* Add export

* Remove some choices

* Edit README

* Add Jens' comments

* Organize imports

* Rename snapshot

* Add additional print statement

* Add paths to initial snapshots

* Add masses to the initial files

* Add normalization

* Edit README

* Update README

* Fix bug in CSiBORG1 so that does not read fof_00001

* Edit README

* Edit README

* Overwrite comments

* Add paths to init lag

* Fix Quijote path

* Add lagpatch

* Edit submits

* Update README

* Fix numpy int problem

* Update README

* Add a flag to keep the snapshots open when fitting

* Add a flag to keep snapshots open

* Comment out some path issue

* Keep snapshots open

* Access directly snasphot

* Add lagpatch for CSiBORG2

* Add treatment of x-z coordinates flipping

* Add radial velocity field loader

* Update README

* Add lagpatch to Quijote

* Fix typo

* Add setter

* Fix typo

* Update README

* Add output halo cat as ASCII

* Add import

* Add halo plot

* Update README

* Add evaluating field at radial distanfe

* Add field shell evaluation

* Add enclosed mass computation

* Add BORG2 import

* Add BORG boxsize

* Add BORG paths

* Edit run

* Add BORG2 overdensity field

* Add bulk flow clauclation

* Update README

* Add new plots

* Add nbs

* Edit paper

* Update plotting

* Fix overlap paths to contain simname

* Add normalization of positions

* Add default paths to CSiBORG1

* Add overlap path simname

* Fix little things

* Add CSiBORG2 catalogue

* Update README

* Add import

* Add TNG density field constructor

* Add TNG density

* Add draft of calculating BORG ACL

* Fix bug

* Add ACL of enclosed density

* Add nmean acl

* Add galaxy bias calculation

* Add BORG acl notebook

* Add enclosed mass calculation

* Add TNG300-1 dir

* Add TNG300 and BORG1 dir

* Update nb
2024-01-30 16:14:07 +00:00

186 lines
4.8 KiB
Text

{
"cells": [
{
"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.stats import spearmanr\n",
"\n",
"import csiborgtools\n",
"\n",
"%matplotlib inline\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"paths = csiborgtools.read.Paths(**csiborgtools.paths_glamdring)\n",
"\n",
"# d = np.load(paths.field_interpolated(\"SDSS\", \"csiborg2_main\", 16817, \"density\", \"SPH\", 1024))"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"survey = csiborgtools.SDSS()(apply_selection=False)\n",
"# survey = csiborgtools.SDSSxALFALFA()(apply_selection=False)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Reading fields: 0%| | 0/20 [00:00<?, ?it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Reading fields: 100%|██████████| 20/20 [00:11<00:00, 1.80it/s]\n",
"Reading fields: 100%|██████████| 20/20 [00:10<00:00, 1.86it/s]\n"
]
}
],
"source": [
"for kind in [\"main\", \"random\"]:\n",
" x, smooth = csiborgtools.summary.read_interpolated_field(survey, f\"csiborg2_{kind}\", \"density\", \"SPH\", 1024, paths)\n",
" np .savez(f\"../data/{survey.name}_{kind}_density_SPH_1024.npz\", val=x, smooth_scales=smooth)\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(20, 641409, 5)"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]],\n",
"\n",
" [[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]],\n",
"\n",
" [[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]],\n",
"\n",
" ...,\n",
"\n",
" [[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]],\n",
"\n",
" [[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]],\n",
"\n",
" [[nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" ...,\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan],\n",
" [nan, nan, nan, nan, nan]]], dtype=float32)"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.load(\"../data/SDSS_main_density_SPH_1024.npz\")[\"val\"]"
]
},
{
"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
}