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


Python PALutils.createGWB方法代码示例

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


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

示例1: enumerate

# 需要导入模块: import PALutils [as 别名]
# 或者: from PALutils import createGWB [as 别名]
################## SIMULATED RESIDUALS ########################

# create idealized TOAs
if args.real == False:
    print 'Creating Idealized TOAs'
    for p in pp:
        p.stoas[:] -= p.residuals()/86400
        p.fit()

# add gwb
if args.gwb:
    
    print 'Simulating GWB with Amp = {0} and gamma = {1}'.format(args.gwbAmp, args.gwbIndex)

    inducedRes = PALutils.createGWB(psr, args.gwbAmp, args.gwbIndex)
        
    # add to site arrival times of pulsar
    for ct, p in enumerate(pp):
        p.stoas[:] += np.longdouble(inducedRes[ct]/86400)

# add DM variations
if args.DM:

    print 'Simulating DM using values in hdf5 file'

    for ct, p in enumerate(psr):

        # get values from hdf5 file
        try:
            DMAmp = pfile['Data']['Pulsars'][p.name]['DMAmp'].value
开发者ID:stevertaylor,项目名称:PAL,代码行数:32,代码来源:PALSimulation.py

示例2: upperLimitFunc

# 需要导入模块: import PALutils [as 别名]
# 或者: from PALutils import createGWB [as 别名]
def upperLimitFunc(A, optstat_ref, nreal):
    """
    Compute the value of the Optimal Statistic for different signal realizations
    
    @param A: value of GWB amplitude
    @param optstat_ref: value of optimal statistic with no injection 
    @param nreal: number of realizations

    """
    count = 0
    for ii in range(nreal):
        
        # create residuals
        inducedRes = PALutils.createGWB(psr, A, 4.3333)

        Pinvr = []
        Pinv = []
        for ct, p in enumerate(psr):

            # replace residuals in pulsar object
            p.res = res[ct] + np.dot(R[ct], inducedRes[ct])

            # determine injected amplitude by minimizing Likelihood function
            c = np.dot(Dmatrix[ct], p.res)
            f = lambda x: -PALutils.twoComponentNoiseLike(x, D[ct], c)
            fbounded = minimize_scalar(f, bounds=(0, 1e-14, 3.0e-13), method='Brent')
            Amp = np.abs(fbounded.x)
            #print Amp
            #Amp = A

            # construct P^-1 r
            Pinvr.append(c/(Amp**2 * D[ct] + 1))
            Pinv.append(1/(Amp**2 * D[ct] + 1))

        # construct optimal statstic
        k = 0
        top = 0
        bot = 0
        for ll in range(npsr):
            for kk in range(ll+1, npsr):

                # compute numerator of optimal statisic
                top += ORF[k]/2 * np.dot(Pinvr[ll], np.dot(SIJ[k], Pinvr[kk]))

                # compute trace term
                bot += (ORF[k]/2)**2 * np.trace(np.dot((Pinv[ll]*SIJ[k].T).T, (Pinv[kk]*SIJ[k]).T))
                # iterate counter 
                k += 1

        # get optimal statistic and SNR
        optStat = top/bot
        snr = top/np.sqrt(bot)
        
        # check to see if larger than in real data
        if optStat > optstat_ref:
            count += 1


    # now get detection probability
    detProb = count/nreal

    print A, detProb
    injAmp.append(A)
    injDetProb.append(detProb)

    return detProb - 0.95
开发者ID:jellis18,项目名称:PAL,代码行数:68,代码来源:optStatUpperLimitRmatrix.py

示例3: enumerate

# 需要导入模块: import PALutils [as 别名]
# 或者: from PALutils import createGWB [as 别名]
    for ct, p in enumerate(pp):

        inducedRes = (PALutils.createResiduals(psr[ct], np.pi/2-args.gwdec, args.gwra, args.gwchirpmass, \
                                args.gwdist, args.gwfreq, args.gwphase, args.gwpolarization, \
                                args.gwinc))

        # add to site arrival times of pulsar
        p.stoas[:] += np.longdouble(inducedRes/86400)

# add gwb
if args.gwb:
    
    print 'Simulating GWB with Amp = {0} and gamma = {1}'.format(args.gwbAmp, args.gwbIndex)

    inducedRes = PALutils.createGWB(psr, args.gwbAmp, args.gwbIndex)
        
    # add to site arrival times of pulsar
    for ct, p in enumerate(pp):
        p.stoas[:] += np.longdouble(inducedRes[ct]/86400)

# add noise based on values in hdf5 file
if args.noise:
    
    print 'Simulating noise based on values in hdf5 file'

    for ct, p in enumerate(psr):

        # get values from hdf5 file
        Amp = pfile['Data']['Pulsars'][p.name]['Amp'].value
        gam = pfile['Data']['Pulsars'][p.name]['gam'].value
开发者ID:LindleyLentati,项目名称:PAL,代码行数:32,代码来源:PALSimulation.py


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