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


Python FramedPlot.show方法代码示例

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


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

示例1: plot_T

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_T(self, k, T, Tc=None, Tb=None):
        from biggles import FramedPlot, Curve, PlotKey

        plt=FramedPlot()

        c=Curve(k, T**2)
        c.label = '$T^2$'
        plt.add(c)
        plist = [c]

        if Tc is not None:
            cc=Curve(k,Tc**2,color='blue')
            cc.label = '$Tc^2$'
            plt.add(cc)
            plist.append(cc)

        if Tb is not None:
            tmp = where(Tb < 1.e-5, 1.e-5, Tb)
            cb=Curve(k,tmp**2,color='red')
            cb.label = '$Tb^2$'
            plt.add(cb)
            plist.append(cb)

        plt.xlog=True
        plt.ylog=True
        plt.ylabel = '$T^2'
        plt.xlabel = 'k'
        plt.yrange = [1.e-8,1.0]
        plt.aspect_ratio=1

        if Tc is not None or Tb is not None:
            key=PlotKey(0.1,0.9,plist)
            plt.add(key)

        plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:37,代码来源:linear.py

示例2: test_fit_nfw_dsig

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def test_fit_nfw_dsig(rmin=0.01):

    from biggles import FramedPlot,Points,SymmetricErrorBarsY,Curve
    omega_m=0.25
    z=0.25
    n = lensing.nfw.NFW(omega_m, z)

    r200 = 1.0
    c = 5.0

    rmax = 5.0
    log_rmin = log10(rmin)
    log_rmax = log10(rmax)
    npts = 25
    logr = numpy.linspace(log_rmin,log_rmax,npts)
    r = 10.0**logr

    ds = n.dsig(r, r200, c)
    # 10% errors
    dserr = 0.1*ds
    ds += dserr*numpy.random.standard_normal(ds.size)

    guess = numpy.array([r200,c],dtype='f8')
    # add 10% error to the guess
    guess += 0.1*guess*numpy.random.standard_normal(guess.size)

    res = fit_nfw_dsig(omega_m, z, r, ds, dserr, guess)

    r200_fit = res['r200']
    r200_err = res['r200_err']

    c_fit = res['c']
    c_err = res['c_err']

    print 'Truth:'
    print '    r200: %f' % r200
    print '       c: %f' % c
    print 'r200_fit: %f +/- %f' % (r200_fit,r200_err)
    print '   c_fit: %f +/- %f' % (c_fit,c_err)
    print 'Cov:'
    print res['cov']

    logr = numpy.linspace(log_rmin,log_rmax,1000)
    rlots = 10.0**logr
    yfit = n.dsig(rlots,r200_fit,c_fit)

    plt=FramedPlot()
    plt.add(Points(r,ds,type='filled circle'))
    plt.add(SymmetricErrorBarsY(r,ds,dserr))
    plt.add(Curve(rlots,yfit,color='blue'))

    plt.xlabel = r'$r$ [$h^{-1}$ Mpc]'
    plt.ylabel = r'$\Delta\Sigma ~ [M_{sun} pc^{-2}]$'

    plt.xrange = [0.5*rmin, 1.5*rmax]
    plt.yrange = [0.5*(ds-dserr).min(), 1.5*(ds+dserr).max()]

    plt.xlog=True
    plt.ylog=True
    plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:62,代码来源:fit.py

