csiborgtools/notebooks/test_mmain.ipynb
Richard Stiskalek fdb0df8d4c
Add mmain and other major updates (#44)
* Move paths to a separate file

* Add mmain reader

* Add a verbosity flag

* Fix imports

* Fix bug

* Rename files

* Return ultimate parents

* Add script to generate mmain

* Remove mmain path

* edit path

* Add mmain path

* Change function name

* Rename function

* Turn off verbose

* Fix list requirement

* Edit init match paths

* Fix init pathing

* Edit paths docs

* Edit dumpdir name

* Rename path

* Fix split paths

* Remove unused import

* Add comment

* Update readme

* remove read mmain

* Rename haloatalogue

* Fix minor bugs

* Update nbs

* Add create directory option

* Move split jobs

* Move spliot jobs

* Remove splitting

* Add import

* Edit script

* Deeper split folder

* Fix paths bug

* Rename catalogue

* Rename Catalogue

* Add new clumpread

* Edit paths

* add knn paths

* Update commenting

* Update imports

* Add more conversions

* Update temp file

* Add a note

* Add catalogue

* Cooment

* Update TODO

* Update script

* add nb

* Update

* pep8

* edit paths & pep8

* Fix knn auto paths

* add paths docs

* Add auto and cross knn paths

* Add new paths

* Simplify tpcf reading

* pep8 patch

* update readme

* Update progress

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* pep8

* Pep 8 and restructure

* add lambda spin

* add clump and halo

* add checks

* Edit halo profile fit

* Update gitignore

* backup script
2023-04-18 11:02:36 +02:00

323 lines
6.0 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "5a38ed25",
"metadata": {
"ExecuteTime": {
"end_time": "2022-12-31T17:12:28.663839Z",
"start_time": "2022-12-31T17:12:25.134607Z"
}
},
"outputs": [],
"source": [
"import sys\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import joblib\n",
"import scienceplots\n",
"sys.path.append(\"../\")\n",
"import csiborgtools\n",
"\n",
"plt.style.use([\"science\", \"notebook\"])\n",
"%matplotlib widget\n",
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "22130d0b",
"metadata": {},
"outputs": [],
"source": [
"d = np.load(\"/mnt/extraspace/rstiskalek/csiborg/split/clumps_07444_00951.npz\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "4d9d9d11",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"772 µs ± 4.01 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n"
]
}
],
"source": [
"%timeit d[\"232\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "66f32cef",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8a24c0fa",
"metadata": {},
"outputs": [],
"source": [
"paths = csiborgtools.read.CSiBORGPaths(**csiborgtools.paths_glamdring)\n",
"# cat = csiborgtools.read.ClumpsCatalogue(7444, paths)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6e3ba9f4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/mnt/extraspace/rstiskalek/csiborg/knn/auto/knncdf_07444_la.npz'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"paths.knn_path(7444, \"auto\", \"la\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "2f4793b9",
"metadata": {},
"outputs": [],
"source": [
"np.savez(\"test.npz\", a=np.random.rand(510, 510, 510), b=np.random.rand(510, 510, 510))"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "041d80d8",
"metadata": {},
"outputs": [],
"source": [
"d = np.load(\"test.npz\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "dc320130",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['a', 'b']"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.files"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "11231e20",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['a', 'b']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.files"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0b6d02f8",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 26,
"id": "4ae2a2a8",
"metadata": {},
"outputs": [],
"source": [
"np.save(\"test.npy\", np.array([]))"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "b675510f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([], dtype=float64)"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"np.load(\"test.npy\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6f8f96b7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4b63c20",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 21,
"id": "1cdcf448",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/mnt/extraspace/rstiskalek/csiborg/split/ic_00952/out_07444_123.npz'"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# paths.split_path(123, 7444, 952)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d07431f5",
"metadata": {},
"outputs": [],
"source": [
"nsim = 7444\n",
"nsnap = max(paths.get_snapshots(7444))\n",
"reader = csiborgtools.read.ParticleReader(paths)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "def3c21f",
"metadata": {},
"outputs": [],
"source": [
"\n",
"# clumpind = reader.read_clumps(nsnap, nsim, cols=\"index\")[\"index\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "832e82ce",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "aa69261b",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"id": "105dd2e2",
"metadata": {},
"outputs": [],
"source": [
"parts = np.load(\"/mnt/extraspace/rstiskalek/csiborg/initmatch/clump_7468_particles.npy\", allow_pickle=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c49f174b",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "38e9490d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv_galomatch",
"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"
}
},
"nbformat": 4,
"nbformat_minor": 5
}