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


Python JLA_library.computeOffsets方法代码示例

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


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

示例1: compute_Ccal

# 需要导入模块: import JLA_library [as 别名]
# 或者: from JLA_library import computeOffsets [as 别名]

#.........这里部分代码省略.........
    # ------------- Create an area to work in -----------------------
    workArea = JLA.get_full_path(options.workArea)
    try:
        os.mkdir(workArea)
    except:
        pass

    # -----------   The lightcurve fitting --------------------------

    firstSN=True
    
    log=open('log.txt','w')

    for i,SN in enumerate(SNeList):
        J=[]
        try:
            os.mkdir(workArea+'/'+SN['id'])
        except:
            pass

        #firstModel=True
        print 'Examining SN #%d %s' % (i+1,SN['id'])

        # Set up the number of processes
        pool = mp.Pool(processes=int(options.processes))
        # runSALT is the program that does the lightcurve fitting
        results = [pool.apply(runSALT, args=(SALTpath,
                                             SALTmodel,
                                             salt_prefix,
                                             SN['lc'],
                                             SN['id'])) for SALTmodel in SALTmodels]
        for result in results[1:]:
            # The first model is the unperturbed model
            dM,dX,dC=JLA.computeOffsets(results[0],result)
            J.extend([dM,dX,dC])
        pool.close() # This prevents to many open files

        if firstSN:
            J_new=numpy.array(J).reshape(nSALTmodels,3).T
            firstSN=False
        else:
            J_new=numpy.concatenate((J_new,numpy.array(J).reshape(nSALTmodels,3).T),axis=0)

        log.write('%d rows %d columns\n' % (J_new.shape[0],J_new.shape[1]))

    log.close()

    # Compute the new covariance matrix J . Cal . J.T produces a 3 * n_SN by 3 * n_SN matrix
    # J=jacobian

    J_smoothed=numpy.array(J_new)*0.0
    J=J_new

    # We need to concatenate the different samples ...
    
    if options.Plot:
        try:
            os.mkdir('figures')
        except:
            pass               

    nPoints={'SNLS':11,'SDSS':11,'nearby':11,'high-z':11,'DES':11} 
    #sampleList=['nearby','DES']
    sampleList=params['smoothList'].split(',')
    if options.smoothed:
        # We smooth the Jacobian 
开发者ID:dessn,项目名称:Covariance,代码行数:70,代码来源:jla_compute_Ccal.py


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