Example #1
0
 def testSingleFramePlugin(self):
     config = measBase.SingleFrameMeasurementConfig()
     # n.b. we use the truth value as ModelFlux
     config.slots.psfFlux = "base_PsfFlux"
     config.slots.modelFlux = "truth"
     task = self.makeSingleFrameMeasurementTask(config=config)
     abTask = catCalc.CatalogCalculationTask(schema=task.schema)
     exposure, catalog = self.dataset.realize(10.0, task.schema, randomSeed=0)
     task.run(catalog, exposure)
     abTask.run(catalog)
     self.assertLess(catalog[0].get("base_ClassificationExtendedness_value"), 0.5)
     self.assertGreater(catalog[1].get("base_ClassificationExtendedness_value"), 0.5)
Example #2
0
 def runFlagTest(psfFlux=100.0, modelFlux=200.0,
                 psfFluxErr=1.0, modelFluxErr=2.0,
                 psfFluxFlag=False, modelFluxFlag=False):
     task = self.makeSingleFrameMeasurementTask(config=config)
     abTask = catCalc.CatalogCalculationTask(schema=task.schema, config=abConfig)
     exposure, catalog = self.dataset.realize(10.0, task.schema, randomSeed=1)
     source = catalog[0]
     source.set("base_PsfFlux_instFlux", psfFlux)
     source.set("base_PsfFlux_instFluxErr", psfFluxErr)
     source.set("base_PsfFlux_flag", psfFluxFlag)
     source.set("base_GaussianFlux_instFlux", modelFlux)
     source.set("base_GaussianFlux_instFluxErr", modelFluxErr)
     source.set("base_GaussianFlux_flag", modelFluxFlag)
     abTask.plugins["base_ClassificationExtendedness"].calculate(source)
     return source.get("base_ClassificationExtendedness_flag")
Example #3
0
 def setUp(self):
     # Create a schema object, and populate it with a field to simulate results from measurements on an
     # image
     schema = afwTable.SourceTable.makeMinimalSchema()
     schema.addField("start", type="D")
     # Instantiate a config object adding each of the above plugins, and use it to create a task
     catCalcConfig = catCalc.CatalogCalculationConfig()
     catCalcConfig.plugins.names = [
         "FailcatalogCalculation", "singleRecordCatalogCalculation",
         "multiRecordCatalogCalculation", "dependentCatalogCalulation"
     ]
     catCalcTask = catCalc.CatalogCalculationTask(schema=schema,
                                                  config=catCalcConfig)
     # Create a catalog with five sources as input to the task
     self.catalog = afwTable.SourceCatalog(schema)
     self.numObjects = 5
     for i in range(self.numObjects):
         rec = self.catalog.addNew()
         rec.set("start", float(i + 1))
     # Run the catalogCalculation task, outputs will be checked in test methods
     catCalcTask.run(self.catalog)