Download code/tools/compare_pheno.py from bryan7264/lorapop: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/tools/compare_pheno.py
- Command line
-
hf download hf://datasets/bryan7264/lorapop/code/tools/compare_pheno.py
-
curl -L -o compare_pheno.py https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/tools/compare_pheno.py
920 Bytes
| # MIT License, Bryan Cheng, 2026. Compare trait values of two phenotype directories (single vs bank mode). | |
| import glob, json, os, sys | |
| import numpy as np | |
| a_dir, b_dir = sys.argv[1], sys.argv[2] | |
| diffs = {} | |
| for f in sorted(glob.glob(os.path.join(a_dir, "*.json"))): | |
| g = os.path.join(b_dir, os.path.basename(f)) | |
| if not os.path.exists(g): | |
| continue | |
| a, b = json.load(open(f)), json.load(open(g)) | |
| if a.get("status") != "ok" or b.get("status") != "ok": | |
| print("status", os.path.basename(f)[:40], a.get("status"), b.get("status"), a.get("error", "")[:100]) | |
| continue | |
| for t, v in a["traits"].items(): | |
| diffs.setdefault(t, []).append(abs(v[0] - b["traits"][t][0])) | |
| for t in sorted(diffs): | |
| print(f"{t:45s} max|diff| {max(diffs[t]):.4f}") | |
| print("seconds per adapter:", [round(json.load(open(f)).get("seconds", 0), 1) for f in sorted(glob.glob(os.path.join(b_dir, "*.json")))][:9]) | |