LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask Class Reference
Inheritance diagram for lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask:

Public Member Functions

def __init__ (self, schema, isSingleFrame=False, **kwargs)
 
def run (self, sources, skyMap=None, tractInfo=None, patchInfo=None)
 

Public Attributes

 schema
 
 isSingleFrame
 
 includeDeblend
 
 isPatchInnerKey
 
 isTractInnerKey
 
 isPrimaryKey
 
 isDeblendedSourceKey
 
 fromBlendKey
 
 isIsolatedKey
 
 isDeblendedModelKey
 

Static Public Attributes

 ConfigClass = SetPrimaryFlagsConfig
 

Detailed Description

Add isPrimaryKey to a given schema.

Parameters
----------
schema : `lsst.afw.table.Schema`
    The input schema.
isSingleFrame : `bool`
    Flag specifying if task is operating with single frame imaging.
includeDeblend : `bool`
    Include deblend information in isPrimary and
    add isDeblendedSource field?
kwargs :
    Keyword arguments passed to the task.

Definition at line 198 of file setPrimaryFlags.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.__init__ (   self,
  schema,
  isSingleFrame = False,
**  kwargs 
)

Definition at line 216 of file setPrimaryFlags.py.

216  def __init__(self, schema, isSingleFrame=False, **kwargs):
217  Task.__init__(self, **kwargs)
218  self.schema = schema
219  self.isSingleFrame = isSingleFrame
220  self.includeDeblend = False
221  if not self.isSingleFrame:
222  primaryDoc = ("true if source has no children and is in the inner region of a coadd patch "
223  "and is in the inner region of a coadd tract "
224  "and is not \"detected\" in a pseudo-filter (see config.pseudoFilterList)")
225  self.isPatchInnerKey = self.schema.addField(
226  "detect_isPatchInner", type="Flag",
227  doc="true if source is in the inner region of a coadd patch",
228  )
229  self.isTractInnerKey = self.schema.addField(
230  "detect_isTractInner", type="Flag",
231  doc="true if source is in the inner region of a coadd tract",
232  )
233  else:
234  primaryDoc = "true if source has no children and is not a sky source"
235  self.isPrimaryKey = self.schema.addField(
236  "detect_isPrimary", type="Flag",
237  doc=primaryDoc,
238  )
239 
240  if "deblend_nChild" in schema.getNames():
241  self.includeDeblend = True
242  self.isDeblendedSourceKey = self.schema.addField(
243  "detect_isDeblendedSource", type="Flag",
244  doc=primaryDoc + " and is either an unblended isolated source or a "
245  "deblended child from a parent with 'deblend_nChild' > 1")
246  self.fromBlendKey = self.schema.addField(
247  "detect_fromBlend", type="Flag",
248  doc="This source is deblended from a parent with more than one child."
249  )
250  self.isIsolatedKey = self.schema.addField(
251  "detect_isIsolated", type="Flag",
252  doc="This source is not a part of a blend."
253  )
254  if "deblend_scarletFlux" in schema.getNames():
255  self.isDeblendedModelKey = self.schema.addField(
256  "detect_isDeblendedModelSource", type="Flag",
257  doc=primaryDoc + " and is a deblended child")
258  else:
259  self.isDeblendedModelKey = None
260 

Member Function Documentation

◆ run()

def lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.run (   self,
  sources,
  skyMap = None,
  tractInfo = None,
  patchInfo = None 
)
Set isPrimary and related flags on sources.

For coadded imaging, the `isPrimary` flag returns True when an object
has no children, is in the inner region of a coadd patch, is in the
inner region of a coadd trach, and is not detected in a pseudo-filter
(e.g., a sky_object).
For single frame imaging, the isPrimary flag returns True when a
source has no children and is not a sky source.

Parameters
----------
sources : `lsst.afw.table.SourceCatalog`
    A sourceTable. Reads in centroid fields and an nChild field.
    Writes is-patch-inner, is-tract-inner, and is-primary flags.
skyMap : `lsst.skymap.BaseSkyMap`
    Sky tessellation object
tractInfo : `lsst.skymap.TractInfo`
    Tract object
