qlroms.utils.paths
Path registry: one place to name directories, including ones OUTSIDE data_dir().
The defaults below all live under data_dir() ($QLROM_DATA or ~/.cache/qlrom).
Machine-specific locations (cluster mounts, external drives, other repos) go in
paths_local.py next to this file -- plain module-level constants that extend or
override the defaults:
# qlroms/utils/paths_local.py (gitignored, never committed or distributed)
from pathlib import Path
PINBALL_MESHES = Path("/somewhere/pinball/meshes")
Usage:
from qlroms.utils import paths
paths.PINBALL_MESHES # local override if defined, default otherwise
paths.defined() # everything registered, name -> Path
paths_local.py is gitignored and releases are built by CI from the git tag, so personal paths never reach GitHub or PyPI.
data_dir()
Cache root for self-generated trajectories/models: $QLROM_DATA or ~/.cache/qlrom.
Source code in qlroms/utils/paths.py
28 29 30 | |
models_dir(family)
Where trained models are saved:
Source code in qlroms/utils/paths.py
49 50 51 52 53 54 55 56 57 58 59 | |
defined()
All registered paths (defaults + local overrides), name -> Path.
Source code in qlroms/utils/paths.py
62 63 64 65 | |
mmap_npz(path, mirror_root)
Dict of memory-mapped arrays for path, unpacked once under
mirror_root/<stem>/ (one .npy per key); later calls only stat the source.
The stamp carries the source's size and mtime, so rebuilding the npz
refreshes the mirror by itself.
Source code in qlroms/utils/paths.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |