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


Python pylab.errorbar函数代码示例

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


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

示例1: demo

def demo():
    import pylab

    # The module normalize is not part of the osrefl code base.
    from reflectometry.reduction import normalize

    from .examples import ng7 as dataset
    spec = dataset.spec()[0]
    water = WaterIntensity(D2O=20,probe=spec.probe)
    spec.apply(normalize())
    theory = water.model(spec.Qz,spec.detector.wavelength)

    pylab.subplot(211)
    pylab.title('Data normalized to water scattering (%g%% D2O)'%water.D2O)
    pylab.xlabel('Qz (inv Ang)')
    pylab.ylabel('Reflectivity')
    pylab.semilogy(spec.Qz,theory,'-',label='expected')
    scale = theory[0]/spec.R[0]
    pylab.errorbar(spec.Qz,scale*spec.R,scale*spec.dR,fmt='.',label='measured')

    spec.apply(water)
    pylab.subplot(212)
    #pylab.title('Intensity correction factor')
    pylab.xlabel('Slit 1 opening (mm)')
    pylab.ylabel('Incident intensity')
    pylab.yscale('log')
    pylab.errorbar(spec.slit1.x,spec.R,spec.dR,fmt='.',label='correction')

    pylab.show()
开发者ID:reflectometry,项目名称:osrefl,代码行数:29,代码来源:ratiocor.py

示例2: NormDeltaRvT

def NormDeltaRvT(folder,keys):
  if folder[0]['IVtemp']<250 and folder[0]['IVtemp']>5:
    APiterator = [5,10]
    AP = Analysis.AnalyseFile()
    P = Analysis.AnalyseFile()
    tsum = 0.0
    for f in folder:
      if f['iterator'] in APiterator:
        AP.add_column(f.column('Voltage'),str(f['iterator']))
      else:
        P.add_column(f.column('Voltage'),str(f['iterator']))
      tsum = tsum + f['Sample Temp']
      
    AP.apply(func,0,replace=False,header='Mean NLV')
    AP.add_column(f.Current,column_header = 'Current')
    P.apply(func,0,replace=False,header='Mean NLV')
    P.add_column(f.Current,column_header = 'Current')
    
    APfit= AP.curve_fit(quad,'Current','Mean NLV',bounds=lambda x,y:x,result=True,header='Fit',asrow=True)
    Pfit = P.curve_fit(quad,'Current','Mean NLV',bounds=lambda x,y:x,result=True,header='Fit',asrow=True)
    
    DeltaR = Pfit[2] - APfit[2]
    ErrDeltaR = numpy.sqrt((Pfit[3]**2)+(APfit[3]**2))
    Spinsig.append(DeltaR/Res_Cu(tsum/10))
    Spinsig_error.append(ErrDeltaR)
    
    Temp.append(tsum/10)
    
    plt.hold(True)
    plt.title('$\Delta$R$_s$ vs T from linear coef of\nNLIV fit for '+f['Sample ID'],verticalalignment='bottom')
    plt.xlabel('Temperture (K)')
    plt.ylabel(r'$\Delta$R$_s$/$\rho$')
    plt.errorbar(f['IVtemp'],1e3*DeltaR,1e3*ErrDeltaR,ecolor='k',marker='o',mfc='r', mec='k')
    #plt.plot(f['IVtemp'],ErrDeltaR,'ok')
    return Temp, Spinsig
开发者ID:joebatley,项目名称:PythonCode,代码行数:35,代码来源:NLIVvsHvsT.py

示例3: plot_sed

def plot_sed(fluxes, backgrounds, errors, **kwargs):
    """
    Trivial SED plotting
    """
    pl.errorbar(band_waves.values(),fluxes-backgrounds,yerr=errors,marker='s', **kwargs)
    pl.xlabel('$\lambda$ (mm)')
    pl.ylabel('mJy/beam')
开发者ID:BGPS,项目名称:MUSIC_usualsuspects,代码行数:7,代码来源:sed_from_dict.py

示例4: _show_rates

