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


Python python.PlotUtilities类代码示例

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


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

示例1: plot_learner_versus_loading_rate_and_number

def plot_learner_versus_loading_rate_and_number(learner_trials):    
    """
    makes a plot of the runtimes versus number of force extension curves
    for each loading rate used.
    
    Args:
        learner_trials: a single learner object
    Returns:
        nothing, makes a pretty plot
    """
    styles = [dict(color='r',marker='x',linestyle='--'),
              dict(color='b',marker='o',linestyle='-'),
              dict(color='k',marker='v',linestyle='-.'),
              dict(color='g',marker='s',linestyle='-',linewidth=3),
              dict(color='m',marker='*',linestyle='-.',linewidth=3),
              dict(color='k',marker='8',linestyle='-',linewidth=2),
              dict(color='r',marker='p',linestyle='-.',linewidth=2),
              dict(color='b',marker='d',linestyle='--'),
              dict(color='k',marker='<',linestyle='-'),
              dict(color='g',marker='+',linestyle='-.')]
    inf = timing_info(learner_trials)
    pts,xerr = _timing_plot_pts_and_pts_error(inf,factor=1)
    for i,(num,mean,yerr,vel) in enumerate(zip(inf.nums,inf.means,inf.stdevs,
                                               inf.velocities)):
        style = styles[i % len(styles)]
        velocity_label = r"v={:4d}nm/s".format(int(vel))
        number_pretty = r"N$\approx$"  + pretty_exp(pts[i])
        label = "{:s}\n({:s})".format(velocity_label,number_pretty)
        plt.errorbar(x=num,y=mean,yerr=yerr,label=number_pretty,alpha=0.7,
                     **style)
    title = "Runtime verus loading rate and number of curves\n" + \
           "(N, points/curve, in parenthesis) "
    PlotUtilities.lazyLabel("Number of Force-Extension Curves","Time",title)
开发者ID:prheenan,项目名称:Research,代码行数:33,代码来源:TimePlot.py

示例2: run

def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    network = FEC_Util.default_data_root()
    base = network + "4Patrick/CuratedData/Lipids/DOPC/"+\
            "NegativeControls/Representative_Gallery/"
    _,raw_data = FEC_Util.read_and_cache_pxp(base,force=False)
    processed = [FEC_Util.SplitAndProcess(r) for r in raw_data]
    inches_per_plot = 4.5
    n_rows,n_cols = FEC_Plot._n_rows_and_cols(processed)
    fig_size = (n_cols*inches_per_plot,n_rows*inches_per_plot)
    fig = PlotUtilities.figure(figsize=(fig_size))
    ylim_pN = [-20,75]
    xlim_nm = [-10,100]
    FEC_Plot.gallery_fec(processed,xlim_nm,ylim_pN)
    plt.suptitle("Negative Control Gallery",y=1.2,fontsize=25)
    PlotUtilities.savefig(fig,base + "out.png",close=False)
    PlotUtilities.savefig(fig,"./out.png")
开发者ID:prheenan,项目名称:Research,代码行数:25,代码来源:main_negative_gallery.py

示例3: FEC_AlreadySplit

def FEC_AlreadySplit(Appr,Retr,
                     XLabel = "Separation (nm)",
                     YLabel = "Force (pN)",
                     ConversionOpts=def_conversion_opts,
                     PlotLabelOpts=dict(),
                     PreProcess=False,
                     NFilterPoints=50,
                     LegendOpts=dict(loc='best'),
                     **kwargs):
    """

    Args:
        XLabel: label for x axis
        YLabel: label for y axis
        ConversionOpts: see FEC_Util.SplitAndProcess
        PlotLabelOpts: see arguments after filtering of ApproachRetractCurve
        PreProcess: if true, pre-processes the approach and retract separately
        (ie: to zero and flip the y axis).
        NFilterPoints: see FEC_Util.SplitAndProcess, for Savitsky-golay
        PreProcess: passed to 

    """
    ApprCopy = FEC_Util.UnitConvert(Appr,**ConversionOpts)
    RetrCopy = FEC_Util.UnitConvert(Retr,**ConversionOpts)
    if (PreProcess):
        ApprCopy,RetrCopy = FEC_Util.PreProcessApproachAndRetract(ApprCopy,
                                                                  RetrCopy,
                                                                  **kwargs)
    _ApproachRetractCurve(ApprCopy,RetrCopy,
                          NFilterPoints=NFilterPoints,**PlotLabelOpts)
    PlotUtilities.lazyLabel(XLabel,YLabel,"")
    PlotUtilities.legend(**LegendOpts)
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:FEC_Plot.py