patchInfo : `lsst.skymap.PatchInfo`
    Patch object

Definition at line 261 of file setPrimaryFlags.py.

261  def run(self, sources, skyMap=None, tractInfo=None, patchInfo=None):
262  """Set isPrimary and related flags on sources.
263 
264  For coadded imaging, the `isPrimary` flag returns True when an object
265  has no children, is in the inner region of a coadd patch, is in the
266  inner region of a coadd trach, and is not detected in a pseudo-filter
267  (e.g., a sky_object).
268  For single frame imaging, the isPrimary flag returns True when a
269  source has no children and is not a sky source.
270 
271  Parameters
272  ----------
273  sources : `lsst.afw.table.SourceCatalog`
274  A sourceTable. Reads in centroid fields and an nChild field.
275  Writes is-patch-inner, is-tract-inner, and is-primary flags.
276  skyMap : `lsst.skymap.BaseSkyMap`
277  Sky tessellation object
278  tractInfo : `lsst.skymap.TractInfo`
279  Tract object
280  patchInfo : `lsst.skymap.PatchInfo`
281  Patch object
282  """
283  # Mark whether sources are contained within the inner regions of the
284  # given tract/patch and are not "pseudo" (e.g. sky) sources.
285  if not self.isSingleFrame:
286  isPatchInner = getPatchInner(sources, patchInfo)
287  isTractInner = getTractInner(sources, tractInfo, skyMap)
288  isPseudo = getPseudoSources(sources, self.config.pseudoFilterList, self.schema, self.log)
289  isPrimary = isTractInner & isPatchInner & ~isPseudo
290 
291  sources[self.isPatchInnerKey] = isPatchInner
292  sources[self.isTractInnerKey] = isTractInner
293  else:
294  # Mark all of the sky sources in SingleFrame images
295  # (if they were added)
296  if "sky_source" in sources.schema:
297  isSky = sources["sky_source"]
298  else:
299  isSky = np.zeros(len(sources), dtype=bool)
300  isPrimary = ~isSky
301 
302  if self.includeDeblend:
303  result = getDeblendPrimaryFlags(sources)
304  fromBlend, isIsolated, isDeblendedSource, isDeblendedModelSource = result
305  sources[self.fromBlendKey] = fromBlend
306  sources[self.isIsolatedKey] = isIsolated
307  sources[self.isDeblendedSourceKey] = isDeblendedSource
308  if self.isDeblendedModelKey is not None:
309  sources[self.isDeblendedModelKey] = isDeblendedModelSource
310  isPrimary = isPrimary & isDeblendedSource
311 
312  sources[self.isPrimaryKey] = isPrimary
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603
def getPatchInner(sources, patchInfo)
def getTractInner(sources, tractInfo, skyMap)
def getPseudoSources(sources, pseudoFilterList, schema, log)

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.ConfigClass = SetPrimaryFlagsConfig
static

Definition at line 214 of file setPrimaryFlags.py.

◆ fromBlendKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.fromBlendKey

Definition at line 246 of file setPrimaryFlags.py.

◆ includeDeblend

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.includeDeblend

Definition at line 220 of file setPrimaryFlags.py.

◆ isDeblendedModelKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isDeblendedModelKey

Definition at line 255 of file setPrimaryFlags.py.

◆ isDeblendedSourceKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isDeblendedSourceKey

Definition at line 242 of file setPrimaryFlags.py.

◆ isIsolatedKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isIsolatedKey

Definition at line 250 of file setPrimaryFlags.py.

◆ isPatchInnerKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isPatchInnerKey

Definition at line 225 of file setPrimaryFlags.py.

◆ isPrimaryKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isPrimaryKey

Definition at line 235 of file setPrimaryFlags.py.

◆ isSingleFrame

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isSingleFrame

Definition at line 219 of file setPrimaryFlags.py.

◆ isTractInnerKey

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.isTractInnerKey

Definition at line 229 of file setPrimaryFlags.py.

◆ schema

lsst.pipe.tasks.setPrimaryFlags.SetPrimaryFlagsTask.schema

Definition at line 218 of file setPrimaryFlags.py.


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