Ejemplo n.º 1
0
    def testMeasure(self):
        schema = afwTable.SourceTable.makeMinimalSchema()
        task = ipDiffim.DipoleMeasurementTask(schema, config=self.config)
        table = afwTable.SourceTable.make(schema)
        sources = afwTable.SourceCatalog(table)
        source = sources.addNew()
        # make fake image
        psf, psfSum, exposure, s = createDipole(100, 100, 50, 50)

        # set it in source with the appropriate schema
        source.setFootprint(s.getFootprint())
        task.run(sources, exposure)
        self.assertEqual(source.get("ip_diffim_ClassificationDipole_value"), 1.0)
Ejemplo n.º 2
0
    def testMeasure(self):
        schema = afwTable.SourceTable.makeMinimalSchema()
        dipoleFlag = ipDiffim.DipoleMeasurementTask._ClassificationFlag
        schema.addField(dipoleFlag, "F", "probability of being a dipole")
        task = ipDiffim.DipoleMeasurementTask(schema, config=self.config)
        table = afwTable.SourceTable.make(schema)
        sources = afwTable.SourceCatalog(table)
        source = sources.addNew()
        # make fake image
        psf, psfSum, exposure, s = createDipole(100, 100, 50, 50)

        # set it in source with the appropriate schema
        source.setFootprint(s.getFootprint())
        task.run(sources, exposure)
        self.assertEqual(source.get(dipoleFlag), 1.0)
Ejemplo n.º 3
0
 def measureDipole(self, s, exp):
     msConfig = ipDiffim.DipoleMeasurementConfig()
     schema = afwTable.SourceTable.makeMinimalSchema()
     schema.addField("centroid_x", type=float)
     schema.addField("centroid_y", type=float)
     schema.addField("centroid_flag", type='Flag')
     task = ipDiffim.DipoleMeasurementTask(schema, config=msConfig)
     measCat = afwTable.SourceCatalog(schema)
     measCat.defineCentroid("centroid")
     source = measCat.addNew()
     source.set("centroid_x", self.xc)
     source.set("centroid_y", self.yc)
     source.setFootprint(s.getFootprint())
     # Then run the default SFM task.  Results not checked
     task.run(measCat, exp)
     return measCat[0]