LSST Applications g0265f82a02+093ff98f47,g02d81e74bb+10352d6f39,g1f3e9fa97e+40b0fc677d,g2079a07aa2+14824f138e,g2bbee38e9b+093ff98f47,g337abbeb29+093ff98f47,g3ddfee87b4+064c02c7ee,g487adcacf7+7e842ebf4b,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g568d43a26c+1d7ac31cb0,g591dd9f2cf+fb1f69e2ea,g858d7b2824+10352d6f39,g8a8a8dda67+a6fc98d2e7,g8cdfe0ae6a+66d966b544,g99cad8db69+7ce8a7c20a,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga2e4dd1c03+064c02c7ee,ga8c6da7877+04f6ba86dc,gae46bcf261+093ff98f47,gb0e22166c9+3863383f4c,gba4ed39666+9664299f35,gbb8dafda3b+db40f59a7d,gbeb006f7da+e6a448e96d,gbf5cecdb8a+10352d6f39,gc0f3af6251+10a3fd39cd,gc120e1dc64+5839e50a77,gc28159a63d+093ff98f47,gcf0d15dbbd+064c02c7ee,gd2a12a3803+0c2c227a2b,gdaeeff99f8+a38ce5ea23,ge79ae78c31+093ff98f47,gee10cc3b42+a6fc98d2e7,gf1cff7945b+10352d6f39,w.2024.15
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Attributes | List of all members
lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask Class Reference
Inheritance diagram for lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask:

Public Member Functions

 __init__ (self, schema, peakSchema=None, **kwargs)
 
 addSchemaKeys (self, schema)
 
 run (self, exposure, sources)
 
 deblend (self, exposure, srcs, psf)
 
 preSingleDeblendHook (self, exposure, srcs, i, fp, psf, psf_fwhm, sigma1)
 
 postSingleDeblendHook (self, exposure, srcs, i, npre, kids, fp, psf, psf_fwhm, sigma1, res)
 
 isLargeFootprint (self, footprint)
 
 isMasked (self, footprint, mask)
 
 skipParent (self, source, mask)
 

Public Attributes

 schema
 
 toCopyFromParent
 
 peakSchemaMapper
 
 nChildKey
 
 psfKey
 
 psfCenterKey
 
 psfFluxKey
 
 tooManyPeaksKey
 
 tooBigKey
 
 maskedKey
 
 deblendFailedKey
 
 deblendSkippedKey
 
 deblendRampedTemplateKey
 
 deblendPatchedTemplateKey
 
 hasStrayFluxKey
 
 peakCenter
 
 peakIdKey
 
 nPeaksKey
 
 parentNPeaksKey
 

Static Public Attributes

 ConfigClass = SourceDeblendConfig
 

Protected Member Functions

 _getPsfFwhm (self, psf, position)
 

Static Protected Attributes

str _DefaultName = "sourceDeblend"
 

Detailed Description

Split blended sources into individual sources.

This task has no return value; it only modifies the SourceCatalog in-place.

Definition at line 164 of file sourceDeblendTask.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.__init__ ( self,
schema,
peakSchema = None,
** kwargs )
Create the task, adding necessary fields to the given schema.

Parameters
----------
schema : `lsst.afw.table.Schema`
    Schema object for measurement fields; will be modified in-place.
peakSchema : `lsst.afw.table.peakSchema`
    Schema of Footprint Peaks that will be passed to the deblender.
    Any fields beyond the PeakTable minimal schema will be transferred
    to the main source Schema. If None, no fields will be transferred
    from the Peaks
**kwargs
    Additional keyword arguments passed to ~lsst.pipe.base.task

Definition at line 172 of file sourceDeblendTask.py.

