本文整理匯總了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()
示例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)
示例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()