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


Python PlotUtilities.figure方法代码示例

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


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

示例1: InTheWeedsPlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def InTheWeedsPlot(OutBase,UnfoldObj,RefoldObj=[],Example=None,
                   Bins=[50,75,100,150,200,500,1000],**kwargs):
    """
    Plots a detailed energy landscape, and saves

    Args:
        OutBase: where to start the save
        UnfoldObj: unfolding objects
        RefoldObj: refolding objects
        Bins: how many bins to use in the energy landscape plots
        <min/max>_landscape_kT: bounds on the landscape
    Returns:
        nothing
    """
    # get the IWT
    kT = 4.1e-21
    for b in Bins:
        LandscapeObj =  InverseWeierstrass.\
            FreeEnergyAtZeroForce(UnfoldObj,NumBins=b,RefoldingObjs=RefoldObj)
        # make a 2-D histogram of everything
        if (Example is not None):
            fig = PlotUtilities.figure(figsize=(8,8))
            ext_nm = Example.Separation*1e9
            IWT_Util.ForceExtensionHistograms(ext_nm,
                                              Example.Force*1e12,
                                              AddAverage=False,
                                              nBins=b)
            PlotUtilities.savefig(fig,OutBase + "0_{:d}hist.pdf".format(b))
        # get the distance to the transition state etc
        print("DeltaG_Dagger is {:.1f}kT".format(Obj.DeltaGDagger))
        fig = PlotUtilities.figure(figsize=(12,12))
        plot_single_landscape(LandscapeObj,add_meta_half=True,
                              add_meta_free=True,**kwargs)
        PlotUtilities.savefig(fig,OutBase + "1_{:d}IWT.pdf".format(b))
开发者ID:prheenan,项目名称:Research,代码行数:36,代码来源:IWT_Plot.py

示例2: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def run():
    BaseDir = "/Volumes/group/4Patrick/Reports/" + \
           "2016_6_5_NearEquilibrium_Biotin_DOPC/IWT/"
    InBase = BaseDir + "In/"
    OutBase = BaseDir + "Out/"
    FullNames = [
    InBase +"2016-6-3-micah-1-part-per-million-biolevel-long-strept-coated.pxp",
    InBase +"2016-6-4-micah-1ppm-biolever-long-strept-saved-data.pxp",
    InBase +"2016-6-5-micah-1ppm-biolever-long-strept-saved-data.pxp"
    ]
    Limit = 100
    ForceReRead = False
    ForceRePlot = False
    IwtObjects,RetractList,Touchoff,LandscapeObj  = \
            CheckpointUtilities.getCheckpoint(OutBase + "IWT.pkl",
                                              IWT_Util.GetObjectsAndIWT,
                                              ForceReRead,InBase,FullNames,
                                              ForceReRead,
                                              Limit=Limit)
    ext,force  = CheckpointUtilities.\
        getCheckpoint(OutBase + "ExtAndForce.pkl",
                      IWT_Util.GetAllExtensionsAndForceAndPlot,
                      ForceRePlot,RetractList,
                      Touchoff,IwtObjects,OutBase)
    fig = PlotUtilities.figure(figsize=(8,12))
    IWT_Util.ForceExtensionHistograms(force,ext)
    PlotUtilities.savefig(fig,OutBase + "HeatMap.png")
    fig = PlotUtilities.figure(figsize=(8,12))
    IWT_Util.EnergyLandscapePlot(LandscapeObj)
    PlotUtilities.savefig(fig,OutBase + "IWT.png")
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:IWT_Main.py

示例3: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def run(base="./"):
    """
    
    """
    out_base = base
    data_base =  base + "data/"
    data_file = "../FigurePerformance_CS/data/Scores.pkl"
    force=False
    cache_file = base + "cache.pkl"
    fec_file = data_base + "multiple.csv.pkl"
    name = "FEATHER"
    final_out_hist = "{:s}{:s}_distances.pdf".format(out_base,
                                                     name.replace(" ","_"))
    l = CheckpointUtilities.getCheckpoint(cache_file,get_feather_run,force,
                                          data_file)
    # make the distance histogram figure for the presenation
    fig = PlotUtilities.figure((10,5))
    make_distance_figure(l,data_file,fec_file)
    PlotUtilities.legend(loc='upper right')
    PlotUtilities.savefig(fig,final_out_hist.replace(".pdf","_pres.pdf"))
    # make the distance histogram figure
    fig = PlotUtilities.figure((16,6))
    make_distance_figure(l,data_file,fec_file)
    PlotUtilities.legend(loc='upper right')
    PlotUtilities.label_tom(fig,loc=(-0.1,1.0),fontsize=18)
    PlotUtilities.savefig(fig,final_out_hist)