示例3: plot_nfwfits_byrun

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def plot_nfwfits_byrun(run, name, prompt=False):
    conf = lensing.files.read_config(run)
    d = lensing.sample_read(type='fit', sample=run, name=name)
    omega_m = conf['omega_m']


    rvals = numpy.linspace(d['r'].min(), d['r'].max(),1000)
    for i in xrange(d.size):
        plt = FramedPlot()  
        lensing.plotting.add_to_log_plot(plt, 
                                          d['r'][i],
                                          d['dsig'][i],
                                          d['dsigerr'][i])

        z = d['z_mean'][i]
        n = lensing.nfw.NFW(omega_m, z)
        yfit = n.dsig(rvals, d['r200_fit'][i],d['c_fit'][i])
        plt.add(Curve(rvals,yfit,color='blue'))
        plt.xlog=True
        plt.ylog=True
        plt.xlabel = r'$r$ [$h^{-1}$ Mpc]'
        plt.ylabel = r'$\Delta\Sigma ~ [M_{sun} pc^{-2}]$'
        if prompt:
            plt.show()
            raw_input('hit a key: ')
        else:
            epsfile='/home/esheldon/tmp/plots/desmocks-nfwfit-%02i.eps' % i
            print 'Writing epsfile:',epsfile
            plt.write_eps(epsfile)
开发者ID:esheldon,项目名称:espy,代码行数:31,代码来源:fit.py

示例4: plotprimedens

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def plotprimedens(n):
    pd = primedens(n)
    steps = range(len(pd))
    from biggles import FramedPlot, Curve
    g = FramedPlot()
    g.add(Curve(steps,pd))
    g.show()
    return
开发者ID:neffmallon,项目名称:pistol,代码行数:10,代码来源:perfect.py

示例5: test_interp_hybrid

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def test_interp_hybrid():
    """
    Send y0,y1 with one or both less than zero to test the
    hybrid offset scheme
    """
    slope = -2.0
    #xvals = 0.1+linspace(0.0,8.0,9)
    xvals = 10.0**linspace(0.0,1.0,10)
    yvals = xvals**slope
    #yerr = 0.5*yvals
    #yerr = sqrt(yvals)
    yerr = yvals.copy()
    yerr[:] = 0.05

    #xfine = 0.1+linspace(0.0,8.0,1000)
    xfine = 10.0**linspace(0.0,1.0,1000)
    yfine = xfine**slope 

    #yerr = yvals.copy()
    #yerr[:] = 2

    plt=FramedPlot()
    plt.xrange = [0.5*xvals.min(), 1.5*xvals.max()]
    plt.xlog=True
    #plt.ylog=True
    plt.add(Points(xvals,yvals,type='filled circle',size=1))
    plt.add(Curve(xfine,yfine,color='blue'))
    #w=where1( (yvals-yerr) > 1.e-5 )
    #plt.add(SymmetricErrorBarsY(xvals[w],yvals[w],yerr[w]))
    plt.add(SymmetricErrorBarsY(xvals,yvals,yerr))

    # make points in between consecutive xvals,yvals so we
    # can use hybrid 2-point function
    xi = numpy.zeros(xvals.size-1,dtype='f8')
    yi = numpy.zeros(xi.size,dtype='f8')
    for i in xrange(xi.size):

        logx = (log10(xvals[i+1])+log10(xvals[i]))/2.0
        xi[i] = 10.0**logx
        yi[i],amp,slope,off = interp_hybrid(xvals[i], xvals[i+1], 
                                            yvals[i], yvals[i+1],
                                            yerr[i], yerr[i+1], 
                                            xi[i],more=True)
        
        print 'amp:',amp
        print 'slope:',slope
        print 'off:',off

    print xvals
    print xi
    print yi
    plt.add( Points(xi, yi, type='filled circle', size=1, color='red'))

    plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:56,代码来源:invert.py

