7 import lsst.meas.algorithms
as measAlg
9 import lsst.pipe.tasks.multiBand
as mBand
11 from lsst.pipe.tasks.coaddBase
import getSkyInfo
25 dummyVar = pexConfig.Field(doc=
'Dummy config variable, does nothing',
26 dtype=bool, default=
True)
30 """This task serves culls the source list to sources which overlap with fakes""" 34 ConfigClass = mBand.MeasureMergedCoaddSourcesConfig
36 def run(self, patchRef):
37 """Measure and deblend""" 39 exposure = patchRef.get(self.config.coaddName +
"Coadd", immediate=
True)
41 """Read in the FAKE mask plane""" 42 mask = exposure.getMaskedImage().getMask()
43 fakebit = mask.getPlaneBitMask(
'FAKE')
45 sources = self.readSources(patchRef)
46 self.log.info(
"Found %d sources" % len(sources))
47 """ignore objects whose footprints do NOT overlap with the 'FAKE' mask""" 49 for i_ss, ss
in enumerate(sources):
50 foot = ss.getFootprint()
51 footTmp = afwDetect.Footprint(foot)
52 footTmp.intersectMask(mask, fakebit)
53 if footTmp.getArea() == foot.getArea():
55 removes = sorted(removes, reverse=
True)
58 self.log.info(
"Found %d sources near fake footprints" % len(sources))
60 if self.config.doDeblend:
61 self.deblend.
run(exposure, sources, exposure.getPsf())
63 bigKey = sources.schema[
"deblend.parent-too-big"].asKey()
64 numBig = sum((s.get(bigKey)
for s
in sources))
66 self.log.warn(
"Patch %s contains %d large footprints that were not deblended" %
67 (patchRef.dataId, numBig))
68 self.measurement.
run(exposure, sources)
69 skyInfo = getSkyInfo(coaddName=self.config.coaddName, patchRef=patchRef)
70 self.setPrimaryFlags.
run(sources, skyInfo.skyMap, skyInfo.tractInfo, skyInfo.patchInfo,
71 includeDeblend=self.config.doDeblend)
72 self.propagateFlags.
run(patchRef.getButler(), sources, self.propagateFlags.getCcdInputs(exposure),
74 if self.config.doMatchSources:
75 self.writeMatches(patchRef, exposure, sources)
77 self.write(patchRef, sources)