开发者ID:prheenan,项目名称:Research,代码行数:28,代码来源:main_figure_performance_cs_distance.py

示例4: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def run(base="./"):
    """
    
    """
    name = "examples.pdf"
    data_base = base + "data/"
    file_names = ["protein","fast_unfolding","low-snr","ringing"]
    kw = dict(cache_directory=data_base,force=False)
    file_paths = [data_base + f +".csv" for f in file_names]
    cases = [read_and_cache_file(f,**kw) for f in file_paths]
    for c in cases:
        split_fec = Analysis.zero_and_split_force_extension_curve(c)
        name = c.Meta.Name
        num = 0
        retract_idx = split_fec.get_predicted_retract_surface_index()
        split_fec.retract.Force -= \
            np.percentile(split_fec.retract.Force[retract_idx:],25)
        predicted_event_idx = Detector.predict(c,threshold=1e-2)
        fig = PlotUtilities.figure((8,4))
        plot_retract_with_events(split_fec)
        num = label_and_save(fig=fig,name=name,num=num)
        fig = PlotUtilities.figure((8,4))
        plot_events_by_colors(split_fec,predicted_event_idx)
        num = label_and_save(fig=fig,name=name,num=num)
        fig = PlotUtilities.figure((6,10))
        plt.subplot(2,1,1)
        plot_events_by_colors(split_fec,predicted_event_idx,plot_filtered=True)
        PlotUtilities.lazyLabel("","Force (pN)","")
        PlotUtilities.no_x_label()
        plt.subplot(2,1,2)
        plot_state_transition_diagram(split_fec,predicted_event_idx)
        num = label_and_save(fig=fig,name=name,num=num,ylabel="State")
开发者ID:prheenan,项目名称:Research,代码行数:34,代码来源:main_figure_pathological.py

示例5: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def run(base="./"):
    """
    
    """
    name = "cartoon.pdf"
    data_base = base + "data/"
    file_names = ["no","single","multiple"]
    # save without the labels for the presentation
    subplots_adjust = dict(left=0.12,wspace=0.2,hspace=0.1)
    fig = PlotUtilities.figure((8,4))
    plot_fec_cartoon(base,data_base,file_names,
                     arrow_kwargs=dict(markersize=75))
    PlotUtilities.savefig(fig,name.replace(".pdf","_pres.pdf"),
                          subplots_adjust=subplots_adjust)
    # save with the labels for the presentation
    fig = PlotUtilities.figure((16,8))
    subplots_adjust = dict(left=0.08,wspace=0.2,hspace=0.1)
    plot_fec_cartoon(base,data_base,file_names,
                     arrow_kwargs=dict(markersize=125))
    n_subplots = 2
    n_categories = len(file_names)
    letters =  string.uppercase[:n_categories]
    letters = ([r"{:s}".format(s) for s in letters] + \
               ["" for _ in range(n_categories)])
    bottom = (-0.25,1)
    top = (-0.60,1)
    loc = [top for i in range(n_categories)] +  \
          [bottom for i in range(n_categories)] 
    PlotUtilities.label_tom(fig,letters,loc=loc)
    PlotUtilities.savefig(fig,name,subplots_adjust=subplots_adjust)
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:main_figure_cartoon.py

示例6: plot_individual_learner

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def plot_individual_learner(cache_directory,learner,rupture_kwargs=dict()):
    """
    Plots the results for a single, individual learner

    Args:
        cache_directory: where to save the plots
        learner: learning_curve instance to use
    Returns:
        nothing
    """
    learner_name = learner.description
    out_file_stem = cache_directory + "{:s}".format(learner_name)
    # get the scoring objects by paramter by fold
    train_scores = learner._scores_by_params(train=True)
    valid_scores = learner._scores_by_params(train=False)
    x_values = learner.param_values()
    rupture_distribution_plot(learner,out_file_stem,
                              distance_histogram=rupture_kwargs)
    fig = PlotUtilities.figure()
    distance_distribution_plot(learner,to_true=True)
    PlotUtilities.savefig(fig,out_file_stem + "histogram_to_true.png")
    fig = PlotUtilities.figure()
    distance_distribution_plot(learner,to_true=False)
    PlotUtilities.savefig(fig,out_file_stem + "histogram_to_predicted.png")
    fig = PlotUtilities.figure()
    plot_num_events_off(x_values,train_scores,valid_scores)
    PlotUtilities.savefig(fig,out_file_stem + "n_off.png")
    fig = PlotUtilities.figure()
    cross_validation_distance_metric(x_values,train_scores,valid_scores,
                                     to_true=True)
    PlotUtilities.savefig(fig,out_file_stem + "dist.png")
开发者ID:prheenan,项目名称:Research,代码行数:33,代码来源:Plotting.py

