-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_edge_mmse.py
More file actions
28 lines (21 loc) · 811 Bytes
/
Copy pathplot_edge_mmse.py
File metadata and controls
28 lines (21 loc) · 811 Bytes
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
import pandas as pd
import matplotlib.pyplot as plt
from pathlib import Path
IN_FILE = Path("/auto/home/users/v/l/vlahy/test/corr_mmse_dmn_edges/dmn_edges_subject_level.csv")
OUT_DIR = Path("/auto/home/users/v/l/vlahy/test/corr_mmse_dmn_edges/plots")
OUT_DIR.mkdir(exist_ok=True)
# to modify with the right edge
i, j = 23, 66
df = pd.read_csv(IN_FILE)
g = df[(df["i"] == i) & (df["j"] == j) & (df["weight"] > 0)].copy()
r = g["weight"].corr(g["MMSE"], method="spearman")
print("N =", len(g), "Spearman r =", r)
plt.figure()
plt.scatter(g["MMSE"], g["weight"])
plt.xlabel("MMSE")
plt.ylabel(f"Edge weight ({i}-{j})")
plt.title(f"Edge {i}-{j} vs MMSE (Spearman r={r:.3f}, N={len(g)})")
plt.tight_layout()
plt.savefig(OUT_DIR / f"edge_{i}_{j}_MMSE.png", dpi=200)
plt.close()
print("Saved plot to:", OUT_DIR)