172 def __init__(self, schema, peakSchema=None, **kwargs):
173 """Create the task, adding necessary fields to the given schema.
174
175 Parameters
176 ----------
177 schema : `lsst.afw.table.Schema`
178 Schema object for measurement fields; will be modified in-place.
179 peakSchema : `lsst.afw.table.peakSchema`
180 Schema of Footprint Peaks that will be passed to the deblender.
181 Any fields beyond the PeakTable minimal schema will be transferred
182 to the main source Schema. If None, no fields will be transferred
183 from the Peaks
184 **kwargs
185 Additional keyword arguments passed to ~lsst.pipe.base.task
186 """
187 pipeBase.Task.__init__(self, **kwargs)
188 self.schema = schema
189 self.toCopyFromParent = [item.key for item in self.schema
190 if item.field.getName().startswith("merge_footprint")]
191 peakMinimalSchema = afwDet.PeakTable.makeMinimalSchema()
192 if peakSchema is None:
193 # In this case, the peakSchemaMapper will transfer nothing, but we'll still have one
194 # to simplify downstream code
195 self.peakSchemaMapper = afwTable.SchemaMapper(peakMinimalSchema, schema)
196 else:
197 self.peakSchemaMapper = afwTable.SchemaMapper(peakSchema, schema)
198 for item in peakSchema:
199 if item.key not in peakMinimalSchema:
200 self.peakSchemaMapper.addMapping(item.key, item.field)
201 # Because SchemaMapper makes a copy of the output schema you give its ctor, it isn't
202 # updating this Schema in place. That's probably a design flaw, but in the meantime,
203 # we'll keep that schema in sync with the peakSchemaMapper.getOutputSchema() manually,
204 # by adding the same fields to both.
205 schema.addField(item.field)
206 assert schema == self.peakSchemaMapper.getOutputSchema(), "Logic bug mapping schemas"
207 self.addSchemaKeys(schema)
208
A mapping between the keys of two Schemas, used to copy data between them.

Member Function Documentation

◆ _getPsfFwhm()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask._getPsfFwhm ( self,
psf,
position )
protected

Definition at line 281 of file sourceDeblendTask.py.

281 def _getPsfFwhm(self, psf, position):
282 return psf.computeShape(position).getDeterminantRadius() * 2.35
283

◆ addSchemaKeys()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.addSchemaKeys ( self,
schema )

Definition at line 209 of file sourceDeblendTask.py.

209 def addSchemaKeys(self, schema):
210 self.nChildKey = schema.addField('deblend_nChild', type=np.int32,
211 doc='Number of children this object has (defaults to 0)')
212 self.psfKey = schema.addField('deblend_deblendedAsPsf', type='Flag',
213 doc='Deblender thought this source looked like a PSF')
214 self.psfCenterKey = afwTable.Point2DKey.addFields(schema, 'deblend_psfCenter',
215 'If deblended-as-psf, the PSF centroid', "pixel")
216 self.psfFluxKey = schema.addField('deblend_psf_instFlux', type='D',
217 doc='If deblended-as-psf, the instrumental PSF flux', units='count')
218 self.tooManyPeaksKey = schema.addField('deblend_tooManyPeaks', type='Flag',
219 doc='Source had too many peaks; '
220 'only the brightest were included')
221 self.tooBigKey = schema.addField('deblend_parentTooBig', type='Flag',
222 doc='Parent footprint covered too many pixels')
223 self.maskedKey = schema.addField('deblend_masked', type='Flag',
224 doc='Parent footprint was predominantly masked')
225
226 if self.config.catchFailures:
227 self.deblendFailedKey = schema.addField('deblend_failed', type='Flag',
228 doc="Deblending failed on source")
229
230 self.deblendSkippedKey = schema.addField('deblend_skipped', type='Flag',
231 doc="Deblender skipped this source")
232
233 self.deblendRampedTemplateKey = schema.addField(
234 'deblend_rampedTemplate', type='Flag',
235 doc=('This source was near an image edge and the deblender used '
236 '"ramp" edge-handling.'))
237
238 self.deblendPatchedTemplateKey = schema.addField(
239 'deblend_patchedTemplate', type='Flag',
240 doc=('This source was near an image edge and the deblender used '
241 '"patched" edge-handling.'))
242
243 self.hasStrayFluxKey = schema.addField(
244 'deblend_hasStrayFlux', type='Flag',
245 doc=('This source was assigned some stray flux'))
246
247 self.log.trace('Added keys to schema: %s', ", ".join(str(x) for x in (
248 self.nChildKey, self.psfKey, self.psfCenterKey, self.psfFluxKey,
249 self.tooManyPeaksKey, self.tooBigKey)))
250 self.peakCenter = afwTable.Point2IKey.addFields(schema, name="deblend_peak_center",
251 doc="Center used to apply constraints in scarlet",
252 unit="pixel")
253 self.peakIdKey = schema.addField("deblend_peakId", type=np.int32,
254 doc="ID of the peak in the parent footprint. "
255 "This is not unique, but the combination of 'parent'"
256 "and 'peakId' should be for all child sources. "
257 "Top level blends with no parents have 'peakId=0'")
258 self.nPeaksKey = schema.addField("deblend_nPeaks", type=np.int32,
259 doc="Number of initial peaks in the blend. "
260 "This includes peaks that may have been culled "
261 "during deblending or failed to deblend")
262 self.parentNPeaksKey = schema.addField("deblend_parentNPeaks", type=np.int32,
263 doc="Same as deblend_n_peaks, but the number of peaks "
264 "in the parent footprint")
265

