Skip to content

Commit

Permalink
Add sky_source column during processCcdWithFakes
Browse files Browse the repository at this point in the history
  • Loading branch information
sr525 committed May 15, 2020
1 parent afafd46 commit 48579c6
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 48579c6

Please sign in to comment.