Beispiel #1
0
    def testRejection(self):
        """Test image registration with rejection"""
        inData = self.create()

        # Tweak a source to have a bad offset
        badIndex = 111

        coordKey = inData.inputSources[badIndex].getTable().getCoordKey()
        centroidKey = inData.inputSources[badIndex].getTable().getCentroidKey()
        x, y = float(inData.xInput[badIndex] + 0.01), float(inData.yInput[badIndex] - 0.01)
        point = afwGeom.Point2D(x, y)
        inData.inputSources[badIndex].set(centroidKey, point)
        inData.inputSources[badIndex].set(coordKey, inData.wcs.pixelToSky(point))

        config = RegisterConfig()
        config.sipRej = 10.0

        outData = self.runTask(inData)
        self.assertRegistered(inData, outData, bad=set([badIndex]))
        self.assertMetadata(outData, numRejected=1)
Beispiel #2
0
    def testRejection(self):
        """Test image registration with rejection"""
        inData = self.create()

        # Tweak a source to have a bad offset
        badIndex = 111
        
        coordKey = inData.inputSources[badIndex].getTable().getCoordKey()
        centroidKey = inData.inputSources[badIndex].getTable().getCentroidKey()
        x,y = float(inData.xInput[badIndex] + 0.01), float(inData.yInput[badIndex] - 0.01)
        point = afwGeom.Point2D(x, y)
        inData.inputSources[badIndex].set(centroidKey, point)
        inData.inputSources[badIndex].set(coordKey, inData.wcs.pixelToSky(point))

        config = RegisterConfig()
        config.sipRej = 10.0

        outData = self.runTask(inData)
        self.assertRegistered(inData, outData, bad=set([badIndex]))
        self.assertMetadata(outData, numRejected=1)
Beispiel #3
0
    def runTask(self, inData, config=RegisterConfig()):
        """Run the task on the data"""
        config.sipOrder = 2
        task = RegisterTask(name="register", config=config)
        results = task.run(inData.inputSources, inData.inputExp.getWcs(),
                           inData.inputExp.getBBox(afwImage.LOCAL), inData.templateSources)
        warpedExp = task.warpExposure(inData.inputExp, results.wcs, inData.templateExp.getWcs(),
                                      inData.templateExp.getBBox(afwImage.LOCAL))
        warpedSources = task.warpSources(inData.inputSources, results.wcs, inData.templateExp.getWcs(),
                                         inData.templateExp.getBBox(afwImage.LOCAL))

        self.showImage(warpedExp, warpedSources, "Aligned", 3)
        return Struct(warpedExp=warpedExp, warpedSources=warpedSources, matches=results.matches,
                      wcs=results.wcs, task=task)