当前位置: 首页>>代码示例>>Python>>正文


Python PlotUtilities.title方法代码示例

本文整理汇总了Python中GeneralUtil.python.PlotUtilities.title方法的典型用法代码示例。如果您正苦于以下问题:Python PlotUtilities.title方法的具体用法?Python PlotUtilities.title怎么用?Python PlotUtilities.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeneralUtil.python.PlotUtilities的用法示例。


在下文中一共展示了PlotUtilities.title方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    Base = "./"
    OutBase = Base + "out/"
    InFiles = [Base + "PatrickIsGreedy.pxp"]
    RawData = IWT_Util.\
              ReadInAllFiles(InFiles,Limit=50,
                             ValidFunc=PxpLoader.valid_fec_allow_endings)
    # get the start/ends of the re-folding and unfolding portions
    # hard coded constant for now...
    # XXX for re-folding, need to add in schedule
    # XXX ensure properly zeroed?
    idx_end_of_unfolding = int(16100/2)
    IwtData,IwtData_fold = split(RawData,idx_end_of_unfolding)
    # get the titled landscape...
    all_landscape = [-np.inf,np.inf]
    Bounds = IWT_Util.BoundsObj(bounds_folded_nm= all_landscape,
                                bounds_transition_nm= all_landscape,
                                bounds_unfolded_nm=all_landscape,
                                force_one_half_N=15e-12)
    OutBase = "./out/"
    # get the unfolding histograms
    forces_unfold = np.concatenate([r.Force for r in IwtData])
    separations_unfold = np.concatenate([r.Extension for r in IwtData])
    # get the folding histograms..
    forces_fold = np.concatenate([r.Force for r in IwtData_fold])
    separations_fold = np.concatenate([r.Extension for r in IwtData_fold])
    # zero everything...
    n_bins = 80
    fig = PlotUtilities.figure(figsize=(12,16))
    kwargs_histogram = dict(AddAverage=False,nBins=n_bins)
    plt.subplot(2,1,1)
    IWT_Util.ForceExtensionHistograms(separations_unfold*1e9,
                                      forces_unfold*1e12,**kwargs_histogram)
    PlotUtilities.xlabel("")
    PlotUtilities.title("*Unfolding* 2-D histogram")
    plt.subplot(2,1,2)
    IWT_Util.ForceExtensionHistograms(separations_fold*1e9,
                                      forces_fold*1e12,**kwargs_histogram)
    PlotUtilities.title("*Folding* 2-D histogram")
    PlotUtilities.savefig(fig,OutBase + "0_{:d}hist.pdf".format(n_bins))
    IWT_Plot.InTheWeedsPlot(OutBase=OutBase,
                            UnfoldObj=IwtData,
                            bounds=Bounds,Bins=[40,60,80,120,200],
                            max_landscape_kT=None,
                            min_landscape_kT=None)
开发者ID:prheenan,项目名称:Research,代码行数:56,代码来源:Main_alpha3d_iwt.py