def _show_rates(rate, wo, wt, attenuator, tau_NP, tau_P):
    import pylab

    #pylab.figure()
    pylab.errorbar(rate, wt[0], yerr=wt[1], fmt='g.', label='attenuated')
    pylab.errorbar(rate, wo[0], yerr=wo[1], fmt='b.', label='unattenuated')

    pylab.xscale('log')
    pylab.yscale('log')
    pylab.xlabel('incident rate (counts/second)')
    pylab.ylabel('observed rate (counts/second)')
    pylab.legend(loc='best')
    pylab.grid(True)
    pylab.plot(rate, rate/attenuator, 'g-', label='target')
    pylab.plot(rate, rate, 'b-', label='target')

    Ipeak, Rpeak = peak_rate(tau_NP=tau_NP, tau_P=tau_P)
    if rate[0] <= Ipeak <= rate[-1]:
        pylab.axvline(x=Ipeak, ls='--', c='b')
        pylab.text(x=Ipeak, y=0.05, s=' %g'%Ipeak,
                   ha='left', va='bottom',
                   transform=pylab.gca().get_xaxis_transform())
    if False:
        pylab.axhline(y=Rpeak, ls='--', c='b')
        pylab.text(y=Rpeak, x=0.05, s=' %g\n'%Rpeak,
                   ha='left', va='bottom',
                   transform=pylab.gca().get_yaxis_transform())
开发者ID:reflectometry,项目名称:reduction,代码行数:27,代码来源:deadtime_fit.py

示例5: plot

	def plot(self, params, errors=None,label=''):
		params=[max(1e-100,p) for p in params]
		E=np.concatenate(([self._ERange[0]],self._splitE,[self._ERange[1]]))
		pl.plot(reduce(lambda a,b:a+b,[[e,e] for e in E]),[1e-10]+reduce(lambda a,b:a+b,[[p,p] for p in params])+[1e-10],label=label)
		if errors!=None:
			for i in range(len(E)-1):
				pl.errorbar([np.sqrt(E[i]*E[i+1])],[params[i]],yerr=[errors[i]],fmt='r')
开发者ID:kpws,项目名称:BSUnfold,代码行数:7,代码来源:spectrumModel.py

示例6: show_table

def show_table(table_name,ls="none", fmt="o", legend=False, name="m", do_half=0):
	bt = fi.FITS(table_name)[1].read()
	rgpp = (np.unique(bt["rgp_lower"])+np.unique(bt["rgp_upper"]))/2
	nbins = rgpp.size

	plt.xscale("log")
	colours=["purple", "forestgreen", "steelblue", "pink", "darkred", "midnightblue", "gray", "sienna", "olive", "darkviolet"]
	pts = ["o", "D", "x", "^", ">", "<", "1", "s", "*", "+", "."]
	for i,r in enumerate(rgpp):
		sel = (bt["i"]==i)
		snr = 10** ((np.log10(bt["snr_lower"][sel]) + np.log10(bt["snr_upper"][sel]))/2)

		if do_half==1 and i>nbins/2:
			continue
		elif do_half==2 and i<nbins/2:
			continue
		if legend:
			plt.errorbar(snr, bt["%s"%name][i*snr.size:(i*snr.size)+snr.size], bt["err_%s"%name][i*snr.size:(i*snr.size)+snr.size], color=colours[i], ls=ls, fmt=pts[i], lw=2.5, label="$R_{gpp}/R_p = %1.2f-%1.2f$"%(np.unique(bt["rgp_lower"])[i],np.unique(bt["rgp_upper"])[i]))
		else:
			plt.errorbar(snr, bt["%s"%name][i*snr.size:(i*snr.size)+snr.size], bt["err_%s"%name][i*snr.size:(i*snr.size)+snr.size], color=colours[i], ls=ls, fmt=pts[i], lw=2.5)

	plt.xlim(10,300)
	plt.axhline(0, lw=2, color="k")
	
	plt.xlabel("Signal-to-Noise $SNR_w$")
	if name=="m":
		plt.ylim(-0.85,0.05)
		plt.ylabel("Multiplicative Bias $m \equiv (m_1 + m_2)/2$")
	elif name=="alpha":
		plt.ylabel(r"PSF Leakage $\alpha \equiv (\alpha _1 + \alpha _2)/2$")
		plt.ylim(-0.5,2)



	plt.legend(loc="lower right")