示例7: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    learners = Learners.get_learners()
    positives_directory = InputOutput.get_positives_directory()
    positive_categories = InputOutput.\
        get_categories(positives_directory=positives_directory,
                       use_simulated=True)
    curve_numbers = [1,2,5,10,30,50,100,150,200]
    cache_data_dir = "../_1ReadDataToCache/cache/"
    cache_dir = "./cache/"
    GenUtilities.ensureDirExists(cache_dir)
    force = False
    times = CheckpointUtilities.getCheckpoint(cache_dir + "all_timer.pkl",
                                              cache_all_learners,force,
                                              learners,positive_categories,
                                              curve_numbers,
                                              cache_data_dir,cache_dir,force)
    out_base = "./out/"
    GenUtilities.ensureDirExists(out_base)
    # sort the times by their loading rates
    max_time = max([l.max_time_trial() for l in times])
    min_time = min([l.min_time_trial() for l in times])
    # plot the Theta(n) coefficient for each
    fig = PlotUtilities.figure()
    TimePlot.plot_learner_prediction_time_comparison(times)
    PlotUtilities.legend(loc="lower right",frameon=True)
    PlotUtilities.savefig(fig,out_base + "compare.png")
    for learner_trials in times:
        base_name = out_base + learner_trials.learner.description
        # plot the timing veruses loading rate and number of points 
        fig = PlotUtilities.figure()
        TimePlot.plot_learner_versus_loading_rate_and_number(learner_trials)
        fudge_x_low = 10
        fudge_x_high = 2
        fudge_y = 1.5
        plt.ylim([min_time/fudge_y,max_time*fudge_y])
        plt.xlim([1/fudge_x_low,max(curve_numbers)*fudge_x_high])
        plt.yscale('log')
        plt.xscale('log')        
        PlotUtilities.legend(loc="upper left",frameon=True)
        PlotUtilities.savefig(fig,  base_name + "_all_trials.png")
        # plot the slopes
        fig = PlotUtilities.figure()
        TimePlot.plot_learner_slope_versus_loading_rate(learner_trials)
        PlotUtilities.legend(loc="lower right",frameon=True)
        PlotUtilities.savefig(fig, base_name + "_slopes.png")
开发者ID:prheenan,项目名称:Research,代码行数:56,代码来源:Timer.py

示例8: hairpin_plots

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def hairpin_plots(example,filter_fraction,out_path):
    n_filter = int(np.ceil(example.Force.size * filter_fraction))
    # make a plot vs time 
    fig = PlotUtilities.figure()
    plt.subplot(2,1,1)
    FEC_Plot.force_versus_time(example,NFilterPoints=n_filter)
    plt.subplot(2,1,2)
    FEC_Plot.z_sensor_vs_time(example,NFilterPoints=n_filter)
    PlotUtilities.savefig(fig,out_path + "vs_time.png")
    # make a force-extension plot
    fig = PlotUtilities.figure()
    FEC_Plot.FEC(example,NFilterPoints=n_filter)
    PlotUtilities.savefig(fig,out_path + "vs_sep.png")
开发者ID:prheenan,项目名称:Research,代码行数:15,代码来源:main_hairpin_high_resolution.py

示例9: SavePlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def SavePlot(SortByZ,FullName,SaveName):
    Objs = FEC_Util.ReadInData(FullName)
    Tmp = Objs[0]
    if (SortByZ):
        ArgSort = np.argsort(Tmp.Zsnsr)
        Tmp.Zsnsr = Tmp.Zsnsr[ArgSort]
        Tmp.Force = Tmp.Force[ArgSort]
        Offset = 150
    else:
        Offset = 0
    # set up the y limits in pN
    ylim = [Offset-20,Offset+25]
    fig = pPlotUtil.figure()
    plt.subplot(2,1,1)
    FullPlot(Tmp)
    pPlotUtil.lazyLabel("Stage position (nm)","Force (pN)","Flickering for FEC",
                        frameon=True)
    # x limits for 'zoomed in'
    plt.xlim([30,40])
    plt.ylim(ylim)
    plt.subplot(2,1,2)
    FullPlot(Tmp)
    pPlotUtil.lazyLabel("Stage position (nm)","Force (pN)","",frameon=True)
    # x limits for 'zoomed in'
    plt.xlim([36,36.5])
    plt.ylim(ylim)
    pPlotUtil.savefig(fig,SaveName)
开发者ID:prheenan,项目名称:Research,代码行数:29,代码来源:Main_6_7_flickering_example.py

示例10: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
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,代码行数:27,代码来源:main_negative_gallery.py

示例11: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
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,代码行数:32,代码来源:main_process_2017-8-15.py

示例12: sequence_plots

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
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,代码行数:9,代码来源:main_figure_noise.py