示例2: helical_gallery_plot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def helical_gallery_plot(helical_areas,helical_data,helical_kwargs):
    axs,first_axs,second_axs = [],[],[]
    offset_y = 0.2
    kw_scalebars = [dict(offset_x=0.35,offset_y=offset_y),
                    dict(offset_x=0.35,offset_y=offset_y),
                    dict(offset_x=0.35,offset_y=offset_y)]
    xlims = [ [None,None],[None,None],[None,15]    ]   
    arrow_x = [0.60,0.62,0.55]
    arrow_y = [0.58,0.60,0.45]
    for i,a in enumerate(helical_areas):
        data = helical_data[i]
        kw_tmp = helical_kwargs[i]
        data_landscape = landscape_data(data.landscape)
        # # plot the energy landscape...
        ax_tmp = plt.subplot(1,len(helical_areas),(i+1))
        axs.append(ax_tmp)
        kw_landscape = kw_tmp['kw_landscape']
        color = kw_landscape['color']      
        ax_1, ax_2 = plot_landscape(data_landscape,xlim=xlims[i],
                                    kw_landscape=kw_landscape,
                                    plot_derivative=True)
        first_axs.append(ax_1)                                 
        second_axs.append(ax_2)                    
        PlotUtilities.tom_ticks(ax=ax_2,num_major=5,change_x=False)       
        last_idx = len(helical_areas)-1
        ax_1.annotate("",xytext=(arrow_x[i],arrow_y[i]),textcoords='axes fraction',
                      xy=(arrow_x[i]+0.2,arrow_y[i]),xycoords='axes fraction',
                      arrowprops=dict(facecolor=color,alpha=0.7,
                                      edgecolor="None",width=4,headwidth=10,
                                      headlength=5))
        if (i > 0):
            PlotUtilities.ylabel("")
            PlotUtilities.xlabel("")
        if (i != last_idx):
            ax_2.set_ylabel("")
            PlotUtilities.no_x_label(ax_1)
            PlotUtilities.no_x_label(ax_2)            
        PlotUtilities.title(a.plot_title,color=color)
    normalize_and_set_zeros(first_axs,second_axs)
    # after normalization, add in the scale bars 
    for i,(ax_1,ax_2) in enumerate(zip(first_axs,second_axs)):
        Scalebar.x_scale_bar_and_ticks_relative(unit="nm",width=5,ax=ax_2,
                                                **kw_scalebars[i])
        PlotUtilities.no_x_label(ax_2)     
开发者ID:prheenan,项目名称:Research,代码行数:46,代码来源:main_landscapes.py

示例3: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    n_samples = int(1e4)
    sigma = 1
    loc_arr = [-3,-1,0.5]
    n_bins = 50
    ylim = [0,0.6]
    n_cols = 3+1
    xlim = [-12,12]
    bins = np.linspace(*xlim,endpoint=True,num=n_bins)
    fig = PlotUtilities.figure((12,7))
    plt.subplot(1,n_cols,1)
    bhattacharya,x1,x2 = plot_bhattacharya(sigma,n_samples,bins=bins,
                                           loc=-9)
    plt.xlim(xlim)
    PlotUtilities.tickAxisFont()
    PlotUtilities.xlabel("Distribution Value")
    PlotUtilities.ylabel("Probability")
    PlotUtilities.legend(frameon=False)
    plt.ylim(ylim)
    title = p_label(bhattacharya,x1,x2)
    PlotUtilities.title(title)
    for i,loc in enumerate(loc_arr):
        plt.subplot(1,n_cols,(i+2))
        bhattacharya,x1,x2 = plot_bhattacharya(sigma,n_samples,bins,
                                               loc=loc)
        title = p_label(bhattacharya,x1,x2)
        PlotUtilities.title(title)
        plt.xlim(xlim)
        plt.ylim(ylim)
        PlotUtilities.tickAxisFont()
        PlotUtilities.no_y_label()
        PlotUtilities.legend(frameon=False)
        PlotUtilities.xlabel("")
    PlotUtilities.savefig(fig,"bcc.pdf",subplots_adjust=dict(wspace=0.1))
开发者ID:prheenan,项目名称:Research,代码行数:45,代码来源:main_bhattacharya.py

示例4: _main_figure

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def _main_figure(trials):
    xlim = [500,1e6]
    ylim=[1e-2,5e2]
    style_data,style_pred = style_data_and_pred()
    colors = algorithm_colors()
    # picturing 3x2, where we show the 'in the weeds' plots...
    plt.subplot(1,2,1)
    for i,learner_trials in enumerate(trials):
        TimePlot.\
            plot_learner_slope_versus_loading_rate(learner_trials,
                                                   style_data=style_data[i],
                                                   style_pred=style_pred[i])
    PlotUtilities.legend(loc="upper left",frameon=False)
    PlotUtilities.title("")
    plt.xlim(xlim)
    plt.ylim(ylim)
    plt.subplot(1,2,2)
    TimePlot.plot_learner_prediction_time_comparison(trials,color=colors)
    plt.ylim([1e3,3e6])
    PlotUtilities.legend(loc="lower right",frameon=False)
    PlotUtilities.title("")
