metrics.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:PyCS 作者: COSMOGRAIL 项目源码 文件源码
def combigauss(subtds, subtderrs, truetds, lensmodelsigma = 0.0):
    """
    Give me submission delays and error bars, as well as the corresponding true delays, in form of numpy arrays.
    I compute the mean and sigma of the combined posterior on the fractional time delay distance error.
    """

    from scipy.stats import norm

    subtdoffs = subtds - truetds
    centers = subtdoffs/truetds
    sigmas = subtderrs/np.fabs(truetds)

    # We convolve with the lensmodelsigma:
    sigmas = np.sqrt(sigmas**2 + lensmodelsigma**2)

    sigma_combi = 1.0 / np.sqrt(np.sum(1.0 / (sigmas**2)))
    center_combi = sigma_combi**2 * np.sum( centers/sigmas**2 )

    probazero = norm.pdf(0.0, center_combi, sigma_combi)

    return (center_combi, sigma_combi, probazero)

    # To plot this you could do:
    #plt.plot(x, norm.pdf(x, center_combi, sigma_combi), ls="--", color="black")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号