开发者ID:ssamuroff,项目名称:cosmology_code,代码行数:35,代码来源:nbc.py

示例7: plot_data

def plot_data(yRange=None):
    '''
    Plots and saves the cell measurement data.  Returns nothing.
    '''
    fig = plt.figure(figsize=(18,12))
    ax = plt.subplot(111)
    plt.errorbar(range(len(avgCells.index)), avgCells[column], yerr=stdCells[column], fmt='o')
    ax = plt.gca()
    ax.set(xticks=range(len(avgCells.index)), xticklabels=avgCells.index)
    xlims = ax.get_xlim()
    ax.set_xlim([lim-1 for lim in xlims])
    # adjust yRange if it was specified
    if yRange!=None:
        ax.set_ylim(yRange)
        fileName = column + ' exlcuding outliers'
    else:
        fileName = column
    plt.subplots_adjust(bottom=0.2, right=0.98, left=0.05)
    plt.title(column)
    plt.ylabel('mm')
    locs, labels = plt.xticks()
    plt.setp(labels, rotation=90)
    mng = plt.get_current_fig_manager()
    mng.window.state('zoomed')
    #plt.show()
    path1 = 'Y:/Test data/ACT02/vision inspection/plot_100_cells/'
    path2 = 'Y:/Nate/git/nuvosun-python-lib/vision system/plot_100_cells/'
    fig.savefig(path1 + fileName, bbox_inches = 'tight')
    fig.savefig(path2 + fileName, bbox_inches = 'tight')
    plt.close()
开发者ID:nateGeorge,项目名称:nuvosun-python-lib,代码行数:30,代码来源:check+precision.py

示例8: p2dscatter

def p2dscatter(self, log=False, color=None, label=None, orientation='horizontal', **kwargs):
    """ use pylab.errorplot to visualize these scatter points
        
        Parameters:
          log        : if true create logartihmic plot

          (all other kwargs will be passed to pylab.errobar)
    """
    if len(self.x) == 0:
        return

    ax = p.gca()
    if color is None:
        color = next(ax._get_lines.color_cycle)
    
    kw = {"xerr" : self.xerr, "yerr" : self.yerr, "fmt" : "k", "capsize" : 0., "linestyle" : 'None', "color" : color}
    kw.update(kwargs)
    
    if orientation == 'vertical':
        x, y = self.y, self.x
        kw["xerr"], kw["yerr"] = kw["yerr"], kw["xerr"]
        axis_name = 'x'
    else:
        x, y = self.x, self.y
        axis_name = 'y'
    
    _set_logscale(ax, log, axis=axis_name)
    
    p.errorbar(x, y, **kw) 
        
    if not hasattr(ax, "_legend_proxy"):
        ax._legend_proxy = LegendProxy(ax)
    ax._legend_proxy.add_scatter(label=label, color=color)
    
    _h2label(self, orientation)
开发者ID:iamankit1995,项目名称:dashi,代码行数:35,代码来源:histviews.py

示例9: _plot_aggr_random

    def _plot_aggr_random(self, span, Nmax, marker='o', color='r', markersize=6):
        # those are the best submitter. Nothing to recompute, can be extracted
        # from the df itself.
        iauc = [self.df.ix[x].mean_auc for x in range(0, Nmax)]

        pylab.clf()
        pylab.plot([x for x in span], iauc, marker+color, markersize=markersize,
                   label="AUC (individual submissions)".format(self.mode))
        pylab.grid(True)
        #pylab.plot()
        pylab.xlabel("N", fontsize=20)
        pylab.ylabel("AUROC", fontsize=20)
        pylab.title("Aggregated AUROC (random case)", fontsize=20)

        pylab.errorbar(span, self.results.mean(axis=0), self.results.std(axis=0),
                       label="{} aggregation (over N submissions)".format(self.mode))
        pylab.legend(loc="lower left")

        self._random_results = {}
        self._random_results['x'] = span
        self._random_results['individual'] = iauc
        self._random_results['aggregation_mean'] = list(self.results.mean(axis=0))
        self._random_results['aggregation_std'] = list(self.results.std(axis=0))
        self._random_results['aggregation_all'] = [list(x) for x in self.results]

        xmax = pylab.xlim()[1]
        pylab.ylim([0.35, 0.86])
        pylab.xlim(0.5, xmax)