◆ deblend()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.deblend ( self,
exposure,
srcs,
psf )
Deblend.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure to be processed
srcs : `lsst.afw.table.SourceCatalog`
    SourceCatalog containing sources detected on this exposure
psf : `lsst.afw.detection.Psf`
    Point source function

Returns
-------
None

Definition at line 285 of file sourceDeblendTask.py.

285 def deblend(self, exposure, srcs, psf):
286 """Deblend.
287
288 Parameters
289 ----------
290 exposure : `lsst.afw.image.Exposure`
291 Exposure to be processed
292 srcs : `lsst.afw.table.SourceCatalog`
293 SourceCatalog containing sources detected on this exposure
294 psf : `lsst.afw.detection.Psf`
295 Point source function
296
297 Returns
298 -------
299 None
300 """
301 # Cull footprints if required by ci
302 if self.config.useCiLimits:
303 self.log.info(f"Using CI catalog limits, "
304 f"the original number of sources to deblend was {len(srcs)}.")
305 # Select parents with a number of children in the range
306 # config.ciDeblendChildRange
307 minChildren, maxChildren = self.config.ciDeblendChildRange
308 nPeaks = np.array([len(src.getFootprint().peaks) for src in srcs])
309 childrenInRange = np.where((nPeaks >= minChildren) & (nPeaks <= maxChildren))[0]
310 if len(childrenInRange) < self.config.ciNumParentsToDeblend:
311 raise ValueError("Fewer than ciNumParentsToDeblend children were contained in the range "
312 "indicated by ciDeblendChildRange. Adjust this range to include more "
313 "parents.")
314 # Keep all of the isolated parents and the first
315 # `ciNumParentsToDeblend` children
316 parents = nPeaks == 1
317 children = np.zeros((len(srcs),), dtype=bool)
318 children[childrenInRange[:self.config.ciNumParentsToDeblend]] = True
319 srcs = srcs[parents | children]
320 # We need to update the IdFactory, otherwise the the source ids
321 # will not be sequential
322 idFactory = srcs.getIdFactory()
323 maxId = np.max(srcs["id"])
324 idFactory.notify(maxId)
325
326 self.log.info("Deblending %d sources", len(srcs))
327
328 from lsst.meas.deblender.baseline import deblend
329
330 # find the median stdev in the image...
331 mi = exposure.getMaskedImage()
332 statsCtrl = afwMath.StatisticsControl()
333 statsCtrl.setAndMask(mi.getMask().getPlaneBitMask(self.config.maskPlanes))
334 stats = afwMath.makeStatistics(mi.getVariance(), mi.getMask(), afwMath.MEDIAN, statsCtrl)
335 sigma1 = math.sqrt(stats.getValue(afwMath.MEDIAN))
336 self.log.trace('sigma1: %g', sigma1)
337
338 n0 = len(srcs)
339 nparents = 0
340 for i, src in enumerate(srcs):
341 # t0 = time.clock()
342
343 fp = src.getFootprint()
344 pks = fp.getPeaks()
345
346 # Since we use the first peak for the parent object, we should propagate its flags
347 # to the parent source.
348 src.assign(pks[0], self.peakSchemaMapper)
349
350 if len(pks) < 2:
351 continue
352
353 if self.isLargeFootprint(fp):
354 src.set(self.tooBigKey, True)
355 self.skipParent(src, mi.getMask())
356 self.log.debug('Parent %i: skipping large footprint (area: %i)',
357 int(src.getId()), int(fp.getArea()))
358 continue
359 if self.isMasked(fp, exposure.getMaskedImage().getMask()):
360 src.set(self.maskedKey, True)
361 self.skipParent(src, mi.getMask())
362 self.log.debug('Parent %i: skipping masked footprint (area: %i)',
363 int(src.getId()), int(fp.getArea()))
364 continue
365
366 nparents += 1
367 center = fp.getCentroid()
368 psf_fwhm = self._getPsfFwhm(psf, center)
369
370 if not (psf_fwhm > 0):
371 if self.config.catchFailures:
372 self.log.warning("Unable to deblend source %d: because PSF FWHM=%f is invalid.",
373 src.getId(), psf_fwhm)
374 src.set(self.deblendFailedKey, True)
375 continue
376 else:
377 raise ValueError(f"PSF at {center} has an invalid FWHM value of {psf_fwhm}")
378
379 self.log.trace('Parent %i: deblending %i peaks', int(src.getId()), len(pks))
380
381 self.preSingleDeblendHook(exposure, srcs, i, fp, psf, psf_fwhm, sigma1)
382 npre = len(srcs)
383
384 # This should really be set in deblend, but deblend doesn't have access to the src
385 src.set(self.tooManyPeaksKey, len(fp.getPeaks()) > self.config.maxNumberOfPeaks)
386
387 try:
388 res = deblend(
389 fp, mi, psf, psf_fwhm, sigma1=sigma1,
390 psfChisqCut1=self.config.psfChisq1,
391 psfChisqCut2=self.config.psfChisq2,
392 psfChisqCut2b=self.config.psfChisq2b,
393 maxNumberOfPeaks=self.config.maxNumberOfPeaks,
394 strayFluxToPointSources=self.config.strayFluxToPointSources,
395 assignStrayFlux=self.config.assignStrayFlux,
396 strayFluxAssignment=self.config.strayFluxRule,
397 rampFluxAtEdge=(self.config.edgeHandling == 'ramp'),
398 patchEdges=(self.config.edgeHandling == 'noclip'),
399 tinyFootprintSize=self.config.tinyFootprintSize,
400 clipStrayFluxFraction=self.config.clipStrayFluxFraction,
401 weightTemplates=self.config.weightTemplates,
402 removeDegenerateTemplates=self.config.removeDegenerateTemplates,
403 maxTempDotProd=self.config.maxTempDotProd,
404 medianSmoothTemplate=self.config.medianSmoothTemplate
405 )
406 if self.config.catchFailures:
407 src.set(self.deblendFailedKey, False)
408 except Exception as e:
409 if self.config.catchFailures:
410 self.log.warning("Unable to deblend source %d: %s", src.getId(), e)
411 src.set(self.deblendFailedKey, True)
412 import traceback
413 traceback.print_exc()
414 continue
415 else:
416 raise
417
418 kids = []
419 nchild = 0
420 for j, peak in enumerate(res.deblendedParents[0].peaks):
421 heavy = peak.getFluxPortion()
422 if heavy is None or peak.skip:
423 src.set(self.deblendSkippedKey, True)
424 if not self.config.propagateAllPeaks:
425 # Don't care
426 continue
427 # We need to preserve the peak: make sure we have enough info to create a minimal
428 # child src
429 self.log.trace("Peak at (%i,%i) failed. Using minimal default info for child.",
430 pks[j].getIx(), pks[j].getIy())
431 if heavy is None:
432 # copy the full footprint and strip out extra peaks
433 foot = afwDet.Footprint(src.getFootprint())
434 peakList = foot.getPeaks()
435 peakList.clear()
436 peakList.append(peak.peak)
437 zeroMimg = afwImage.MaskedImageF(foot.getBBox())
438 heavy = afwDet.makeHeavyFootprint(foot, zeroMimg)
439 if peak.deblendedAsPsf:
440 if peak.psfFitFlux is None:
441 peak.psfFitFlux = 0.0
442 if peak.psfFitCenter is None:
443 peak.psfFitCenter = (peak.peak.getIx(), peak.peak.getIy())
444
445 assert len(heavy.getPeaks()) == 1
446
447 src.set(self.deblendSkippedKey, False)
448 child = srcs.addNew()
449 nchild += 1
450 for key in self.toCopyFromParent:
451 child.set(key, src.get(key))
452 child.assign(heavy.getPeaks()[0], self.peakSchemaMapper)
453 child.setParent(src.getId())
454 child.setFootprint(heavy)
455 child.set(self.psfKey, peak.deblendedAsPsf)
456 child.set(self.hasStrayFluxKey, peak.strayFlux is not None)
457 if peak.deblendedAsPsf:
458 (cx, cy) = peak.psfFitCenter
459 child.set(self.psfCenterKey, geom.Point2D(cx, cy))
460 child.set(self.psfFluxKey, peak.psfFitFlux)
461 child.set(self.deblendRampedTemplateKey, peak.hasRampedTemplate)
462 child.set(self.deblendPatchedTemplateKey, peak.patched)
463
464 # Set the position of the peak from the parent footprint
465 # This will make it easier to match the same source across
466 # deblenders and across observations, where the peak
467 # position is unlikely to change unless enough time passes
468 # for a source to move on the sky.
469 child.set(self.peakCenter, geom.Point2I(pks[j].getIx(), pks[j].getIy()))
470 child.set(self.peakIdKey, pks[j].getId())
471
472 # The children have a single peak
473 child.set(self.nPeaksKey, 1)
474 # Set the number of peaks in the parent
475 child.set(self.parentNPeaksKey, len(pks))
476
477 kids.append(child)
478
479 # Child footprints may extend beyond the full extent of their parent's which
480 # results in a failure of the replace-by-noise code to reinstate these pixels
481 # to their original values. The following updates the parent footprint
482 # in-place to ensure it contains the full union of itself and all of its
483 # children's footprints.
484 spans = src.getFootprint().spans
485 for child in kids:
486 spans = spans.union(child.getFootprint().spans)
487 src.getFootprint().setSpans(spans)
488
489 src.set(self.nChildKey, nchild)
490
491 self.postSingleDeblendHook(exposure, srcs, i, npre, kids, fp, psf, psf_fwhm, sigma1, res)
492 # print('Deblending parent id', src.getId(), 'took', time.clock() - t0)
493
494 n1 = len(srcs)
495 self.log.info('Deblended: of %i sources, %i were deblended, creating %i children, total %i sources',
496 n0, nparents, n1-n0, n1)
497
Class to describe the properties of a detected object from an image.
Definition Footprint.h:63
Pass parameters to a Statistics object.
Definition Statistics.h:83
HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT > makeHeavyFootprint(Footprint const &foot, lsst::afw::image::MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > const &img, HeavyFootprintCtrl const *ctrl=nullptr)
Create a HeavyFootprint with footprint defined by the given Footprint and pixel values from the given...
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition Statistics.h:361

