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


Python Pgplot.closeplot方法代码示例

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


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

示例1: estimate_rz

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import closeplot [as 别名]
def estimate_rz(psr, T, show=0, device='/XWIN'):
    """
    estimate_rz(psr, T, show=0, device='/XWIN'):
        Return estimates of a pulsar's average Fourier freq ('r')
        relative to its nominal Fourier freq as well as its
        Fourier f-dot ('z') in bins, of a pulsar.
           'psr' is a psrparams structure describing the pulsar.
           'T' is the length of the observation in sec.
           'show' if true, displays plots of 'r' and 'z'.
           'device' if the device to plot to if 'show' is true.
    """
    startE = keplers_eqn(psr.orb.t, psr.orb.p, psr.orb.e, 1.0E-15)
    numorbpts = int(T / psr.orb.p + 1.0) * 1024 + 1
    dt = T / (numorbpts - 1)
    E = dorbint(startE, numorbpts, dt, psr.orb)
    z = z_from_e(E, psr, T)
    r = T/p_from_e(E, psr) - T/psr.p
    if show:
        times = np.arange(numorbpts) * dt
        Pgplot.plotxy(r, times, labx = 'Time', \
                      laby = 'Fourier Frequency (r)', device=device)
        if device=='/XWIN':
            print 'Press enter to continue:'
            i = raw_input()
        Pgplot.nextplotpage()
        Pgplot.plotxy(z, times, labx = 'Time',
                      laby = 'Fourier Frequency Derivative (z)', device=device)
        Pgplot.closeplot()
    return r.mean(), z.mean()
开发者ID:kernsuite-debian,项目名称:presto,代码行数:31,代码来源:__init__.py

示例2: kuiper_uniform_test

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import closeplot [as 别名]
def kuiper_uniform_test(data, output=0):
    """
    kuiper_uniform_test(data, output=0):
       Conduct a Kuiper test on the data.  The data must be values
       within [0,1) (e.g. phases from a periodicity search).  They
       will be compared to a uniform distribution.  The return value
       is the probability that the data is uniformly distributed.
    """
    sdata = num.asarray(data)
    N = sdata.size
    sdata.sort()
    f0 = num.arange(N, dtype=num.float64)/N
    fn = (num.arange(N, dtype=num.float64)+1.0)/N
    Dp = (fn - sdata).max()
    Dm = (sdata - f0).max()
    D = Dp + Dm
    P = kuiper_prob(D, N)
    if (output):
        xs = (num.arange(N+3, dtype=num.float64)/(N+2.0)).repeat(2)[1:-1]
        ys = num.concatenate((num.asarray([0.0]), sdata, num.asarray([1.0]))).repeat(2)
        Pgplot.plotxy(ys, xs, rangex=[-0.03, 1.03], rangey=[-0.03, 1.03], aspect=1.0, 
                      labx="Fraction of Data", laby="Cumulative Value", width=2)
        Pgplot.plotxy(num.asarray([0.0, 1.0]), num.asarray([0.0, 1.0]), width=1)
        Pgplot.closeplot()
        print("Max distance between the cumulative distributions (D) = %.5g" % D)
        print("Prob the data is from the specified distrbution   (P) = %.3g" % P)
    return (D, P)
开发者ID:matteobachetti,项目名称:presto,代码行数:29,代码来源:kuiper.py

示例3: zeros

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import closeplot [as 别名]
 # Powers averaged over orb.t as a function of orb.w
 pwrs_w = zeros((orbsperpt[ctype], numbins), Float32)
 for ct in range(orbsperpt[ctype]):
     wb = ct * 180.0 / orbsperpt[ctype]
     if debugout:  print('wb = '+repr(wb))
     psr = psrparams_from_list([pp, Pb, xb, ecc[ctype], wb, 0.0])
     for i in range(numffts):
         psr.orb.t = i * Tfft
         tmppwrs = spectralpower(gen_bin_response(0.0, numbetween,
                                                  psr.p, Tfft,
                                                  psr.orb, numbins))
         if debugout:  print('     tb = '+repr(psr.orb.t)+'  Max pow = '+\
            repr(max(tmppwrs)))
         if showplots:
             Pgplot.plotxy(tmppwrs)
             Pgplot.closeplot()
         pwrs_w[ct] = pwrs_w[ct] + tmppwrs
     if showsumplots:
         Pgplot.plotxy(pwrs_w[ct], title='power(w) averaged over orb.t')
         Pgplot.closeplot()
 pwrs_w = pwrs_w / numffts
 max_avg_pow = average(maximum.reduce(pwrs_w,1))
 if showsumplots:
     Pgplot.plotxy(add.reduce(pwrs_w), title='power(w) averaged over orb.t')
     Pgplot.closeplot()
 tim = clock() - stim
 if debugout:
     print('Time for this point was ',tim, ' s.')
 file.write('%8.6f  %10.5f  %10d  %13.9f\n' % \
            (pp, Tfft, int(Tfft/dt), max_avg_pow))
 file.flush()
开发者ID:matteobachetti,项目名称:presto,代码行数:33,代码来源:monte_short.py


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