开发者ID:nagyistoce,项目名称:dreamtools,代码行数:28,代码来源:aggregation.py

示例10: plot_dmsq2

def plot_dmsq2(HOpions, OOpions, title=None, save=False, name=''):
    "Plot m^2_{vs} - m^2_{vv}/2."
    
    # Set up figure.
    fig = p.figure()
    p.rc('text', usetex=True)
    p.rc('font', size=16)
    p.rc('axes', linewidth=0.5)
    p.xlabel('$am_{s}$')
    p.ylabel('$m^2_{vs} - m^2_{vv}/2$')
    legend = ()

    xr = np.linspace(0.0,0.06)

    # First data set.
    hopions = [HOpions[1], HOpions[5]]
    r = OOpions[3]
    xs = [q.m1 for q in hopions]
    ys = [(q.msq - r.msq/2) for q in hopions]
    es = [nerror(q.sig_msq, r.sig_msq) for q in hopions]
    fit = line_fit2(zip(xs,ys,es))
    legend += p.errorbar(xs, ys, fmt='bo')[0],
    # Fit results
    p.errorbar(xr, fit.a+fit.b*xr, fmt='b-')
    print fit.a, fit.sig_a

    if save:
        p.savefig(name)
    else:
        p.show()
开发者ID:atlytle,项目名称:tifr,代码行数:30,代码来源:dmix_analysis.py

示例11: plot_results

    def plot_results(self, results, xloc, color, ls, label):
        iter_counts = sorted(set([it for it, av in results.keys() if av == self.average]))
        sorted_results = [results[it, self.average] for it in iter_counts]

        avg = np.array([r.train_logprob() for r in sorted_results])
        if hasattr(r, 'train_logprob_interval'):
            lower = np.array([r.train_logprob_interval()[0] for r in sorted_results])
            upper = np.array([r.train_logprob_interval()[1] for r in sorted_results])

        if self.logscale:
            plot_cmd = pylab.semilogx
        else:
            plot_cmd = pylab.plot

        xloc = xloc[:len(avg)]

        lw = 2.

        if label not in self.labels:
            plot_cmd(xloc, avg, color=color, ls=ls, lw=lw, label=label)
        else:
            plot_cmd(xloc, avg, color=color, ls=ls, lw=lw)

        self.labels.add(label)

        pylab.xticks(fontsize='xx-large')
        pylab.yticks(fontsize='xx-large')

        try:
            pylab.errorbar(xloc, (lower+upper)/2., yerr=(upper-lower)/2., fmt='', ls='None', ecolor=color)
        except:
            pass
开发者ID:rgrosse,项目名称:fang,代码行数:32,代码来源:plotting.py

示例12: __primativePlotTGNs__

 def __primativePlotTGNs__(self,bare=bool(False)):
   """
   Is a macro of plotting commands that takes a list of TGNs that
   plots each of these individually as a collection of points.
   Creates a figure plotting the thread of list of TGNs using the
   centroid and an X,Y error bars.  Take a optional boolean to
   make the plot not include a title and legend
   """
   #Determine the index that corresponds to X and Y quantities
   xIndex=0
   yIndex=0
   xLabel="NULL"
   yLabel="NULL"
   (xIndex,xLabel,yIndex,yLabel)=self.__getIndexAndLabels__()
   plotValues=list()
   gpsTimesInList=list()
   for thisTGN in self.tgnList:
       label=str(thisTGN.getID())
       #Get the X,Y property
       (xC,xE)=thisTGN.getCentroidErrorViaIndex(xIndex)
       (yC,yE)=thisTGN.getCentroidErrorViaIndex(yIndex)
       plotValues.append([xC,yC,xE,yE,label])
       gpsTimesInList.append(thisTGN.getGPS())
   for x,y,ex,ey,txtLabel in plotValues:
       pylab.errorbar(x,y,xerr=ex,yerr=ey,label=txtLabel,marker='o')
   pylab.xlabel(str(xLabel))
   pylab.ylabel(str(yLabel))
   if not bare:
     pylab.title("TGNs: %i"%(min(gpsTimesInList)))
     pylab.legend()