示例4: landscape_plot

def landscape_plot(landscape,landscape_rev,landscape_rev_only,kT,f_one_half):
    ToX = lambda x: x*1e9
    landscape_rev_kT = landscape_rev.G_0/kT
    landscape_fwd_kT = landscape.G_0/kT
    landscape_rev_only_kT = landscape_rev_only.G_0/kT
    ext_fwd = landscape_rev.q
    ext_rev = landscape.q
    # tilt one of the landscapes
    ext_tilt = ext_fwd
    landscape_tilt_kT = landscape_rev_kT
    landscape_fonehalf_kT = (landscape_tilt_kT*kT-ext_tilt* f_one_half)/kT
    landscape_fonehalf_kT_rel = landscape_fonehalf_kT-min(landscape_fonehalf_kT)
    xlim = [195,265]
    plt.subplot(2,1,1)
    sanit = lambda x: x - min(x)
    # add in the offsets, since we dont simulate before...
    plt.plot(ToX(ext_fwd),sanit(landscape_rev_kT)+20,color='r',alpha=0.6,
             linestyle='-',linewidth=3,label="Bi-directional")
    plt.plot(ToX(ext_rev),sanit(landscape_fwd_kT)+75,color='b',
             linestyle='--',label="Only Forward")
    plt.plot(ToX(landscape_rev_only.q),sanit(landscape_rev_only_kT)+20,
             "g--",label="Only Reverse")
    PlotUtilities.lazyLabel("","Free Energy (kT)",
                            "Hummer 2010, Figure 3")
    plt.xlim(xlim)
    plt.ylim([0,300])
    plt.subplot(2,1,2)
    plt.plot(ToX(ext_tilt),2.5+landscape_fonehalf_kT_rel,'g^',
             markevery=10)
    plt.xlim(xlim)
    plt.ylim([0,25])
    PlotUtilities.lazyLabel("Extension q (nm)","Energy at F_(1/2) (kT)","")
开发者ID:prheenan,项目名称:BioModel,代码行数:32,代码来源:MainTesting.py

示例5: run

def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    file_name = "defl.ibw"
    defl_volts_wave = PxpLoader.read_ibw_as_wave(file_name)
    defl_volts = defl_volts_wave.DataY
    invols_nm_per_volt = 154.8
    spring_pN_per_nM = 5.70
    force_pN = defl_volts * invols_nm_per_volt * spring_pN_per_nM
    # zero out to the maximum
    force_pN -= np.mean(force_pN)
    data_interval_in_s = 1/500e3
    rate = 1/float(data_interval_in_s) # data rate in Hz
    taus = np.logspace(-5,2,num=50,base=10) #  tau-values in seconds
    # fractional frequency data
    (taus_used, adev, adeverror, adev_n) = \
        allantools.adev(force_pN, data_type='freq', rate=rate, taus=taus)
    fig = PlotUtilities.figure()
    plt.errorbar(x=taus_used,y=adev,yerr=2*adeverror,label="95% C.I.")
    plt.xscale('log')
    plt.yscale('log')
    plt.axhline(1,color='r',linestyle='--',label="1 pN")
    PlotUtilities.lazyLabel("Averaging time (s)","Force (pN)","")
    PlotUtilities.savefig(fig,"out.png")
开发者ID:prheenan,项目名称:Research,代码行数:31,代码来源:main_allan.py

示例6: plot_classification