◆ isLargeFootprint()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.isLargeFootprint ( self,
footprint )
Returns whether a Footprint is large

'Large' is defined by thresholds on the area, size and axis ratio.
These may be disabled independently by configuring them to be non-positive.

This is principally intended to get rid of satellite streaks, which the
deblender or other downstream processing can have trouble dealing with
(e.g., multiple large HeavyFootprints can chew up memory).

Definition at line 504 of file sourceDeblendTask.py.

504 def isLargeFootprint(self, footprint):
505 """Returns whether a Footprint is large
506
507 'Large' is defined by thresholds on the area, size and axis ratio.
508 These may be disabled independently by configuring them to be non-positive.
509
510 This is principally intended to get rid of satellite streaks, which the
511 deblender or other downstream processing can have trouble dealing with
512 (e.g., multiple large HeavyFootprints can chew up memory).
513 """
514 if self.config.maxFootprintArea > 0 and footprint.getArea() > self.config.maxFootprintArea:
515 return True
516 if self.config.maxFootprintSize > 0:
517 bbox = footprint.getBBox()
518 if max(bbox.getWidth(), bbox.getHeight()) > self.config.maxFootprintSize:
519 return True
520 if self.config.minFootprintAxisRatio > 0:
521 axes = afwEll.Axes(footprint.getShape())
522 if axes.getB() < self.config.minFootprintAxisRatio*axes.getA():
523 return True
524 return False
525
int max