开发者ID:GeraintPratten,项目名称:lalsuite,代码行数:30,代码来源:autotrackutils.py

示例13: plot_fitness

    def plot_fitness(self, show=True, save=False):
        df = pd.DataFrame([res['t1opt']['results']['Best_score'].values
            for res in self.results.allRes])

        df = df.astype(float)

        pylab.clf()
        for res in self.results.allRes:
            pylab.plot(res['t1opt']['results']['Best_score'], '--', color='grey')
        pylab.grid()
        pylab.xlabel("Generation")
        pylab.ylabel("Score")
        #pylab.plot(df.mean().values, 'kx--', lw=3, label='Mean Score')

        y = df.mean().values
        x = range(0, len(y))
        yerr = df.std().values
        pylab.errorbar(x, y, yerr=yerr, xerr=None, fmt='-', label='Mean Score',
                color='k', lw=3)
        pylab.legend()

        if save is True:
            self._report.savefig("fitness.png")

        if show is False:
            pylab.close()
开发者ID:cellnopt,项目名称:cellnopt,代码行数:26,代码来源:cnorfuzzy.py

示例14: nishiyama09

def nishiyama09(wavelength, AKs, makePlot=False):
    # Data pulled from Nishiyama et al. 2009, Table 1

    filters = ['V', 'J', 'H', 'Ks', '[3.6]', '[4.5]', '[5.8]', '[8.0]']
    wave =      np.array([0.551, 1.25, 1.63, 2.14, 3.545, 4.442, 5.675, 7.760])
    A_AKs =     np.array([16.13, 3.02, 1.73, 1.00, 0.500, 0.390, 0.360, 0.430])
    A_AKs_err = np.array([0.04,  0.04, 0.03, 0.00, 0.010, 0.010, 0.010, 0.010])

    # Interpolate over the curve
    spline_interp = interpolate.splrep(wave, A_AKs, k=3, s=0)

    A_AKs_at_wave = interpolate.splev(wavelength, spline_interp)
    A_at_wave = AKs * A_AKs_at_wave

    if makePlot:
        py.clf()
        py.errorbar(wave, A_AKs, yerr=A_AKs_err, fmt='bo', 
                    markerfacecolor='none', markeredgecolor='blue',
                    markeredgewidth=2)
        
        # Make an interpolated curve.
        wavePlot = np.arange(wave.min(), wave.max(), 0.1)
        extPlot = interpolate.splev(wavePlot, spline_interp)
        py.loglog(wavePlot, extPlot, 'k-')

        # Plot a marker for the computed value.
        py.plot(wavelength, A_AKs_at_wave, 'rs',
                markerfacecolor='none', markeredgecolor='red',
                markeredgewidth=2)
        py.xlabel('Wavelength (microns)')
        py.ylabel('Extinction (magnitudes)')
        py.title('Nishiyama et al. 2009')

    
    return A_at_wave
开发者ID:jluastro,项目名称:JLU-python-code,代码行数:35,代码来源:synthetic.py

示例15: scatter_stats

def scatter_stats(db, s1, s2, f1=None, f2=None, **kwargs):
    if f1 == None:
        f1 = lambda x: x  # constant function

    if f2 == None:
        f2 = f1

    x = []
    xerr = []

    y = []
    yerr = []

    for k in db:
        x_k = [f1(x_ki) for x_ki in db[k].__getattribute__(s1).gettrace()]
        y_k = [f2(y_ki) for y_ki in db[k].__getattribute__(s2).gettrace()]

        x.append(pl.mean(x_k))
        xerr.append(pl.std(x_k))

        y.append(pl.mean(y_k))
        yerr.append(pl.std(y_k))

        pl.text(x[-1], y[-1], " %s" % k, fontsize=8, alpha=0.4, zorder=-1)

    default_args = {"fmt": "o", "ms": 10}
    default_args.update(kwargs)
    pl.errorbar(x, y, xerr=xerr, yerr=yerr, **default_args)
    pl.xlabel(s1)
    pl.ylabel(s2)
开发者ID:aflaxman,项目名称:bednet_stock_and_flow,代码行数:30,代码来源:explore.py


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