Download hmc/reference/scripts/pack_epic_scripts.py from neurodeskorg/webapps: direct link, hf CLI and curl.
- Browser
- Download file 803 Bytes
-
https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/pack_epic_scripts.py
- Command line
-
hf download hf://datasets/neurodeskorg/webapps/hmc/reference/scripts/pack_epic_scripts.py
-
curl -L -o pack_epic_scripts.py https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/pack_epic_scripts.py
803 Bytes
| """Add the epic QSIPrep scripts to the packed folder and to its index.json. | |
| Usage: python -I pack_epic_scripts.py OUT_DIR | |
| """ | |
| import hashlib | |
| import json | |
| import shutil | |
| import sys | |
| from pathlib import Path | |
| SRC = Path("/var/tmp/dwi-hmc/scripts/epic") | |
| NAMES = ("run-qsiprep.sh", "launch.sh", "pull-qsiprep.sh", "file_list.py") | |
| out = Path(sys.argv[1]) | |
| idx_path = out / "index.json" | |
| index = json.loads(idx_path.read_text()) | |
| for name in NAMES: | |
| src = SRC / name | |
| dst = out / "scripts/epic" / name | |
| dst.parent.mkdir(parents=True, exist_ok=True) | |
| shutil.copy2(src, dst) | |
| index["files"][str(dst.relative_to(out))] = { | |
| "source": str(src), | |
| "source_sha256": hashlib.sha256(src.read_bytes()).hexdigest(), | |
| } | |
| idx_path.write_text(json.dumps(index, indent=1, sort_keys=True) + "\n") | |