def wrapup(): """Summarize results once all are done.""" import matplotlib as mpl import matplotlib.pyplot as plt mpl.use("agg") gt = np.load("gt.npy") agg = np.load("agg.npy") summarize(gt, agg) plt.savefig("summary.png")
def hdfcaching(): """Auto-cache/save results to HDF.""" import os import tables as pt from cgp.utils.hdfcache import Hdfcache filename = "/home/jonvi/hdfcache.h5" hdfcache = Hdfcache(filename) pipeline = [hdfcache.cache(i) for i in gt2par, par2ph, ph2agg] with hdfcache: for i in genotypes: for func in pipeline: i = func(i) with pt.openFile(filename) as f: gt = f.root.gt2par.input[:] agg = f.root.ph2agg.output[:] summarize(gt, agg) os.system("h5ls -r " + filename)