◆ isMasked()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.isMasked ( self,
footprint,
mask )
Returns whether the footprint violates the mask limits

Definition at line 526 of file sourceDeblendTask.py.

526 def isMasked(self, footprint, mask):
527 """Returns whether the footprint violates the mask limits
528 """
529 size = float(footprint.getArea())
530 for maskName, limit in self.config.maskLimits.items():
531 maskVal = mask.getPlaneBitMask(maskName)
532 unmaskedSpan = footprint.spans.intersectNot(mask, maskVal) # spanset of unmasked pixels
533 if (size - unmaskedSpan.getArea())/size > limit:
534 return True
535 return False
536

◆ postSingleDeblendHook()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.postSingleDeblendHook ( self,
exposure,
srcs,
i,
npre,
kids,
fp,
psf,
psf_fwhm,
sigma1,
res )

Definition at line 501 of file sourceDeblendTask.py.

501 def postSingleDeblendHook(self, exposure, srcs, i, npre, kids, fp, psf, psf_fwhm, sigma1, res):
502 pass
503

◆ preSingleDeblendHook()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.preSingleDeblendHook ( self,
exposure,
srcs,
i,
fp,
psf,
psf_fwhm,
sigma1 )

Definition at line 498 of file sourceDeblendTask.py.

498 def preSingleDeblendHook(self, exposure, srcs, i, fp, psf, psf_fwhm, sigma1):
499 pass
500

