LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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: