Download hmc/reference/scripts/epic/file_list.py from neurodeskorg/webapps: direct link, hf CLI and curl.
- Browser
- Download file 943 Bytes
-
https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/epic/file_list.py
- Command line
-
hf download hf://datasets/neurodeskorg/webapps/hmc/reference/scripts/epic/file_list.py
-
curl -L -o file_list.py https://huggingface.co/datasets/neurodeskorg/webapps/resolve/main/hmc/reference/scripts/epic/file_list.py
943 Bytes
| """List the files of one QSIPrep run that the M0 package needs, relative to the run dir. | |
| Usage: python -I file_list.py RUN_DIR > list.txt | |
| """ | |
| import json | |
| import sys | |
| from pathlib import Path | |
| run = Path(sys.argv[1]).resolve() | |
| paths = set() | |
| def walk(node): | |
| if isinstance(node, dict): | |
| for k, v in node.items(): | |
| if k == "path" and isinstance(v, str): | |
| paths.add(Path(v)) | |
| else: | |
| walk(v) | |
| elif isinstance(node, list): | |
| for v in node: | |
| walk(v) | |
| walk(json.loads((run / "collected/manifest.json").read_text())) | |
| for top in ("collected", "out"): | |
| paths.update(p for p in (run / top).rglob("*") if p.is_file()) | |
| for name in ("command.txt", "timing.txt", "qsiprep.log"): | |
| paths.add(run / name) | |
| paths.update(run.glob("work/*/config.toml")) | |
| for p in sorted(paths): | |
| p = p if p.is_absolute() else run / p | |
| if p.is_file(): | |
| print(p.relative_to(run)) | |