astrom_common.py 文件源码

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

项目:astromalign 作者: dstndstn 项目源码 文件源码
def plotfitquality(H, xe, ye, A):
    '''
    H,xe,ye from plotalignment()
    '''
    import pylab as plt
    xe /= 1000.
    ye /= 1000.
    xx = (xe[:-1] + xe[1:])/2.
    yy = (ye[:-1] + ye[1:])/2.
    XX,YY = np.meshgrid(xx, yy)
    XX = XX.ravel()
    YY = YY.ravel()
    XY = np.vstack((XX,YY)).T
    Mdist = np.sqrt(mahalanobis_distsq(XY, A.mu, A.C))
    assert(len(H.ravel()) == len(Mdist))
    mod = A.getModel(XX, YY)
    R2 = XX**2 + YY**2
    mod[R2 > (A.match.rad)**2] = 0.
    mod *= (H.sum() / mod.sum())
    plt.clf()
    rng = (0, 7)
    plt.hist(Mdist, 100, weights=H.ravel(), histtype='step', color='b', label='data', range=rng)
    plt.hist(Mdist, 100, weights=mod, histtype='step', color='r', label='model', range=rng)
    plt.xlabel('| Chi |')
    plt.ylabel('Number of matches')
    plt.title('Gaussian peak fit quality')
    plt.legend(loc='upper right')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号