예제 #1
0
파일: srctable.py 프로젝트: aimran/pwpy
def loadAsOverlay (source, topixel, imgheight):
    headers, cols, recs = readtable (source, stmapping ())
    compact = []

    for rec in recs:
        y, x = topixel ([rec.dec, rec.ra])

        if not hasattr (rec, 'major') or rec.major is None or rec.major == 0:
            compact.append ((x, y))
            continue

        # TODO: draw Gaussians with the right shape
        compact.append ((x, y))

    def drawoverlay (ctxt, width, height, x0, y0, d2p):
        ctxt.set_source_rgb (255, 0, 0)

        for dx, dy in compact:
            cx = (dx + 0.5 - x0) * d2p
            cy = (imgheight - dy - 0.5 - y0) * d2p

            ctxt.move_to (cx - 5, cy)
            ctxt.line_to (cx + 5, cy)
            ctxt.stroke ()
            ctxt.move_to (cx, cy - 5)
            ctxt.line_to (cx, cy + 5)
            ctxt.stroke ()

    return drawoverlay
예제 #2
0
파일: srctable.py 프로젝트: aimran/pwpy
def readst (source, recfactory=Holder, **kwargs):
    return readtable (source, stmapping (**kwargs), recfactory=recfactory)