◆ run()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.run ( self,
exposure,
sources )
Get the PSF from the provided exposure and then run deblend.

Parameters
----------
exposure : `lsst.afw.image.Exposure`
    Exposure to be processed
sources : `lsst.afw.table.SourceCatalog`
    SourceCatalog containing sources detected on this exposure.

Definition at line 267 of file sourceDeblendTask.py.

267 def run(self, exposure, sources):
268 """Get the PSF from the provided exposure and then run deblend.
269
270 Parameters
271 ----------
272 exposure : `lsst.afw.image.Exposure`
273 Exposure to be processed
274 sources : `lsst.afw.table.SourceCatalog`
275 SourceCatalog containing sources detected on this exposure.
276 """
277 psf = exposure.getPsf()
278 assert sources.getSchema() == self.schema
279 self.deblend(exposure, sources, psf)
280

◆ skipParent()

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.skipParent ( self,
source,
mask )
Indicate that the parent source is not being deblended

We set the appropriate flags and mask.

Parameters
----------
source : `lsst.afw.table.SourceRecord`
    The source to flag as skipped
mask : `lsst.afw.image.Mask`
    The mask to update

Definition at line 537 of file sourceDeblendTask.py.

537 def skipParent(self, source, mask):
538 """Indicate that the parent source is not being deblended
539
540 We set the appropriate flags and mask.
541
542 Parameters
543 ----------
544 source : `lsst.afw.table.SourceRecord`
545 The source to flag as skipped
546 mask : `lsst.afw.image.Mask`
547 The mask to update
548 """
549 fp = source.getFootprint()
550 source.set(self.deblendSkippedKey, True)
551 if self.config.notDeblendedMask:
552 mask.addMaskPlane(self.config.notDeblendedMask)
553 fp.spans.setMask(mask, mask.getPlaneBitMask(self.config.notDeblendedMask))
554
555 # Set the center of the parent
556 bbox = fp.getBBox()
557 centerX = int(bbox.getMinX()+bbox.getWidth()/2)
558 centerY = int(bbox.getMinY()+bbox.getHeight()/2)
559 source.set(self.peakCenter, geom.Point2I(centerX, centerY))
560 # There are no deblended children, so nChild = 0
561 source.set(self.nChildKey, 0)
562 # But we also want to know how many peaks that we would have
563 # deblended if the parent wasn't skipped.
564 source.set(self.nPeaksKey, len(fp.peaks))
565 # Top level parents are not a detected peak, so they have no peakId
566 source.set(self.peakIdKey, 0)
567 # Top level parents also have no parentNPeaks
568 source.set(self.parentNPeaksKey, 0)

