File size: 1,768 Bytes
40cf0a4
 
7c6e636
40cf0a4
 
7c6e636
 
 
 
40cf0a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c6e636
 
40cf0a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Where the released files live, so every script agrees on one layout.

    DATA_DIR   the dataset repository checkout   (default: this file's parent's parent)
    MODEL_DIR  the model repository checkout     (default: DATA_DIR)

The default puts DATA_DIR one level above the directory holding these scripts,
which is the repository root in the published layout and the data directory in
the original working tree — so the same scripts run in both places unset.

The layout mirrors the published repositories:

    DATA_DIR/graph.duckdb                       built by bootstrap.py
    DATA_DIR/data/...                           released source files
    DATA_DIR/graph/edge_ML_expected_ge5_pyg.pt  released graph; rebuilt in place
    DATA_DIR/figures/...                        figures and the UMAP coordinate cache
    MODEL_DIR/edge_ML_expected_ge5_n2v.pt       released embeddings

build_graph.py writes the graph back to its released path, so every downstream
script reads the same file whether you downloaded it or rebuilt it.
"""

import os
import pathlib

_DEFAULT = pathlib.Path(__file__).resolve().parent.parent
DATA_DIR = pathlib.Path(os.environ.get("DATA_DIR", str(_DEFAULT)))
MODEL_DIR = pathlib.Path(os.environ.get("MODEL_DIR", str(DATA_DIR)))

GRAPH_DIR = DATA_DIR / "graph"
FIGURES_DIR = DATA_DIR / "figures"
for _d in (GRAPH_DIR, FIGURES_DIR):
    _d.mkdir(parents=True, exist_ok=True)

DB_PATH = str(DATA_DIR / "graph.duckdb")
GRAPH_PATH = str(GRAPH_DIR / "edge_ML_expected_ge5_pyg.pt")
EMB_PATH = str(MODEL_DIR / "edge_ML_expected_ge5_n2v.pt")
UMAP_NPY_PATH = str(FIGURES_DIR / "umap_coords.npy")


def figure_path(mode: str) -> str:
    """Released figure name for 'light' or 'dark'."""
    return str(FIGURES_DIR / f"umap_species_{mode}.png")