示例6: plot_sub_pixel

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def plot_sub_pixel(ellip,theta, show=False):
    import biggles
    from biggles import PlotLabel,FramedPlot,Table,Curve,PlotKey,Points
    from pcolors import rainbow

    f=subpixel_file(ellip,theta,'fits')
    data = eu.io.read(f)
    colors = rainbow(data.size,'hex')

    pltSigma = FramedPlot()
    pltSigma.ylog=1
    pltSigma.xlog=1

    curves=[]
    for j in xrange(data.size):
        sigest2 = (data['Irr'][j,:] + data['Icc'][j,:])/2

        pdiff = sigest2/data['sigma'][j]**2 -1
        nsub=numpy.array(data['nsub'][j,:])

        #pc = biggles.Curve(nsub, pdiff, color=colors[j])
        pp = Points(data['nsub'][j,:], pdiff, type='filled circle',color=colors[j])

        pp.label = r'$\sigma: %0.2f$' % data['sigma'][j]
        curves.append(pp)
        pltSigma.add(pp)
        #pltSigma.add(pc)
        #pltSigma.yrange=[0.8,1.8]
        #pltSigma.add(pp)


    c5 = Curve(linspace(1,8, 20), .005+zeros(20))
    pltSigma.add(c5)

    key=PlotKey(0.95,0.95,curves,halign='right',fontsize=1.7)
    key.key_vsep=1

    pltSigma.add(key)
    pltSigma.xlabel='N_{sub}'
    pltSigma.ylabel=r'$\sigma_{est}^2  /\sigma_{True}^2 - 1$'

    lab=PlotLabel(0.05,0.07,r'$\epsilon: %0.2f \theta: %0.2f$' % (ellip,theta),halign='left')
    pltSigma.add(lab)

    pltSigma.yrange = [1.e-5,0.1]
    pltSigma.xrange = [0.8,20]
    if show:
        pltSigma.show()

    epsfile=subpixel_file(ellip,theta,'eps')

    print("Writing eps file:",epsfile)
    pltSigma.write_eps(epsfile)
开发者ID:esheldon,项目名称:admom,代码行数:55,代码来源:admom_test.py

示例7: plot_pk

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_pk(self,k,pk):
        from biggles import FramedPlot, Curve

        plt=FramedPlot()
        plt.add(Curve(k,pk))
        plt.xlog=True
        plt.ylog=True

        plt.xlabel = r'$k [h/Mpc]$'
        plt.ylabel = r'$P_{lin}(k)$'
        plt.aspect_ratio = 1
        plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:14,代码来源:linear.py

示例8: plot_m

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_m(self, r200, c):
        from biggles import FramedPlot, Curve
        n=1000
        r = numpy.linspace(0.01, 20.0,n)
        m = self.m(r, r200, c)

        plt=FramedPlot()
        plt.add( Curve(r,m) )
        plt.xlog=True
        plt.ylog=True

        plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:14,代码来源:nfw.py

示例9: plot_dsig_one

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def plot_dsig_one(r, dsig, dsigerr, **kw):
    """
    plot delta sigma

    useful if adding to an existing plot

    parameters
    ----------
    r: array
        radius
    dsig: array
        delta sigma
    dsigerr: array
        error on delta sigma
    """

    from biggles import FramedPlot

    nbin=1
    _set_biggles_defs(nbin)

    visible=kw.get('visible',True)
    xlog=kw.get('xlog',True)
    ylog=kw.get('ylog',True)
    aspect_ratio=kw.get('aspect_ratio',1)

    is_ortho=kw.get('is_ortho',False)

    plt=kw.get('plt',None)

    if plt is None:
        plt=FramedPlot()
        plt.aspect_ratio=aspect_ratio
        plt.xlog=xlog
        plt.ylog=ylog

        plt.xlabel = LABELS['rproj']
        if is_ortho:
            plt.ylabel = LABELS['osig']
        else:
            plt.ylabel = LABELS['dsig']

    xrng, yrng = _add_dsig_to_plot(plt, r, dsig, dsigerr, **kw)
    plt.xrange=xrng
    plt.yrange=yrng

    if visible:
        plt.show()

    return plt
开发者ID:esheldon,项目名称:espy,代码行数:52,代码来源:plotting.py

