22 """Definition and registration of classification plugins. 28 from .catalogCalculation
import CatalogCalculationPluginConfig, CatalogCalculationPlugin
29 from .pluginRegistry
import register
32 "CatalogCalculationClassificationConfig",
"CatalogCalculationClassificationPlugin",
37 """Configuration for catalog classification plugin. 41 doc=
"critical ratio of model to psf flux")
43 doc=
"correction factor for modelFlux error")
45 doc=
"correction factor for psfFlux error")
48 @
register(
"base_ClassificationExtendedness")
50 """Plugin which calculates a binary measure of source extendedness. 52 Extendedness is based on a simple cut of the ratio of the PSF flux to the 57 Because the fluxes on which this algorithm is based on are slot 58 measurements, they can be provided by different algorithms, and the 59 `~CatalogCalculationClassificationConfig.fluxRatio` threshold used by this 60 algorithm should generally be set differently for different algorithms. 61 To do this, plot the difference between the PSF magnitude and the model 62 magnitude vs. the PSF magnitude, and look for where the cloud of galaxies 66 ConfigClass = CatalogCalculationClassificationConfig
72 def __init__(self, config, name, schema, metadata):
73 CatalogCalculationPlugin.__init__(self, config, name, schema, metadata)
75 doc=
"Set to 1 for extended sources, 0 for point sources.")
76 self.
keyFlag = schema.addField(name +
"_flag", type=
"Flag", doc=
"Set to 1 for any fatal failure.")
79 modelFlux = measRecord.getModelInstFlux()
80 psfFlux = measRecord.getPsfInstFlux()
81 modelFluxFlag = (measRecord.getModelFluxFlag()
82 if measRecord.table.getModelFluxSlot().
isValid()
84 psfFluxFlag = (measRecord.getPsfFluxFlag()
85 if measRecord.table.getPsfFluxSlot().
isValid()
87 flux1 = self.
config.fluxRatio*modelFlux
88 if self.
config.modelErrFactor != 0:
89 flux1 += self.
config.modelErrFactor*measRecord.getModelInstFluxErr()
91 if not self.
config.psfErrFactor == 0:
92 flux2 += self.
config.psfErrFactor*measRecord.getPsfInstFluxErr()
98 if np.isnan(flux1)
or np.isnan(flux2)
or modelFluxFlag
or psfFluxFlag:
101 measRecord.set(self.
keyProbability, 0.0
if flux1 < flux2
else 1.0)
103 def fail(self, measRecord, error=None):
104 measRecord.set(self.
keyFlag,
True)
def fail(self, measRecord, error=None)
def calculate(self, measRecord)
def getExecutionOrder(cls)
float DEFAULT_CATALOGCALCULATION
def __init__(self, config, name, schema, metadata)