开发者ID:prheenan,项目名称:Research,代码行数:23,代码来源:main_figure_timing.py

示例5: rupture_plot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def rupture_plot(true,pred,fig,count_ticks=3,
                 scatter_kwargs=None,style_pred=None,
                 style_true=None,use_legend=True,count_limit=None,
                 color_pred=None,color_true=None,
                 bins_load=None,bins_rupture=None,
                 remove_ticks=True,lim_plot_load=None,lim_plot_force=None,
                 title="",distance_histogram=None,gs=None,
                 limit_percentile=True):
    if (distance_histogram is None):
        n_rows = 2
        n_cols = 2
        widths = [2,1]
        heights = [2,1]
        offset=0
    else:
        n_rows = 2
        n_cols = 3
        widths = [2,2,1]
        heights = [2,2]
        offset=1
    if (gs is None):
        gs = gridspec.GridSpec(n_rows,n_cols,width_ratios=widths,
                               height_ratios=heights)
    subplot_f = lambda x: plt.subplot(x)
    ruptures_true,loading_true = \
        Learning.get_rupture_in_pN_and_loading_in_pN_per_s(true)
    ruptures_pred,loading_pred = \
        Learning.get_rupture_in_pN_and_loading_in_pN_per_s(pred)
    if (color_pred is None):
        color_pred = color_pred_def
    if (color_true is None):
        color_true = color_true_def
    if (style_true is None):
        style_true = _style_true(color_true)
    if (style_pred is None):
        style_pred = _style_pred(color_pred)
    if (scatter_kwargs is None):
        scatter_kwargs = dict(style_true=dict(label="true",**style_true),
                              style_predicted=dict(label="predicted",
                                                   **style_pred))
    _lim_force,_bins_rupture,_lim_load,_bins_load = \
        Learning.limits_and_bins_force_and_load(ruptures_pred,ruptures_true,
                                                loading_true,loading_pred,
                                                limit=False)
    _lim_force_plot,_bins_rupture_plot,_lim_load_plot,_bins_load_plot = \
        Learning.limits_and_bins_force_and_load(ruptures_pred,ruptures_true,
                                                loading_true,loading_pred,
                                                limit=limit_percentile)
    if (bins_rupture is None):
        bins_rupture = _bins_rupture_plot
    if (bins_load is None):
        bins_load = _bins_load_plot
    if (lim_plot_load is None):
        lim_plot_load = _lim_load_plot
    if (lim_plot_force is None):
        lim_plot_force = _lim_force_plot
    if (distance_histogram is not None):
        ax_hist = plt.subplot(gs[:,0])
        histogram_event_distribution(**distance_histogram)
    ax0 = subplot_f(gs[0,offset])
    plot_true_and_predicted_ruptures(true,pred,**scatter_kwargs)
    PlotUtilities.xlabel("")
    plt.xlim(lim_plot_load)
    plt.ylim(lim_plot_force)
    PlotUtilities.title(title)
    if (remove_ticks):
        ax0.get_xaxis().set_ticklabels([])
    ax1 =subplot_f(gs[0,offset+1])
    hatch_true = true_hatch()
    true_style_histogram = _histogram_true_style(color_true=color_true,
                                                 label="true")
    pred_style_histogram = _histogram_predicted_style(color_pred=color_pred,
                                                     label="predicted")
    # for the rupture force, we dont add the label
    rupture_force_true_style = dict(**true_style_histogram)
    rupture_force_true_style['label'] = None
    rupture_force_pred_style = dict(**pred_style_histogram)
    rupture_force_pred_style['label'] = None
    rupture_force_histogram(pred,orientation='horizontal',bins=bins_rupture,
                            **rupture_force_pred_style)
    rupture_force_histogram(true,orientation='horizontal',bins=bins_rupture,
                            **rupture_force_true_style)
    PlotUtilities.lazyLabel("Count","","")
    ax = plt.gca()
    # push count to the top
    ax.xaxis.tick_top()
    ax.xaxis.set_label_position('top') 
    if (remove_ticks):
        ax1.get_yaxis().set_ticklabels([])
    if (count_limit is not None):
        plt.xlim(count_limit)
    plt.ylim(lim_plot_force)
    plt.xscale('log')
    ax4 = subplot_f(gs[1,offset])
    n_pred,_,_ = loading_rate_histogram(pred,orientation='vertical',
                                        bins=bins_load,
                                        **pred_style_histogram)
    n_true,_,_, = loading_rate_histogram(true,orientation='vertical',
                                         bins=bins_load,**true_style_histogram)
                                         
