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


Python MPIPool.bcast方法代码示例

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


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

示例1: range

# 需要导入模块: from emcee.utils import MPIPool [as 别名]
# 或者: from emcee.utils.MPIPool import bcast [as 别名]
        bnds = np.zeros(3*(ndish-1), dtype=beta0.dtype) # as bounds of values
        for i in range(ndish-1): # for center_dish == 15 only
            bnds[3*i:3*(i+1)] = bnd
    else:
        x0 = np.zeros(3*(ndish-1)+3*num_nf, dtype=beta0.dtype)
        x0[:3*center_dish] = beta0[:3*center_dish]
        x0[3*center_dish:] = beta0[3*(center_dish+1):]
        x1 = np.zeros(3*(ndish-1)+3*num_nf, dtype=beta1.dtype)
        x1[:3*center_dish] = beta1[:3*center_dish]
        x1[3*center_dish:] = beta1[3*(center_dish+1):]
        bnds = np.zeros(3*(ndish-1)+3*num_nf, dtype=beta0.dtype)
        for i in range(ndish-1): # for center_dish == 15 only
            bnds[3*i:3*(i+1)] = bnd
        bnds[-3*num_nf:] = r

Phi = pool.bcast(Phi, root=0)
x0 = pool.bcast(x0, root=0)
x1 = pool.bcast(x1, root=0)
beta0 = pool.bcast(beta0, root=0)
beta1 = pool.bcast(beta1, root=0)
bnds = pool.bcast(bnds, root=0)

ndiff = num_nf * (num_nf - 1) / 2
diff_Phi = np.zeros((ndiff, npol, nbl), dtype=Phi.dtype)
diff_inds = [(i, j) for i in range(num_nf) for j in range(i+1, num_nf)]
for ind, (i, j) in enumerate(diff_inds):
    diff_Phi[ind] = Phi[j] - Phi[i]
diff_Phi = np.mod(diff_Phi, 2*np.pi)

def chi2(x):
开发者ID:zuoshifan,项目名称:dishary,代码行数:32,代码来源:mcmc1.py


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