Exemple #1
0
def makeMeasurementConfig(forced=False,
                          nsigma=6.0,
                          nIterForRadius=1,
                          kfac=2.5):
    """Construct a (SingleFrame|Forced)MeasurementConfig with the requested parameters"""
    if forced:
        msConfig = measBase.ForcedMeasurementConfig()
        msConfig.algorithms.names = [
            "base_TransformedCentroid", "base_TransformedShape",
            "ext_photometryKron_KronFlux"
        ]
        msConfig.slots.centroid = "base_TransformedCentroid"
        msConfig.slots.shape = "base_TransformedShape"
        msConfig.copyColumns = {"id": "objectId", "parent": "parentObjectId"}
    else:
        msConfig = measBase.SingleFrameMeasurementConfig()
        msConfig.algorithms.names = [
            "base_SdssCentroid", "base_SdssShape",
            "ext_photometryKron_KronFlux", "base_SkyCoord"
        ]
        msConfig.slots.centroid = "base_SdssCentroid"
        msConfig.slots.shape = "base_SdssShape"
    msConfig.slots.apFlux = "ext_photometryKron_KronFlux"
    msConfig.slots.modelFlux = None
    msConfig.slots.psfFlux = None
    msConfig.slots.instFlux = None
    msConfig.slots.calibFlux = None
    # msConfig.algorithms.names.remove("correctfluxes")
    msConfig.plugins["ext_photometryKron_KronFlux"].nSigmaForRadius = nsigma
    msConfig.plugins[
        "ext_photometryKron_KronFlux"].nIterForRadius = nIterForRadius
    msConfig.plugins["ext_photometryKron_KronFlux"].nRadiusForFlux = kfac
    msConfig.plugins[
        "ext_photometryKron_KronFlux"].enforceMinimumRadius = False
    return msConfig
Exemple #2
0
 def testForcedMeasurementTransform(self):
     """Test applying a transform task to the results of forced measurement."""
     schema = afwTable.SourceTable.makeMinimalSchema()
     forcedConfig = measBase.ForcedMeasurementConfig(plugins=[PLUGIN_NAME])
     # We don't use slots in this test
     for key in forcedConfig.slots:
         setattr(forcedConfig.slots, key, None)
     forcedConfig.copyColumns = {"id": "objectId", "parent": "parentObjectId"}
     forcedTask = measBase.ForcedMeasurementTask(schema, config=forcedConfig)
     transformConfig = TransformConfig(copyFields=("objectId", "coord_ra", "coord_dec"))
     transformTask = TransformTask(measConfig=forcedConfig,
                                   inputSchema=forcedTask.schema, outputDataset="forced_src",
                                   config=transformConfig)
     self._transformAndCheck(forcedConfig, forcedTask.schema, transformTask)