#.........这里部分代码省略.........
开发者ID:prheenan,项目名称:Research,代码行数:103,代码来源:Plotting.py

示例6: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def run(base="./"):
    """
    
    """
    out_base = base
    data_file = base + "data/Scores.pkl"
    force=False
    metric_list = CheckpointUtilities.getCheckpoint(base + "cache.pkl",
                                                    Offline.get_metric_list,
                                                    force,data_file)
    lim_load_max = [0,0]
    lim_force_max = [0,0]
    distance_limits = [0,0]
    count_max = 0
    distance_limits = []
    coeffs_compare = []
    # get the plotting limits
    update_limits = Offline.update_limits
    for m in metric_list:
        lim_force_max = update_limits(m.lim_force,lim_force_max)
        lim_load_max = update_limits(m.lim_load,lim_load_max,floor=1e-1)        
        count_max = max(m.counts,count_max)
        distance_limits.append(m.distance_limit(True))
        coeffs_compare.append(m.coefficients())
    write_coeffs_file(out_base + "metric_table.tex",coeffs_compare)
    distance_limits = [np.min(distance_limits),np.max(distance_limits)]
    # POST: have limits...
    # plot the best fold for each
    out_names = []
    colors_pred =  algorithm_colors()
    # make a giant figure, 3 rows (one per algorithm)
    fig = PlotUtilities.figure(figsize=(7,8))
    entire_figure = gridspec.GridSpec(3,1)
    title_dict = Plotting.algorithm_title_dict()
    for i,m in enumerate(metric_list):
        x,name,true,pred = m.x_values,m.name,m.true,m.pred
        best_param_idx = m.best_param_idx
        out_learner_base = "{:s}{:s}".format(out_base,name)
        color_pred =  colors_pred[i]
        # define the styles for the histogram
        xlabel_histogram = r"Distance [x$_k$]" \
                           if (i == len(metric_list)-1) else ""
        # get the distance information we'll need
        distance_kw = Plotting.\
            event_error_kwargs(m,color_pred=color_pred,
                               distance_limits=distance_limits,
                               xlabel=xlabel_histogram)
        gs = gridspec.GridSpecFromSubplotSpec(2, 3, width_ratios=[2,2,1],
                                              height_ratios=[2,1],
                                              subplot_spec=entire_figure[i],
                                              wspace=0.35,hspace=0.4)
        # plot the metric plot
        Plotting.rupture_plot(true,pred,
                              lim_plot_load=lim_load_max,
                              lim_plot_force=lim_force_max,
                              color_pred=color_pred,
                              count_limit=[0.5,count_max*5],use_legend=(i==0),
                              distance_histogram=distance_kw,gs=gs,
                              fig=fig)
        PlotUtilities.title(title_dict[name],x=-2,y=3.85,color=color_pred,
                            alpha=1)
    # individual plot labels
    n_subplots = 5
    n_categories = len(metric_list)
    letters =  string.uppercase[:n_categories]
    letters = [ ["{:s}{:d}".format(s,n+1) for n in range(n_subplots)]
                 for s in letters]
    flat_letters = [v for list_of_v in letters for v in list_of_v]
    PlotUtilities.label_tom(fig,flat_letters,loc=(-0.22,1.14))
    final_out_path = out_base + "landscape.pdf"
    PlotUtilities.save_twice(fig,final_out_path + ".png",final_out_path +".svg",
                             subplots_adjust=dict(left=0.10,
                                                  hspace=0.4,
                                                  wspace=0.2,top=0.95))
