def plot_tilted_landscape(LandscapeObj,min_landscape_kT=None, fmt_f_label="{:.0f}", max_landscape_kT=None,f_one_half_N=10e-12,**kwargs): Obj = IWT_Util.TiltedLandscape(LandscapeObj,f_one_half_N=f_one_half_N, **kwargs) Obj.OffsetTilted_kT -= min(Obj.OffsetTilted_kT) plt.plot(Obj.landscape_ext_nm,Obj.OffsetTilted_kT,color='b',alpha=0.7) if (max_landscape_kT is None): max_landscape_kT = max(Obj.OffsetTilted_kT)*1.5 if (min_landscape_kT is None): min_landscape_kT = np.percentile(Obj.OffsetTilted_kT,5)-2 plt.ylim( min_landscape_kT,max_landscape_kT) ylabel = ("Tilted (F=" + fmt_f_label + "pN) [kT]").format(f_one_half_N*1e12) PlotUtilities.lazyLabel("Extension [nm]",ylabel,"",frameon=True) return format_kcal_per_mol_second_axis_after_kT_axis()
def plot_free_landscape(LandscapeObj,**kwargs): """ plots a free landscape version extension Args: LandscapeObj: see plot_single_landscape kwargs: passed to TiltedLandscape Returns: tilted landscape """ Obj = IWT_Util.TiltedLandscape(LandscapeObj,**kwargs) plt.plot(Obj.landscape_ext_nm,Obj.Landscape_kT) range = max(Obj.Landscape_kT) - min(Obj.Landscape_kT) fudge = range/10 plt.ylim([-fudge,np.max(Obj.Landscape_kT)+fudge]) PlotUtilities.lazyLabel("","Landscape at F=0 [kT]","",frameon=True) format_kcal_per_mol_second_axis_after_kT_axis() return Obj
def run(): """ <Description> Args: param1: This is the first param. Returns: This is a description of what is returned. """ # run a comparison of fwd,rev,both base = "../Data/" plot_both = dict(color='b', linestyle='--', label="Bi-directional") plot_unfold = dict(color='m', linestyle=':', label="Only unfold") plot_refold = dict(color='r', linestyle='-', label="Only refold") input_files = [ [base + "UnfoldandRefold.pxp", "", plot_both], [base + "JustUnfold.pxp", "-unfold_only 1", plot_unfold], [base + "JustRefold.pxp", "-refold_only 1", plot_refold], ] fig = PlotUtilities.figure(figsize=(3.5, 6)) f_one_half_N = 12e-12 for f, extra_str, plot_opt in input_files: # run just the 'normal' IO x_nm, G_kT, tilt = run_single(n_pairs=50, v=50e-9, f_one_half=f_one_half_N, input_file=f, extra_str=extra_str) # save out the data header = "# (C) PRH \n #Extension (nm),\t G (kT), \t G_tilt (kT)" fname = f.split("/")[-1] + ".csv" np.savetxt(X=np.array((x_nm, G_kT, tilt)).T, fname=fname, header=header, delimiter=",") ax1 = plt.subplot(2, 1, 1) plt.plot(x_nm, G_kT, **plot_opt) label_y = ("$G_0$ ($k_\mathrm{B}$T)") PlotUtilities.lazyLabel("", label_y, "") PlotUtilities.no_x_label(ax=ax1) plt.subplot(2, 1, 2) plt.plot(x_nm, tilt, **plot_opt) label_y = ("$G_\mathrm{F_{1/2}=" + "{:.0f}".format(f_one_half_N*1e12) +\ "pN}$ ($k_\mathrm{B}$T)") PlotUtilities.lazyLabel("x (nm)", label_y, "") PlotUtilities.savefig(fig, "example_unfold_refold.png") # run just the 'normal' IO x_nm,G_kT,tilt = \ run_single(n_pairs=16,v=20e-9,input_file="../Data/input.pxp") fig = PlotUtilities.figure() plt.plot(x_nm, G_kT, 'r-') PlotUtilities.lazyLabel("x (nm)", "$G_0$ ($k_\mathrm{B}$T)", "") PlotUtilities.savefig(fig, "example_bidirectional.png")