示例10: plot_ellip_vs_input

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_ellip_vs_input(self, show=False):
        '''
        Plot the measured ellip as a function of the input for sigma_index=0
        which is a reasonably large object
        '''
        import biggles
        from biggles import PlotLabel,FramedPlot,Table,Curve,PlotKey,Points
        from pcolors import rainbow
        import pprint

        data = self.read()
        w=where1(data['sigma_index'] == 10)
        data = data[w]
        
        e1_input, e2_input, Tinput = util.mom2ellip(data['Irr_input'],
                                                    data['Irc_input'],
                                                    data['Icc_input'])
        e1_meas, e2_meas, Tinput = util.mom2ellip(data['Irr_meas'],
                                                  data['Irc_meas'],
                                                  data['Icc_meas'])

        einput = sqrt(e1_input**2 + e2_input**2)
        emeas = sqrt(e1_meas**2 + e2_meas**2)

        plt=FramedPlot()

        p = Points(einput,emeas, type='filled circle')
        plt.add(p)
        plt.xlabel=r'$\epsilon_{in}$'
        plt.ylabel=r'$\epsilon_{meas}$'

        sig=sqrt((data['Irr_meas'][0]+data['Icc_meas'][0])/2)
        lab1=PlotLabel(0.1,0.9,self.model, halign='left')
        lab2=PlotLabel(0.1,0.8,r'$\sigma: %0.2f$' % sig, halign='left')
        plt.add(lab1,lab2)


        einput.sort()
        c = Curve(einput, einput, color='red')
        c.label = r'$\epsilon_{input} = \epsilon_{meas}$'
        key=PlotKey(0.95,0.07,[c], halign='right')
        plt.add(c)
        plt.add(key)
        if show:
            plt.show()

        epsfile=self.epsfile('ellip-vs-input')
        print("Writing eps file:",epsfile)
        plt.write_eps(epsfile)
开发者ID:esheldon,项目名称:admom,代码行数:51,代码来源:admom_test.py

示例11: plot_boss_geometry

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def plot_boss_geometry(color=None, colorwheel=None, plt=None, width=1, show=True,
                       region=None):
    """
    Plot the boundaries in the boss_survey.par file
    """
    import esutil as eu
    import biggles
    from biggles import FramedPlot, Curve

    bg = read_boss_geometry()

    if plt is None:
        plt = FramedPlot()
        plt.xlabel=r'$\lambda$'
        plt.ylabel=r'$\eta$'

    if color is not None:
        colors = [color]*len(bg)
    elif colorwheel is not None:
        colors = colorwheel
    else:
        colors = ['red','blue','green','magenta','navyblue','seagreen',
                  'firebrick','cadetblue','green4']
        

    for i in xrange(len(bg)):
        b = bg[i]
        color = colors[i % len(colors)]
        c = eu.plotting.bbox( b['clambdaMin'], b['clambdaMax'], b['cetaMin'], b['cetaMax'],
                             color=color, width=width)
        plt.add(c)

    if region == 'ngc':
        plt.yrange = [-40.,50.]
        plt.xrange = [-80.,80.]
    elif region == 'sgc':
        plt.yrange = [105.,165.]
        plt.xrange = [-60.,60.]
    else:
        plt.yrange = [-40.,165.]
        plt.xrange = [-80.,80.]


    plt.aspect_ratio = (plt.yrange[1]-plt.yrange[0])/(plt.xrange[1]-plt.xrange[0])

    if show:
        plt.show()

    return plt
开发者ID:esheldon,项目名称:espy,代码行数:51,代码来源:stomp_maps.py

示例12: plot_xi

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_xi(self, r, xi):
        from biggles import FramedPlot, Curve
        minval = 1.e-4

        xi = where(xi < minval, minval, xi)

        plt=FramedPlot()
        plt.add(Curve(r,xi))
        plt.xlog=True
        plt.ylog=True

        plt.xlabel = r'$r [Mpc/h]$'
        plt.ylabel = r'$\xi_{lin}(r)$'
        plt.aspect_ratio=1
        plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:17,代码来源:linear.py

