wizard-precoded / ww_index /scripts /ww_offset_perwin.py
yuzhewu207's picture
ww_index: window list, captions, lags and scripts to rebuild the WildWorld windows from upstream
a54e6a7 verified
Raw History Blame Contribute Delete
892 Bytes
"""Per-window lag estimates for whole sessions: python ww_offset_perwin.py <sid>[,<sid>...] -> ww_offset_perwin.log"""
import glob, json, sys
sys.argv_saved = list(sys.argv); sys.argv = ["x", "0", "1", "none"]
exec(open("/data/yuzhewu/datasets/wildworld/ww_offset_est.py").read().split('if __name__ == "__main__":')[0])
out = {}
for sid in sys.argv_saved[1].split(","):
wins = sorted(Path(f).parent.name for f in glob.glob(str(ROOT / "windows_121" / f"{sid}_*/meta.json")))
print(sid, len(wins), "windows", flush=True)
for w in wins:
r = estimate(sid, [w]); out[w] = r
print(f" t0={int(w.rsplit('_', 1)[1]):6d} best_s {r.get('best_s'):>4} median_s {r.get('median_s'):>4} per-frame {r.get('per_frame_best')} peaks {r.get('per_frame_peak')}", flush=True)
json.dump(out, open(ROOT / "ww_offset_perwin.json", "w"), indent=1)
print("PERWIN_DONE", flush=True)