astrom_common.py 文件源码

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

项目:astromalign 作者: dstndstn 项目源码 文件源码
def plotalignment(A, nbins=200, M=None, rng=None, doclf=True, docolorbar=True,
                  docutcircle=True, docontours=True, dologhist=False,
                  doaxlines=False, imshowargs={}):
    import pylab as plt
    from astrometry.util.plotutils import plothist, loghist
    if doclf:
        plt.clf()
    if M is None:
        M = A.match
    if dologhist:
        f = loghist
    else:
        f = plothist
    H,xe,ye = f(M.dra_arcsec*1000., M.ddec_arcsec*1000., nbins,
                range=rng, doclf=doclf, docolorbar=docolorbar,
                imshowargs=imshowargs)
    ax = plt.axis()
    if A is not None:
        # The EM fit is based on a subset of the matches;
        # draw the subset cut circle.
        if docutcircle:
            angle = np.linspace(0, 2.*pi, 360)
            plt.plot((A.cutcenter[0] + A.cutrange * np.cos(angle))*1000.,
                     (A.cutcenter[1] + A.cutrange * np.sin(angle))*1000., 'r-')
        if docontours:
            for i,c in enumerate(['b','c','g']*2):
                if i == A.ngauss:
                    break
                for nsig in [1,2]:
                    XY = A.getContours(nsig, c=i)
                    if XY is None:
                        break
                    X,Y = XY
                    plt.plot(X*1000., Y*1000., '-', color=c)#, alpha=0.5)
    if doaxlines:
        plt.axhline(0., color='b', alpha=0.5)
        plt.axvline(0., color='b', alpha=0.5)
    plt.axis(ax)
    plt.xlabel('dRA (mas)')
    plt.ylabel('dDec (mas)')
    return H,xe,ye
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号