Esempio n. 1
0
    def setUp(self):

        self.config = measAstrom.MatchOptimisticBTask.ConfigClass()
        self.matchOptimisticB = measAstrom.MatchOptimisticBTask(
            config=self.config)

        metadata = dafBase.PropertySet()
        metadata.set("RADECSYS", "FK5")
        metadata.set("EQUINOX", 2000.0)
        metadata.set("CTYPE1", "RA---TAN")
        metadata.set("CTYPE2", "DEC--TAN")
        metadata.set("CUNIT1", "deg")
        metadata.set("CUNIT2", "deg")
        metadata.set("CRVAL1", 36.930640)
        metadata.set("CRVAL2", -4.939560)
        metadata.set("CRPIX1", 792.4)
        metadata.set("CRPIX2", 560.7)
        metadata.set("CD1_1", -5.17e-05)
        metadata.set("CD1_2", 0.0)
        metadata.set("CD2_2", 5.17e-05)
        metadata.set("CD2_1", 0.0)
        self.wcs = afwImage.makeWcs(metadata)
        self.distortedWcs = self.wcs

        self.filename = os.path.join(os.path.dirname(__file__), "cat.xy.fits")
        self.tolArcsec = .4
        self.tolPixel = .1
Esempio n. 2
0
    def setUp(self):

        self.config = measAstrom.MatchOptimisticBTask.ConfigClass()
        self.matchOptimisticB = measAstrom.MatchOptimisticBTask(config=self.config)
        self.wcs = afwGeom.makeSkyWcs(crpix=lsst.geom.Point2D(791.4, 559.7),
                                      crval=lsst.geom.SpherePoint(36.930640, -4.939560, lsst.geom.degrees),
                                      cdMatrix=afwGeom.makeCdMatrix(scale=5.17e-5*lsst.geom.degrees))
        self.distortedWcs = self.wcs

        self.filename = os.path.join(os.path.dirname(__file__), "cat.xy.fits")
        self.tolArcsec = .4
        self.tolPixel = .1
Esempio n. 3
0
def runMatcher(repodir, visitid, ccdnum, offset):

    butler = dafPersist.Butler(repodir)
    exp = butler.get('calexp', visit=visitid, ccdnum=ccdnum)
    wcs = exp.getWcs()
    sourceCat = butler.get('src', visit=visitid, ccdnum=ccdnum)

    config = measAstrom.LoadAstrometryNetObjectsTask.ConfigClass()
    loadANetObj = measAstrom.LoadAstrometryNetObjectsTask(config=config)
    loadRes = loadANetObj.loadPixelBox(bbox=exp.getBBox(),
                                       wcs=exp.getWcs(),
                                       filterName=exp.getFilter().getName(),
                                       calib=exp.getCalib())
    refCat = loadRes.refCat

    match = measAstrom.MatchOptimisticBTask()
    #matchRes = match.matchObjectsToSources(refCat=loadRes.refCat, sourceCat=sourceCat, wcs=wcs, refFluxField=loadRes.fluxField, maxMatchDist=None)
    # THIS WORKS!!

    # add constant to the source catalog, remember the coords are in RADIANS
    #off = 1.0
    #sourceCat["coord_ra"][:] += math.radians(off/ 3600.0)
    #sourceCat["coord_dec"][:] += math.radians(off / 3600.0)
    # matchOptimisticB does NOT use RA/DEC, it uses X/Y and WCS, offset in pixels
    # fail: 320, 350, 400, 500
    # success: 200, 300
    #offset = 200.0

    print "Offset = ", offset, " pixels"
    sourceCat["slot_Centroid_x"][:] += offset
    sourceCat["slot_Centroid_y"][:] += offset

    # This does NOT work.  Get a "Record data is not contiguous in memory." error
    #print "Offset = ", offset, " arcsec"
    #refCat["coord_ra"][:] += math.radians(offset/3600.)
    #refCat["coord_dec"][:] += math.radians(offset/3600.)

    try:
        matchRes = match.matchObjectsToSources(refCat=loadRes.refCat,
                                               sourceCat=sourceCat,
                                               wcs=wcs,
                                               refFluxField=loadRes.fluxField,
                                               maxMatchDist=None)
        matches = len(matchRes.matches)
        print "Success"
    except:
        print "Failure"
        matches = 0

    print "Matches = ", matches

    return matches