def testDifferentMagNames(self):
        """The astrometry.net catalog's magnitude columns are not named after filters.

        In that case, the AstrometryNetDataConfig has a mapping to point to the correct columns.
        We should expect that the returned catalog refers to the filter
        requested (not the implementation-dependent column names).
        """
        andConfig = AstrometryNetDataConfig()
        andConfig.load(os.path.join(self.datapath, 'andConfig2.py'))
        baseNameList = ('u', 'g', 'r', 'i', 'z')
        filterNameList = ["my_" + b for b in baseNameList]
        andConfig.magColumnMap = dict(("my_" + b, b) for b in baseNameList)
        andConfig.magErrorColumnMap = dict([('my_' + b, b + "_err")
                                            for b in baseNameList])
        loadANetObj = LoadAstrometryNetObjectsTask(config=self.config,
                                                   andConfig=andConfig)

        loadRes = loadANetObj.loadPixelBox(bbox=self.bbox,
                                           wcs=self.wcs,
                                           filterName="my_r")
        refCat = loadRes.refCat
        self.assertEqual(loadRes.fluxField, "my_r_flux")
        self.assertEqual(len(refCat), self.desNumStarsInPixelBox)
        self.assertObjInBBox(refCat=refCat, bbox=self.bbox, wcs=self.wcs)
        schema = refCat.getSchema()
        for nm in filterNameList:
            schema.find(nm + "_flux")
            schema.find(nm + '_fluxSigma')
    def setUp(self):
        self.datapath = setupAstrometryNetDataDir('photocal')

        self.bbox = lsst.geom.Box2I(lsst.geom.Point2I(0, 0), lsst.geom.Extent2I(3001, 3001))
        crpix = lsst.geom.Box2D(self.bbox).getCenter()
        self.tanWcs = afwGeom.makeSkyWcs(crpix=crpix,
                                         crval=lsst.geom.SpherePoint(215.5, 53.0, lsst.geom.degrees),
                                         cdMatrix=afwGeom.makeCdMatrix(scale=5.1e-5*lsst.geom.degrees))
        self.exposure = afwImage.ExposureF(self.bbox)
        self.exposure.setWcs(self.tanWcs)
        self.exposure.setFilter(afwImage.Filter("r", True))
        andConfig = AstrometryNetDataConfig()
        andConfig.load(os.path.join(self.datapath, 'andConfig2.py'))
        andConfig.magErrorColumnMap = {}
        self.refObjLoader = LoadAstrometryNetObjectsTask(andConfig=andConfig)
Example #3
0
    def testNoMagErrs(self):
        """Exclude magnitude errors from the found catalog
        """
        andConfig = AstrometryNetDataConfig()
        andConfig.load(os.path.join(self.datapath, 'andConfig2.py'))
        andConfig.magErrorColumnMap = {}
        loadANetObj = LoadAstrometryNetObjectsTask(config=self.config, andConfig=andConfig)

        loadRes = loadANetObj.loadPixelBox(bbox=self.bbox, wcs=self.wcs, filterName="r")
        refCat = loadRes.refCat
        self.assertEqual(loadRes.fluxField, "r_flux")
        self.assertEqual(len(refCat), self.desNumStarsInPixelBox)
        self.assertObjInBBox(refCat=refCat, bbox=self.bbox, wcs=self.wcs)
        schema = refCat.getSchema()
        for filterName in ['u', 'g', 'r', 'i', 'z']:
            schema.find(filterName + "_flux")
            with self.assertRaises(KeyError):
                schema.find(filterName + "_fluxSigma")