Skip to content

Commit

Permalink
Merge branch 'tickets/DM-24864'
Browse files Browse the repository at this point in the history
  • Loading branch information
sr525 committed May 29, 2020
2 parents afafd46 + 48579c6 commit ec4c6e0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/lsst/pipe/tasks/processCcdWithFakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import lsst.daf.base as dafBase

from .insertFakes import InsertFakesTask
from lsst.meas.algorithms import SourceDetectionTask
from lsst.meas.algorithms import SourceDetectionTask, SkyObjectsTask
from lsst.meas.base import (SingleFrameMeasurementTask, ApplyApCorrTask, CatalogCalculationTask,
PerTractCcdDataIdContainer)
from lsst.meas.deblender import SourceDeblendTask
Expand Down Expand Up @@ -163,6 +163,8 @@ class ProcessCcdWithFakesConfig(PipelineTaskConfig,
catalogCalculation = pexConfig.ConfigurableField(target=CatalogCalculationTask,
doc="The catalog calculation task to use.")

skySources = pexConfig.ConfigurableField(target=SkyObjectsTask, doc="Generate sky sources")

def setDefaults(self):
self.detection.reEstimateBackground = False
super().setDefaults()
Expand Down Expand Up @@ -222,6 +224,8 @@ def __init__(self, schema=None, butler=None, **kwargs):
self.makeSubtask("measurement", schema=self.schema, algMetadata=self.algMetadata)
self.makeSubtask("applyApCorr", schema=self.schema)
self.makeSubtask("catalogCalculation", schema=self.schema)
self.makeSubtask("skySources")
self.skySourceKey = self.schema.addField("sky_source", type="Flag", doc="Sky objects.")

def runDataRef(self, dataRef):
"""Read in/write out the required data products and add fake sources to the calexp.
Expand Down Expand Up @@ -356,6 +360,12 @@ def run(self, fakeCat, exposure, wcs=None, photoCalib=None, exposureIdInfo=None,

detRes = self.detection.run(table=table, exposure=exposure, doSmooth=True)
sourceCat = detRes.sources
skySourceFootprints = self.skySources.run(mask=exposure.mask, seed=exposureIdInfo.expId)
if skySourceFootprints:
for foot in skySourceFootprints:
s = sourceCat.addNew()
s.setFootprint(foot)
s.set(self.skySourceKey, True)
self.deblend.run(exposure=exposure, sources=sourceCat)
self.measurement.run(measCat=sourceCat, exposure=exposure, exposureId=exposureIdInfo.expId)
self.applyApCorr.run(catalog=sourceCat, apCorrMap=exposure.getInfo().getApCorrMap())
Expand Down

0 comments on commit ec4c6e0

Please sign in to comment.