开发者ID:prheenan,项目名称:Research,代码行数:76,代码来源:main_figure_performance_cs.py

示例7: analyze_data

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def analyze_data(raw_data,out_dir):
    GenUtilities.ensureDirExists(out_dir)
    force_iwt = False
    adhesion_end_m = 20e-9         
    offset_force_N = 7.1e-12
    n_bins_zoom = 75
    n_bins_helix_a = 100
    plot_region_info = [\
        slice_area([adhesion_end_m,75e-9],"Full (no adhesion)",n_bins_helix_a),
        slice_area([20e-9,27e-9],"Helix A",n_bins_helix_a),
        slice_area([50e-9,75e-9],"Helix E",n_bins_zoom),
        slice_area([57e-9,70e-9],"Helix E (detailed)",n_bins_zoom)
        ]
    # # get the slice we care about for each...
    sliced_data = [ [] for _ in plot_region_info]
    for i,d in enumerate(raw_data):
        d.Force -= offset_force_N 
        for i,a in enumerate(plot_region_info):
            slice_tmp = FEC_Util.slice_by_separation(d,*a.ext_bounds)
            sliced_data[i].append(slice_tmp)
    # # get the IWT of both regions
    n_bins = 100
    n_bins_helix=200
    n_bins_helix_zoom = 60
    iwt_f = InverseWeierstrass.FreeEnergyAtZeroForce
    iwt_helices = []
    for i,a in enumerate(plot_region_info):
        save_name = (out_dir + a.save_name)
        iwt_helix_data_tmp =  IWT_Util.convert_to_iwt(sliced_data[i])
        iwt_tmp = CheckpointUtilities.getCheckpoint(save_name,iwt_f,
                                                    force_iwt,
                                                    iwt_helix_data_tmp,
                                                    NumBins=a.n_bins)  
        iwt_helices.append(iwt_tmp)                                                  
    # plot each of the subregions 
    for i,(a,data) in enumerate(zip(plot_region_info,sliced_data)):
        fig = PlotUtilities.figure()
        IWT_Plot.plot_free_landscape(iwt_helices[i])    
        fmt_iwt()    
        if (i ==0):
            plt.axvspan(0,min(iwt_helices[i].Extensions * 1e9),alpha=0.3,
                        color='r',label="Adhesion region",hatch='/')        
        PlotUtilities.title(a.plot_title)
        PlotUtilities.savefig(fig,out_dir + a.save_name + "_iwt_.png")
    # # make the heat map plots we want
    for i,(a,data) in enumerate(zip(plot_region_info,sliced_data)):
        fig = PlotUtilities.figure()
        FEC_Plot.heat_map_fec(sliced_data[i])    
        PlotUtilities.title(a.plot_title)
        PlotUtilities.savefig(fig,out_dir + a.save_name + "_heat_.png")
    # plot each fec individually 
    to_x = lambda x : x*1e9
    to_y = lambda y : y*1e12
    # plot fec for each region(after the first, which is just the 'full_data')
    for i,(a,d) in enumerate(zip(plot_region_info,sliced_data)):
        for fec in d:
            fec_name = GenUtilities.file_name_from_path(fec.Meta.SourceFile)
            save_name = out_dir + "regions_" + a.save_name + fec_name + ".png"
            fig = PlotUtilities.figure()
            FEC_Plot._fec_base_plot(to_x(fec.Separation),to_y(fec.Force))
            plt.xlim(1e9 * np.array(a.ext_bounds))
            PlotUtilities.savefig(fig,save_name)                                            
    # plot each landscape entirely 
    full_data = sliced_data[0]    
    for i,d in enumerate(raw_data):
        fig = PlotUtilities.figure()
        plt.plot(to_x(d.Separation),to_y(d.Force),color='k',alpha=0.3)
        sep_sliced = full_data[i].Separation
        FEC_Plot._fec_base_plot(to_x(sep_sliced),to_y(full_data[i].Force),
                                style_data=dict(color='r',alpha=0.3))
        plt.xlim([0,2*to_x(max(sep_sliced))])
        plt.ylim([-50,300])
        file_n = GenUtilities.file_name_from_path(d.Meta.SourceFile)
        PlotUtilities.savefig(fig,out_dir + "out{:d}_{:s}.png".format(i,file_n))