Member Data Documentation

◆ _DefaultName

str lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask._DefaultName = "sourceDeblend"
staticprotected

Definition at line 170 of file sourceDeblendTask.py.

◆ ConfigClass

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.ConfigClass = SourceDeblendConfig
static

Definition at line 169 of file sourceDeblendTask.py.

◆ deblendFailedKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.deblendFailedKey

Definition at line 227 of file sourceDeblendTask.py.

◆ deblendPatchedTemplateKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.deblendPatchedTemplateKey

Definition at line 238 of file sourceDeblendTask.py.

◆ deblendRampedTemplateKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.deblendRampedTemplateKey

Definition at line 233 of file sourceDeblendTask.py.

◆ deblendSkippedKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.deblendSkippedKey

Definition at line 230 of file sourceDeblendTask.py.

◆ hasStrayFluxKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.hasStrayFluxKey

Definition at line 243 of file sourceDeblendTask.py.

◆ maskedKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.maskedKey

Definition at line 223 of file sourceDeblendTask.py.

◆ nChildKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.nChildKey

Definition at line 210 of file sourceDeblendTask.py.

◆ nPeaksKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.nPeaksKey

Definition at line 258 of file sourceDeblendTask.py.

◆ parentNPeaksKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.parentNPeaksKey

Definition at line 262 of file sourceDeblendTask.py.

◆ peakCenter

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.peakCenter

Definition at line 250 of file sourceDeblendTask.py.

◆ peakIdKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.peakIdKey

Definition at line 253 of file sourceDeblendTask.py.

◆ peakSchemaMapper

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.peakSchemaMapper

Definition at line 195 of file sourceDeblendTask.py.

◆ psfCenterKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.psfCenterKey

Definition at line 214 of file sourceDeblendTask.py.

◆ psfFluxKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.psfFluxKey

Definition at line 216 of file sourceDeblendTask.py.

◆ psfKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.psfKey

Definition at line 212 of file sourceDeblendTask.py.

◆ schema

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.schema

Definition at line 188 of file sourceDeblendTask.py.

◆ toCopyFromParent

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.toCopyFromParent

Definition at line 189 of file sourceDeblendTask.py.

◆ tooBigKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.tooBigKey

Definition at line 221 of file sourceDeblendTask.py.

◆ tooManyPeaksKey

lsst.meas.deblender.sourceDeblendTask.SourceDeblendTask.tooManyPeaksKey

Definition at line 218 of file sourceDeblendTask.py.


The documentation for this class was generated from the following file: