def run(): """ <Description> Args: param1: This is the first param. Returns: This is a description of what is returned. """ base_dir = "../../../../Data/FECs180307/" read_f = FigureUtil.read_sample_landscapes gallery = CheckpointUtilities.getCheckpoint("./caches.pkl", read_f,False,base_dir) lab_plot = [ ["BR-PEG3400",gallery.PEG3400], ["BO-PEG3400",gallery.BO_PEG3400] ] fig = PlotUtilities.figure(figsize=(4,6)) gs = gridspec.GridSpec(ncols=1,nrows=2,height_ratios=[3,1]) gs_pipeline= gridspec.GridSpecFromSubplotSpec(ncols=2,nrows=3,hspace=0.03, subplot_spec=gs[0,:]) colors = ['r','rebeccapurple'] xlim,_,ylm_W = xlim_ylim() mean_works_info = [] for i,(label,to_use) in enumerate(lab_plot): pipeline = FigureUtil._alignment_pipeline(to_use) fecs = pipeline.blacklisted.fec_list # calculate all the works x_arr = [f.Separation for f in fecs] f_arr = [f.Force for f in fecs] works = _calculate_work(x_arr,f_arr) works_kcal = np.array(works) * kcal_per_mol_per_J() c = colors[i] _make_work_plot(fecs, x_arr, works_kcal,gs_pipeline,col=i,color=c, title=label) x_interp, mean_W, std_W= _mean_work(x_arr,works_kcal) plt.subplot(gs[-1, :]) _plot_mean_works(x_interp, mean_W, std_W, color=c, title=label) plt.xlim(xlim) plt.ylim(ylm_W) PlotUtilities.lazyLabel("Extension (nm)" , "$W$ (kcal/mol)","", useLegend=False) PlotUtilities.savefig(fig, "FigureS_Work.png".format(label))
def _make_plots(galleries_labels): alignments = [ FigureUtil._alignment_pipeline(gallery_tmp[0]) for gallery_tmp in galleries_labels ] for i, (_, label) in enumerate(galleries_labels): # make the standard aligning plot alignment = alignments[i] _make_algned_plot(alignment, label) # plot the final curves on the same plot xlim, ylim = FigureUtil._limits(alignment._all_fecs) colors = ['rebeccapurple', 'g'] fig = PlotUtilities.figure((5, 3)) gs = gridspec.GridSpec(2, 2) # reverse everything, so PEG600 is on top galleries_labels = galleries_labels[::-1] alignments = alignments[::-1] for i, (_, l) in enumerate(galleries_labels): ax = plt.subplot(gs[i, 0]) a = alignments[i] FigureUtil._plot_fec_list(a.blacklisted.fec_list, xlim, ylim, label=l, color=colors[i]) if (i == 0): PlotUtilities.no_x_label(ax) PlotUtilities.xlabel("", ax=ax) # plot them both on the last column plt.subplot(gs[:, 1]) kw = [dict(), dict(linewidth=0.6)] for i, (_, l) in enumerate(galleries_labels): a = alignments[i] FigureUtil._plot_fec_list(a.blacklisted.fec_list, xlim, ylim, label=l, color=colors[i], **kw[i]) PlotUtilities.savefig(fig, "FigureS_3400vs600.png")