csiborgtools/notebooks/test_mmain.ipynb

323 lines
6 KiB
Text
Raw Normal View History

{
"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
}