| from pathlib import Path | |
| import sys,numpy as np;import matplotlib;matplotlib.use('Agg');import matplotlib.pyplot as plt | |
| R=Path(__file__).resolve().parents[1];sys.path.insert(0,str(R));from model.grace_seda import cfg,write | |
| c=cfg(R);d=np.load(R/c['paths']['predictions']);p=d['mean'];g=d['grace'];w=d['wghm'];corr=float(np.corrcoef(p.ravel(),w.ravel())[0,1]);aggregate=float(abs(p.mean((1,2))-g.mean((1,2))).mean());unc=float(d['uncertainty'].mean());write(R/c['paths']['evaluation'],{'wghm_correlation':corr,'grace_aggregate_error':aggregate,'mean_uncertainty':unc,'synthetic':True});plt.imshow(p[0]-w[0],cmap='coolwarm');plt.colorbar();q=R/c['paths']['figure'];q.parent.mkdir(parents=True,exist_ok=True);plt.savefig(q,dpi=150);print(q) | |