Created
March 1, 2024 01:00
-
-
Save andyfaff/786682afeba01eea378ed1ba8d7c703c to your computer and use it in GitHub Desktop.
Run locator for PLP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "03e65d2e-7210-4188-a819-b8a68f1b5f29", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import os\n", | |
"import glob" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "0fc8e094-82fd-4565-aec7-db1fca31db67", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def catalogue_cycle():\n", | |
" nxs = dict()\n", | |
"\n", | |
" for i in range(1, 1000):\n", | |
" pth = f\"Z:\\\\cycle\\\\{i:03d}\\\\data\\\\sics\"\n", | |
" files = glob.glob(\"*.nx.hdf\", root_dir=pth)\n", | |
" if not len(files):\n", | |
" continue\n", | |
" nxs[pth] = files\n", | |
" return nxs\n", | |
"\n", | |
"\n", | |
"def cycle_from_numor(numor, nxs=None):\n", | |
" if nxs is None:\n", | |
" nxs = catalogue_cycle()\n", | |
" for k, v in nxs.items():\n", | |
" if f\"PLP{numor:07d}.nx.hdf\" in v:\n", | |
" return k" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "9d96d1b9-9b22-48b3-9a49-8e53e4ccdd98", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"nxs = catalogue_cycle()\n", | |
"cycle_from_numor(64000)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "3f292ca2-5649-43e9-8383-3099909843d6", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"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.12.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment