def fix_axes(ax_list): # loop through all the axes and toss them. xlims = get_ranges(ax_list, get_x=True) ylims = get_ranges(ax_list, get_x=False) for i, axs in enumerate(ax_list): for j, ax in enumerate(axs): if (i > 0): # columns after the first lose their labels PlotUtilities.no_y_label(ax) PlotUtilities.ylabel("", ax=ax) ax.set_ylim(ylims[j]) if (j != 0): PlotUtilities.no_x_label(ax) PlotUtilities.xlabel("", ax=ax)
def _plot_fmt(ax, xlim, ylim, is_bottom=False, color=False, is_left=True, ylabel="$F$ (pN)", xlabel="Extension (nm)"): PlotUtilities.tickAxisFont(ax=ax) ax.set_xlim(xlim) ax.set_ylim(ylim) PlotUtilities.title("", ax=ax) PlotUtilities.ylabel(ylabel, ax=ax) PlotUtilities.xlabel(xlabel, ax=ax) if (not is_bottom): PlotUtilities.no_x_label(ax=ax) PlotUtilities.xlabel("", ax=ax) if (not is_left): PlotUtilities.no_y_label(ax=ax) PlotUtilities.ylabel("", ax=ax) if color: color_kw = dict(ax=ax, color='w', label_color='k') PlotUtilities.color_x(**color_kw) PlotUtilities.color_y(**color_kw)
def run(): """ <Description> Args: param1: This is the first param. Returns: This is a description of what is returned. """ default_base = "../../../Data/170321FEC/" base_dir = Pipeline._base_dir_from_cmd(default=default_base) step = Pipeline.Step.POLISH in_dir = Pipeline._cache_dir(base=base_dir, enum=Pipeline.Step.ALIGNED) out_dir = Pipeline._cache_dir(base=base_dir,enum=step) plot_dir = Pipeline._plot_subdir(base=base_dir, enum=step) force = True limit = None functor = lambda : polish_data(in_dir) data =CheckpointUtilities.multi_load(cache_dir=out_dir,load_func=functor, force=force, limit=limit, name_func=FEC_Util.fec_name_func) sizes = [d.Force.size for d in data] min_s = min(sizes) sliced_data = [d._slice(slice(0,min_s,1)) for d in data] for d in sliced_data: d.Offset = d.ZSnsr[0] d.Extension = d.Separation d.kT = 4.1e-21 data_wham = UtilWHAM.to_wham_input(objs=sliced_data, n_ext_bins=75) data_wham.z = np.array([d.ZSnsr for d in sliced_data]) obj_wham = WeightedHistogram.wham(data_wham) data_unpolished = CheckpointUtilities.lazy_multi_load(in_dir) f_x_zsnsr = lambda x: x.ZSnsr xlim = [-40,150] ProcessingUtil.heatmap_ensemble_plot(data,out_name=plot_dir + "heatmap.png", xlim=xlim) ProcessingUtil.heatmap_ensemble_plot(data,f_x=f_x_zsnsr, out_name=plot_dir + "heatmap_Z.png", kw_map=dict(x_func=f_x_zsnsr), xlim=xlim) # plot each individual f_x = lambda x_tmp : x_tmp.Separation plot_subdir = Pipeline._plot_subdir(base_dir, step) name_func = FEC_Util.fec_name_func _, ylim = ProcessingUtil.nm_and_pN_limits(data,f_x) for i,(d_unpolish,d_polish) in enumerate(zip(data_unpolished,data)): kw_plot = dict(d_unpolish=d_unpolish, d_polish=d_polish, xlim=xlim,ylim=ylim,i=i) fig = PlotUtilities.figure((6,6)) # make the Separation column ax1,ax2 = plt.subplot(2,2,1), plt.subplot(2,2,3) polish_plot(ax1, ax2, f_x = lambda x: x.Separation, plot_components_1=True,**kw_plot) # make the ZSnsr column ax3,ax4 = plt.subplot(2,2,2), plt.subplot(2,2,4) polish_plot(ax3, ax4, f_x = lambda x: x.ZSnsr,plot_components_1=False, **kw_plot) PlotUtilities.xlabel("Stage Position (nm)", ax=ax4) for a in [ax3,ax4]: PlotUtilities.no_y_label(ax=a) PlotUtilities.ylabel("",ax=a) name = plot_subdir + name_func(0, d_polish) + ".png" PlotUtilities.savefig(fig,name)