开发者ID:prheenan,项目名称:Research,代码行数:76,代码来源:main_iwt_helix_a.py

示例8: get_supplemental_figure

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def get_supplemental_figure(output_path,trials):
    """
    creates the 'supplemental' timing figure (for use in the appendix) 

    Args:
        see get_main_figure
    """
    # XXX should be able to get curve numbers of out pickle
    curve_numbers = [1,2,5,10,30,50,100,150,200]
    # make a plot comparing *all* of the Big-O plots of the data
    plt.subplot(3,2,1)
    # sort the times by their loading rates
    max_time = max([l.max_time_trial() for l in trials])
    min_time = min([l.min_time_trial() for l in trials])
    fig = PlotUtilities.figure((16,16))
    # plot the Theta(n) coefficient for each
    n_rows = 3
    n_cols = 2
    style_data,style_pred = style_data_and_pred()
    x_label = "C (number of curves)"
    y_label = "Runtime (s)"
    x_label_big_o = "N (points per curve)"
    y_label_big_o = "Runtime per curve (s) "
    ylim_big_o = [1e-3,1e3]
    for i,learner_trials in enumerate(trials):
        description = TimePlot.learner_name(learner_trials)
        plot_idx = i*n_cols+1
        plt.subplot(n_rows,n_cols,plot_idx)
        # plot the timing veruses loading rate and number of points 
        TimePlot.plot_learner_versus_loading_rate_and_number(learner_trials)
        fudge_x_low = 20
        fudge_x_high = 2
        fudge_y = 4
        plt.ylim(ylim_big_o)
        plt.xlim([1/fudge_x_low,max(curve_numbers)*fudge_x_high])
        plt.yscale('log')
        plt.xscale('log')        
        useLegend= (i == 0)
        last = (i == (len(trials) - 1))
        PlotUtilities.lazyLabel("","","",useLegend=useLegend,frameon=True,
                                legend_kwargs=dict(fontsize=15))
        if (not useLegend):
            plt.gca().legend().remove()
        PlotUtilities.ylabel(y_label)
        if (last):
            PlotUtilities.xlabel(x_label)            
        PlotUtilities.title("Total runtime ({:s})".\
                            format(description))
        plt.subplot(n_rows,n_cols,plot_idx+1)
        style_dict = dict(style_data=style_data[i],style_pred=style_pred[i])
        TimePlot.plot_learner_slope_versus_loading_rate(learner_trials,
                                                        **style_dict)
        PlotUtilities.title("Runtime/curve of length N ({:s})".\
                            format(description))
        if (last):
            PlotUtilities.xlabel(x_label_big_o)
        else:
            PlotUtilities.xlabel("")
        PlotUtilities.ylabel(y_label_big_o)
        plt.ylim(ylim_big_o)
    PlotUtilities.label_tom(fig,loc=(-0.05,1.05))
    PlotUtilities.savefig(fig, output_path)


    # make a plot comparing the constants
    pass
开发者ID:prheenan,项目名称:Research,代码行数:68,代码来源:main_figure_timing.py

