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 Jun 29, 2016
1 parent 0577a7c commit 6e97329
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion 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 NoOp by default as not modelFlux is setup by default in
# ForcedMeasurementTask
self.afterburners.plugins.names = []

## @addtogroup LSST_task_documentation
## @{
## @page ProcessImageForcedTask
Expand Down Expand Up @@ -97,7 +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 All @@ -124,6 +148,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 6e97329

Please sign in to comment.