def plot_classification(split_object,scoring_object):
    """
    plots the classification of a single object

    Args:
         split_object: whatever was classified
         scoring_object: Scoring.score object, used on split_object
    Returns:
         Nothing
    """
    retract = split_object.retract
    time,force = retract.Time,retract.Force
    true_idx,pred_idx =  scoring_object.idx_true,scoring_object.idx_predicted
    boolean_true,boolean_predicted = scoring_object.get_boolean_arrays(time)
    plt.subplot(2,1,1)
    plt.plot(time,force,color='k',alpha=0.3)
    highlight_events(true_idx,time,force,color='r',linestyle='-',
                     label="true events")
    highlight_events(pred_idx,time,force,color='b',linestyle='None',
                     marker='.',label="predicted events")
    PlotUtilities.lazyLabel("","Force(pN)","")
    plt.subplot(2,1,2)
    plt.plot(time,boolean_true,linewidth=4,label="True events",color='b')
    plt.plot(time,boolean_predicted,label="Predicted",color='r',alpha=0.3)
    PlotUtilities.lazyLabel("Time (s)","Force(pN)","")
开发者ID:prheenan,项目名称:Research,代码行数:25,代码来源:Plotting.py

示例7: run

def run():
    """
    <Description>

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    in_dir = "./data/"
    cache_dir = "./cache/"
    out_dir = in_dir
    GenUtilities.ensureDirExists(out_dir)
    images = ImageUtil.cache_images_in_directory(pxp_dir=in_dir,
                                                 cache_dir=cache_dir)
    # note: vmin/vmax are in nm (as is height)                                                  
    vmin_nm = 0
    vmax_nm = vmin_nm + 0.6
    imshow_kwargs = dict(vmin=vmin_nm,vmax=vmax_nm,cmap = plt.cm.Greys_r)    
    for im in images:
        src_file = im.SourceFilename()
        # path to save the image out 
        full_out_path = "{:s}{:s}-{:s}.png".format(out_dir,src_file,im.Name())        
        fig = PlotUtilities.figure((3.5,4))
        ax = plt.subplot(1,1,1)
        im.height = ImageUtil.subtract_background(im,deg=3)
        im = ImageUtil.make_image_plot(im,imshow_kwargs,pct=50)
        ImageUtil.smart_colorbar(im=im,ax=ax,fig=fig)
        PlotUtilities.savefig(fig,full_out_path,bbox_inches='tight')        
开发者ID:prheenan,项目名称:Research,代码行数:30,代码来源:main_process_2017-8-15.py

示例8: cross_validation_distance_metric

def cross_validation_distance_metric(x_values,train_scores,valid_scores,
                                     to_true):
    """
    Plots the cross validation training and validation distance metric

    Args:
        x_values: x values
        <train/valid>_scores: the training and validation scores used
        to_true: distance metric plotted is *from* predicted *to* true 
        (ie: something like recall) if true, otherwise vice versa

    Returns:
        nothing
    """
    # get the metrics and errors by parameters
    x_train,train_dist,train_dist_std = \
        Learning.median_dist_metric(x_values,train_scores,to_true=to_true)
    x_valid,valid_dist,valid_dist_std = \
        Learning.median_dist_metric(x_values,valid_scores,to_true=to_true)
    y_plot = lambda y: y * 1e9
    train_dist_plot,train_error_plot = y_plot(train_dist),y_plot(train_dist_std)
    valid_dist_plot,valid_error_plot = y_plot(valid_dist),y_plot(valid_dist_std)
    plt.errorbar(x=x_train,y=train_dist_plot,yerr=train_error_plot,
                 **style_train)
    plt.errorbar(x=x_valid,y=valid_dist_plot,yerr=valid_error_plot,
                 **style_valid)
    plt.xscale('log')
    plt.yscale('log')
    PlotUtilities.lazyLabel("Tuning Parameter","Median event distance (nm)","",
                            frameon=False)
开发者ID:prheenan,项目名称:Research,代码行数:30,代码来源:Plotting.py

示例9: distance_distribution_plot

def distance_distribution_plot(learner,box_kwargs=None,**kwargs):
    """
    plots the distribution of distances to/from predicted events from/to
    actual events, dependning on kwargs
    
    Args:
        learner: the learner object to use
        kwargs: passed to event_distance_distribution (ie: to_true=T/F)
    """
    train_scores = learner._scores_by_params(train=True)
    valid_scores = learner._scores_by_params(train=False)
    if (box_kwargs is None):
        box_kwargs = dict(whis=[5,95])
    name = learner.description.lower()
    x_values = learner.param_values()
    train_dist = Learning.event_distance_distribution(train_scores,**kwargs)
    valid_dist = Learning.event_distance_distribution(valid_scores,**kwargs)
    dist_plot = lambda x: [v for v in x]
    train_plot = dist_plot(train_dist)
    valid_plot = dist_plot(valid_dist)
    plt.boxplot(x=train_plot,**box_kwargs)
    plt.boxplot(x=valid_plot,**box_kwargs)
    plt.gca().set_yscale('log')
    PlotUtilities.lazyLabel("Tuning parameter","Distance Distribution (idx)",
                            "Event distributions for {:s}".format(name),
                            frameon=False)
开发者ID:prheenan,项目名称:Research,代码行数:26,代码来源:Plotting.py

示例10: sequence_plots

def sequence_plots(out_base,*args,**kwargs):
    break_points = [_break_after_interp,_break_after_first_zoom,_dont_break]
    for i,break_point in enumerate(break_points):
        fig = PlotUtilities.figure((8,9))
        plot(*args,when_to_break=break_point,**kwargs)
        PlotUtilities.savefig(fig,out_base + "{:d}.pdf".format(i),
                              subplots_adjust=dict(wspace=0.05))
开发者ID:prheenan,项目名称:Research,代码行数:7,代码来源:main_figure_noise.py

示例11: make_gallery_plot

def make_gallery_plot(areas,data_to_analyze,out_name="./gallery"):
    # skip the first one (the entire landscape )
    helical_areas = areas[1:]
    helical_data = data_to_analyze[1:]
    helical_kwargs = landscape_kwargs()[1:]
    fig = PlotUtilities.figure((7,2.5))
    helical_gallery_plot(helical_areas,helical_data,helical_kwargs)    
    PlotUtilities.save_png_and_svg(fig,out_name)                    
开发者ID:prheenan,项目名称:Research,代码行数:8,代码来源:main_landscapes.py

示例12: run

def run():
    """
    simple script to compare wavelet transform and fft on something that
    looks like our data
    """             
    fig = PlotUtilities.figure(figsize=(10,16))
    MakeFigure()
    PlotUtilities.savefig(fig,"out.png")
开发者ID:prheenan,项目名称:Research,代码行数:8,代码来源:main_fft_vs_wt.py

示例13: fmt

def fmt(remove_x_labels=True,remove_y_labels=True):
    ax = plt.gca()
    if (remove_x_labels):
        ax.xaxis.set_ticklabels([])
    if (remove_y_labels):
        ax.yaxis.set_ticklabels([])
    PlotUtilities.lazyLabel("","","")
    plt.ylim([-25,80])
    plt.xlim([-100,700])
开发者ID:prheenan,项目名称:Research,代码行数:9,代码来源:main_figure_cartoon.py

示例14: heatmap_plot

def heatmap_plot(heatmap_data,amino_acids_per_nm,kw_heatmap=dict()):
    ax_heat = plt.gca()
    make_heatmap(*heatmap_data,kw_heatmap=kw_heatmap)
    PlotUtilities.lazyLabel("","Force (pN)","")
    # make a second x axis for the number of ammino acids 
    xlim_fec = plt.xlim()
    limits = np.array(xlim_fec) * amino_acids_per_nm
    tick_kwargs = dict(axis='both',color='w',which='both')                                 
    ax_heat.tick_params(**tick_kwargs)                                         
    plt.xlim(xlim_fec)
开发者ID:prheenan,项目名称:Research,代码行数:10,代码来源:main_landscapes.py

示例15: probability_plot

def probability_plot(inf,slice_eq):
    plt.subplot(2,1,1)
    plt.plot(inf.ext_bins_safe,inf.p_k)
    plt.plot(inf.ext_bins,inf.P_q,'r--')
    plt.plot(inf.ext_interp,inf.p_k_interp,'g-')
    PlotUtilities.lazyLabel("","PDF","")    
    plt.subplot(2,1,2)
    plt.plot(inf.ext_bins_safe,inf.free_energy_kT,'g-')
    plt.plot(inf.ext_bins,inf.convolved_free_energy_kT,'r--')
    PlotUtilities.lazyLabel(r"Extension ($\AA$)","Free energy","")    
开发者ID:prheenan,项目名称:Research,代码行数:10,代码来源:main_equilibrium.py


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