示例13: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    data_file = "../_Data/Scores.pkl"
    kw = dict(score_tx_func=get_only_nug2_ruptures)
    runs = [ ["./cache.pkl",dict(),"performance"],
             ["./cache_nug2.pkl",kw,"performance_nug2"]]
    PlotUtilities.tom_text_rendering()
    for cache_name,keywords,plot_name in runs:
        # get the metrics we care about
        metrics = CheckpointUtilities.getCheckpoint(cache_name,
                                                    Offline.get_best_metrics,
                                                    False,data_file,
                                                    **keywords)
        coeffs_compare = [m.coefficients() for m in metrics]
        write_coeffs_file("./coeffs.txt",coeffs_compare)
        # make the plot we want
        fig = PlotUtilities.figure(figsize=(7,3))
        make_metric_plot(metrics)
        axis_func = lambda axes: [ax for i,ax in enumerate(axes) if i < 3]
        loc_last_two = [-0.05,1.1]
        locs = [ [-0.2,1.1], loc_last_two,loc_last_two]
        PlotUtilities.label_tom(fig,axis_func=axis_func,loc=locs)
        # save out the plot
        subplots_adjust = dict(hspace=0.1,wspace=0.1,
                               bottom=0.125,top=0.93)
        PlotUtilities.save_png_and_svg(fig,plot_name,
                                       subplots_adjust=subplots_adjust)
开发者ID:prheenan,项目名称:Research,代码行数:37,代码来源:main_performance_figure.py

示例14: ScatterPlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
def ScatterPlot(TransitionForces,ListOfSepAndFits,ExpectedContourLength,
                OutDir):
    """
    Makes a scatter plot of the contour length and transition forces

    Args:
        TransitionForces: array, each element the transition region for curve i
        ListOfSepAndFits: array, each element the output of GetWLCFits
        ExpectedContourLength: how long we expect the construct to be
        OutDir: base directory, for saving stuff
    """
    L0Arr = []
    TxArr = []
    for (SepNear,FitObj),TransitionFoces in zip(ListOfSepAndFits,
                                                TransitionForces):
        MedianTx = np.median(TransitionFoces)
        L0,Lp,_,_ = FitObj.Params()
        L0Arr.append(L0)
        TxArr.append(MedianTx)
    # go ahead an throw out ridiculous data from the WLC, where transition
    # normalize the contour length to L0
    L0Arr = np.array(L0Arr)/ExpectedContourLength
    # convert to useful units
    L0Plot = np.array(L0Arr)
    TxPlot =  np.array(TxArr) * 1e12
    fig = pPlotUtil.figure(figsize=(12,12))
    plt.subplot(2,2,1)
    plt.plot(L0Plot,TxPlot,'go',label="Data")
    alpha = 0.3
    ColorForce = 'r'
    ColorLength = 'b'
    plt.axhspan(62,68,color=ColorForce,label=r"$F_{\rm tx}$ $\pm$ 5%",
                alpha=alpha)
    L0BoxMin = 0.9
    L0BoxMax = 1.1
    plt.axvspan(L0BoxMin,L0BoxMax,color=ColorLength,
                label=r"L$_{\rm 0}$ $\pm$ 10%",alpha=alpha)
    fudge = 1.05
    # make the plot boundaries OK
    MaxX = max(L0BoxMax,max(L0Plot))*fudge
    MaxY = 90
    plt.xlim([0,MaxX])
    plt.ylim([0,MaxY])
    pPlotUtil.lazyLabel("",r"F$_{\rm overstretch}$ (pN)",
                        "DNA Characterization Histograms ",frameon=True)
    ## now make 1-D histograms of everything
    # subplot of histogram of transition force
    HistOpts = dict(alpha=alpha,linewidth=0)
    plt.subplot(2,2,2)
    TransitionForceBins = np.linspace(0,MaxY)
    plt.hist(TxPlot,bins=TransitionForceBins,orientation="horizontal",
             color=ColorForce,**HistOpts)
    pPlotUtil.lazyLabel("Count","","")
    plt.ylim([0,MaxY])
    plt.subplot(2,2,3)
    ContourBins = np.linspace(0,MaxX)
    plt.hist(L0Plot,bins=ContourBins,color=ColorLength,**HistOpts)
    pPlotUtil.lazyLabel(r"$\frac{L_{\rm WLC}}{L_0}$","Count","")
    plt.xlim([0,MaxX])
    pPlotUtil.savefig(fig,"{:s}Out/ScatterL0vsFTx.png".format(OutDir))
开发者ID:prheenan,项目名称:Research,代码行数:62,代码来源:MainCorrection.py

示例15: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import figure [as 别名]
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,代码行数:33,代码来源:main_allan.py


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