示例9: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import title [as 别名]
def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    abs_dir = "./"
    cache_dir = "./cache/"
    out_dir = "./out/"
    force_iwt = True 
    GenUtilities.ensureDirExists(cache_dir)
    GenUtilities.ensureDirExists(out_dir)    
    examples = FEC_Util.\
        cache_individual_waves_in_directory(pxp_dir=abs_dir,force=False,
                                            cache_dir=cache_dir,limit=20)
    # filter all the fecs 
    good_splits_original = copy.deepcopy(examples)
    n_points_f = lambda x: int(np.ceil(2e-3*s.Force.size))
    examples = [FEC_Util.GetFilteredForce(s,n_points_f(s))
                for s in examples]                                            
    ### XXX TODO
    # (1) correct for interference artifact
    # (2) get regions for WLC fit
    # (3) fit WLC to regions
    # (4) Invert WLC, determine dsDNA and ssDNA contour lengths at each force 
    # split the fecs...
    split_fecs = []
    for i,ex in enumerate(examples):
        split_fec = Analysis.zero_and_split_force_extension_curve(ex)
        retract = split_fec.retract
        split_fecs.append(split_fec)  
    # align them by the contour lengths (assuming we have at least xnm to 
    # work with 
    working_distance_nm = 30
    coeffs,idx = CheckpointUtilities.\
        getCheckpoint("./polymer.pkl",get_polymer_coefficients,False,
                      split_fecs,working_distance_nm)
    # get the split fecs we could actually fit
    good_splits = [split_fecs[i] for i in idx]
    # align all the retracts by the contour lenghts
    contour_L0 = [c[0] for c in coeffs]
    arbitrary_offset = 90e-9
    for L0,split_fec in zip(contour_L0,good_splits):
        split_fec.retract.Separation -= L0
        split_fec.retract.Separation += arbitrary_offset
    # POST: retracts are all aligned.         
    # for a simple IWT, only look at until the unfolding region
    unfolding_retracts = [get_unfolding_slice_only(split_fec) 
                          for e in good_splits]
    refolding_experiments = \
        [get_unfolding_and_refolding_slice(r) for r in good_splits]
    # get the extension maximum and minimum bounds. 
    ext_min_m = lambda s: min(s.Separation)
    ext_max_m = lambda s: min(s.Separation) + 50e-9
    # slice the refolding experiments 
    sliced_refolds = [FEC_Util.slice_by_separation(s,ext_min_m(s),ext_max_m(s))
                      for s in refolding_experiments]                      
    # split the refolding experiments into iwt       
    iwt_refolds = [ \
        WeierstrassUtil.split_into_iwt_objects(s,
                                        fraction_for_vel=0.1,
                                        f_split=IWT_Util.split_by_max_sep)
        for s in  sliced_refolds]                                                                   
    unfolding_objs = [u[0] for u in iwt_refolds]
    refolding_objs = [u[1] for u in iwt_refolds]   
    # slice to just the first L0 (before the final rupture)
    max_meters = arbitrary_offset
    final_rupture_only = [FEC_Util.slice_by_separation(u,-np.inf,max_meters) 
                          for u in unfolding_retracts]
    # convert to the type iwt needs                          
    final_unfolding_iwt = \
        [WeierstrassUtil.convert_to_iwt(r,frac_vel=0.2) 
         for r in final_rupture_only]
    # get the iwt tx 
    n_bins = 200
    energy_landscape_unfolding = CheckpointUtilities.\
        getCheckpoint("./landscape.pkl",
                      InverseWeierstrass.FreeEnergyAtZeroForce,force_iwt,
                      final_unfolding_iwt,NumBins=n_bins)
    # make a heat map of all retracts 
    fig = PlotUtilities.figure()
    FEC_Plot.heat_map_fec([r.retract for r in good_splits])
    PlotUtilities.title("FEC Heat map, aligned by L0, N={:d}".\
                        format(len(good_splits)))
    PlotUtilities.savefig(fig,out_dir + "heat.png")    
    # make a heat map of just the region for the unfolding iwt 
    fig = PlotUtilities.figure()
    FEC_Plot.heat_map_fec(final_rupture_only)
    PlotUtilities.title("FEC Final unfolding heat map, aligned by L0, N={:d}".\
                        format(len(good_splits)))
    PlotUtilities.savefig(fig,out_dir + "heat_unfolding.png")                           
    # make a heat map of the unfolding and refolding  experiment data 
    fig = PlotUtilities.figure(figsize=(4,7))
    plt.subplot(2,1,1)
    FEC_Plot.heat_map_fec(unfolding_objs)
    plt.subplot(2,1,2)
#.........这里部分代码省略.........
开发者ID:prheenan,项目名称:Research,代码行数:103,代码来源:main_hairpin_high_resolution.py


注:本文中的GeneralUtil.python.PlotUtilities.title方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。