Skip to content

Commit

Permalink
Update processImageForcedTask for new ApCorr behaivor
Browse files Browse the repository at this point in the history
Since aperture corrections have been moved out of the base measurement
task, application of aperture corrections and the afterburner task
must be added to tasks which need these functionalities. Since the
forced measurement task has no default model flux, afterburners
are set to a NoOp by default.
  • Loading branch information
natelust committed Jul 5, 2016
1 parent 36ec1fe commit 2bb9dbd
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions python/lsst/meas/base/forcedPhotImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from .pluginsBase import BasePlugin
from .references import MultiBandReferencesTask
from .forcedMeasurement import ForcedMeasurementTask
from .applyApCorr import ApplyApCorrTask
from .afterburner import AfterburnerTask

__all__ = ("ProcessImageForcedConfig", "ProcessImageForcedTask")

Expand All @@ -53,11 +55,29 @@ class ProcessImageForcedConfig(lsst.pex.config.Config):
dtype = str,
default = "deep",
)
doApCorr = lsst.pex.config.Field(
dtype=bool,
default=True,
doc="Run subtask to apply aperture corrections"
)
applyApCorr = lsst.pex.config.ConfigurableField(
target=ApplyApCorrTask,
doc="Subtask to apply aperture corrections"
)
afterburners = lsst.pex.config.ConfigurableField(
target=AfterburnerTask,
doc="Subtask to run afterburner plugins on catalog"
)
copyColumns = lsst.pex.config.DictField(
keytype=str, itemtype=str, doc="Mapping of reference columns to source columns",
default={"id": "objectId", "parent": "parentObjectId", "deblend_nChild": "deblend_nChild"}
)

def setDefaults(self):
# Make afterburners a no-op by default as no modelFlux is setup by default in
# ForcedMeasurementTask
self.afterburners.plugins.names = []

## @addtogroup LSST_task_documentation
## @{
## @page ProcessImageForcedTask
Expand Down Expand Up @@ -97,6 +117,11 @@ def __init__(self, butler=None, refSchema=None, **kwds):
if refSchema is None:
refSchema = self.references.schema
self.makeSubtask("measurement", refSchema=refSchema)
# It is necessary to get the schema internal to the forced measurement task until such a time
# that the schema is not owned by the measurement task, but is passed in by an external caller
if self.config.doApCorr:
self.makeSubtask("applyApCorr", schema=self.measurement.schema)
self.makeSubtask('afterburners', schema=self.measurement.schema)

def run(self, dataRef):
"""!Measure a single exposure using forced detection for a reference catalog.
Expand Down Expand Up @@ -124,6 +149,14 @@ def run(self, dataRef):

self.measurement.run(measCat, exposure, refCat, refWcs, exposureId=self.getExposureId(dataRef))

if self.config.doApCorr:
self.applyApCorr.run(
catalog=measCat,
apCorrMap=exposure.getInfo().getApCorrMap()
)
self.afterburners.run(measCat)


self.writeOutput(dataRef, measCat)

def makeIdFactory(self, dataRef):
Expand Down

0 comments on commit 2bb9dbd

Please sign in to comment.