示例13: plot_size_vs_input

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def plot_size_vs_input(self, show=False):
        '''
        Plot recovered size vs input for ellip=0, which is ellip_index=0
        '''

        import biggles
        from biggles import PlotLabel,FramedPlot,Table,Curve,PlotKey,Points
        from pcolors import rainbow
        import pprint

        data = self.read()
        w=where1(data['ellip_index'] == 0)
        data = data[w]

        siginput = sqrt(data['Irr_input'])
        sigmeas  = sqrt(data['Irr_meas'])


        pars=numpy.polyfit(siginput, sigmeas, 1)
        print("offset:",pars[1])
        print("slope: ",pars[0])
        print("IGNORING OFFSET")

        plt=FramedPlot()

        p = Points(siginput,sigmeas, type='filled circle')
        plt.add(p)
        plt.xlabel=r'$\sigma_{in}$'
        plt.ylabel=r'$\sigma_{meas}$'

        lab=PlotLabel(0.1,0.9,self.model)
        plt.add(lab)

        yfit2=pars[0]*siginput
        cfit2=Curve(siginput, yfit2, color='steel blue')
        cfit2.label = r'$%0.2f \sigma_{in}$' % pars[0]

        plt.add( cfit2 )

        key=PlotKey(0.95,0.07,[cfit2], halign='right')
        plt.add(key)
        if show:
            plt.show()

        epsfile=self.epsfile('size-vs-input')
        print("Writing eps file:",epsfile)
        plt.write_eps(epsfile)
开发者ID:esheldon,项目名称:admom,代码行数:49,代码来源:admom_test.py

示例14: compare_all_other

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
    def compare_all_other(self, type, show=True):
        
        fdict=self.all_other_fdict(type)

        # this is the original file.  It has the redshifts
        orig = zphot.weighting.read_training(fdict['origfile'])

        # this is the outputs
        num = zphot.weighting.read_num(fdict['numfile1'])

        # this is the weights file
        weights = zphot.weighting.read_training(fdict['wfile2'])

        # recoverable set
        w_recoverable = where1(num['num'] > 0)
        # this is actually the indexes back into the "orig" file
        w_keep = num['photoid'][w_recoverable]

        # get the z values for these validation objects
        zrec = orig['z'][w_keep]

        binsize=0.0314
        valid_dict = histogram(zrec, min=0, max=1.1, binsize=binsize, more=True)
        plt=FramedPlot()

        vhist = valid_dict['hist']/(float(valid_dict['hist'].sum()))
        pvhist=biggles.Histogram(vhist, x0=valid_dict['low'][0], binsize=binsize)
        pvhist.label = 'truth'

        weights_dict = histogram(weights['z'], min=0, max=1.1, binsize=binsize,
                                 weights=weights['weight'], more=True)
        whist = weights_dict['whist']/weights_dict['whist'].sum()
        pwhist=biggles.Histogram(whist, x0=weights_dict['low'][0], 
                                 binsize=binsize, color='red')
        pwhist.label = 'weighted train'

        key = PlotKey(0.6,0.6,[pvhist,pwhist])
        plt.add(pvhist,pwhist,key)

        plt.add( biggles.PlotLabel(.8, .9, type) )

        plt.write_eps(fdict['zhistfile'])
        converter.convert(fdict['zhistfile'],dpi=90,verbose=True)
        if show:
            plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:47,代码来源:validation.py

示例15: test_rainbow

# 需要导入模块: from biggles import FramedPlot [as 别名]
# 或者: from biggles.FramedPlot import show [as 别名]
def test_rainbow():
    import numpy
    from biggles import FramedPlot, Points, Curve
    num = 20

    plt = FramedPlot()

    x = numpy.linspace(0.0, 1.0, num)
    y = x**2

    colors = rainbow(num, 'hex')

    for i in xrange(num):
        p = Points([x[i]], [y[i]], type='filled circle', 
                   color=colors[i])
        c = Curve([x[i]],[y[i]], color=colors[i])
        plt.add(p,c)
    plt.show()
开发者ID:esheldon,项目名称:espy,代码行数:20,代码来源:pcolors.py


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