LSST Applications 29.1.0,g0fba68d861+6b120c4394,g123d84c11c+8c5ae1fdc5,g1ec0fe41b4+191117f6ec,g1fd858c14a+c8450ae71a,g3533f9d6cb+a04f9ee0ab,g35bb328faa+8c5ae1fdc5,g3f0dcc2b1b+7df08700bd,g4178042926+b4254969db,g44ba364a48+04455b336b,g53246c7159+8c5ae1fdc5,g60b5630c4e+a04f9ee0ab,g663da51e9b+b05e6e1875,g67b6fd64d1+250bf6acd3,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g87e3079a85+d3fa38de54,g8852436030+cd899e2626,g89139ef638+250bf6acd3,g93a033419f+31ead11197,g989de1cb63+250bf6acd3,g9f33ca652e+f6053ecf14,ga1e959baac+5fbc491aed,ga2f891cd6c+a04f9ee0ab,gabe3b4be73+8856018cbb,gabf8522325+1f7e6d67b9,gac2eed3f23+250bf6acd3,gb1101e3267+0c331e9486,gb89ab40317+250bf6acd3,gcf25f946ba+cd899e2626,gd107969129+8964d67276,gd6cbbdb0b4+6bbecc8878,gde0f65d7ad+d65f9e019a,ge278dab8ac+eb3bbeb12f,ge410e46f29+250bf6acd3,gf5e32f922b+8c5ae1fdc5,gff02db199a+747430a128,gffe7e49bb4+a04f9ee0ab
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.meas.algorithms.sourceSelector.ScienceSourceSelectorTask Class Reference
Inheritance diagram for lsst.meas.algorithms.sourceSelector.ScienceSourceSelectorTask:
lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask

Public Member Functions

 selectSources (self, sourceCat, matches=None, exposure=None)
 
 run (self, sourceCat, sourceSelectedField=None, matches=None, exposure=None)
 

Static Public Attributes

 ConfigClass = BaseSourceSelectorConfig
 
bool usesMatches = False
 

Static Protected Attributes

str _DefaultName = "sourceSelector"
 

Detailed Description

Science source selector

By "science" sources, we mean sources that are on images that we
are processing, as opposed to sources from reference catalogs.

This selects (science) sources by (optionally) applying each of a
magnitude limit, flag requirements and star/galaxy separation.

Definition at line 680 of file sourceSelector.py.

Member Function Documentation

◆ run()

lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.run ( self,
sourceCat,
sourceSelectedField = None,
matches = None,
exposure = None )
inherited
Select sources and return them.

The input catalog must be contiguous in memory.

Parameters
----------
sourceCat : Various table formats
    Catalog of sources to select from. Can be
    `lsst.afw.table.SourceCatalog` or `pandas.DataFrame` or
    `astropy.table.Table`,
sourceSelectedField : `str` or None
    Name of flag field in sourceCat to set for selected sources.
    If set, will modify sourceCat in-place.
matches : `list` of `lsst.afw.table.ReferenceMatch` or None
    List of matches to use for source selection.
    If usesMatches is set in source selector this field is required.
    If not, it is ignored.
exposure : `lsst.afw.image.Exposure` or None
    The exposure the catalog was built from; used for debug display.

Returns
-------
struct : `lsst.pipe.base.Struct`
    The struct contains the following data:

    ``sourceCat``
        The catalog of sources that were selected.
        (may not be memory-contiguous)
        (`lsst.afw.table.SourceCatalog` or `pandas.DataFrame`
        or `astropy.table.Table`)
    ``selected``
        Boolean array of sources that were selected, same length as
        sourceCat.
        (`numpy.ndarray` of `bool`)

Raises
------
RuntimeError
    Raised if ``sourceCat`` is not contiguous.

Definition at line 71 of file sourceSelector.py.

71 def run(self, sourceCat, sourceSelectedField=None, matches=None, exposure=None):
72 """Select sources and return them.
73
74 The input catalog must be contiguous in memory.
75
76 Parameters
77 ----------
78 sourceCat : Various table formats
79 Catalog of sources to select from. Can be
80 `lsst.afw.table.SourceCatalog` or `pandas.DataFrame` or
81 `astropy.table.Table`,
82 sourceSelectedField : `str` or None
83 Name of flag field in sourceCat to set for selected sources.
84 If set, will modify sourceCat in-place.
85 matches : `list` of `lsst.afw.table.ReferenceMatch` or None
86 List of matches to use for source selection.
87 If usesMatches is set in source selector this field is required.
88 If not, it is ignored.
89 exposure : `lsst.afw.image.Exposure` or None
90 The exposure the catalog was built from; used for debug display.
91
92 Returns
93 -------
94 struct : `lsst.pipe.base.Struct`
95 The struct contains the following data:
96
97 ``sourceCat``
98 The catalog of sources that were selected.
99 (may not be memory-contiguous)
100 (`lsst.afw.table.SourceCatalog` or `pandas.DataFrame`
101 or `astropy.table.Table`)
102 ``selected``
103 Boolean array of sources that were selected, same length as
104 sourceCat.
105 (`numpy.ndarray` of `bool`)
106
107 Raises
108 ------
109 RuntimeError
110 Raised if ``sourceCat`` is not contiguous.
111 """
112 if hasattr(sourceCat, 'isContiguous'):
113 # Check for continuity on afwTable catalogs
114 if not sourceCat.isContiguous():
115 raise RuntimeError("Input catalogs for source selection must be contiguous.")
116
117 result = self.selectSources(sourceCat=sourceCat,
118 exposure=exposure,
119 matches=matches)
120
121 if sourceSelectedField is not None:
122 sourceCat[sourceSelectedField] = result.selected
123
124 return pipeBase.Struct(sourceCat=sourceCat[result.selected],
125 selected=result.selected)
126

◆ selectSources()

lsst.meas.algorithms.sourceSelector.ScienceSourceSelectorTask.selectSources ( self,
sourceCat,
matches = None,
exposure = None )
Return a selection of sources selected by specified criteria.

Parameters
----------
sourceCat : `lsst.afw.table.SourceCatalog`
    Catalog of sources to select from.
    This catalog must be contiguous in memory.
matches : `list` of `lsst.afw.table.ReferenceMatch` or None
    Ignored in this SourceSelector.
exposure : `lsst.afw.image.Exposure` or None
    The exposure the catalog was built from; used for debug display.

Returns
-------
struct : `lsst.pipe.base.Struct`
    The struct contains the following data:

    ``selected``
        Boolean array of sources that were selected, same length as
        sourceCat.
        (`numpy.ndarray` of `bool`)

Reimplemented from lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.

Definition at line 691 of file sourceSelector.py.

691 def selectSources(self, sourceCat, matches=None, exposure=None):
692 """Return a selection of sources selected by specified criteria.
693
694 Parameters
695 ----------
696 sourceCat : `lsst.afw.table.SourceCatalog`
697 Catalog of sources to select from.
698 This catalog must be contiguous in memory.
699 matches : `list` of `lsst.afw.table.ReferenceMatch` or None
700 Ignored in this SourceSelector.
701 exposure : `lsst.afw.image.Exposure` or None
702 The exposure the catalog was built from; used for debug display.
703
704 Returns
705 -------
706 struct : `lsst.pipe.base.Struct`
707 The struct contains the following data:
708
709 ``selected``
710 Boolean array of sources that were selected, same length as
711 sourceCat.
712 (`numpy.ndarray` of `bool`)
713 """
714 selected = np.ones(len(sourceCat), dtype=bool)
715 if self.config.doFluxLimit:
716 selected &= self.config.fluxLimit.apply(sourceCat)
717 if self.config.doFlags:
718 selected &= self.config.flags.apply(sourceCat)
719 if self.config.doUnresolved:
720 selected &= self.config.unresolved.apply(sourceCat)
721 if self.config.doSignalToNoise:
722 selected &= self.config.signalToNoise.apply(sourceCat)
723 if self.config.doIsolated:
724 selected &= self.config.isolated.apply(sourceCat)
725 if self.config.doRequireFiniteRaDec:
726 selected &= self.config.requireFiniteRaDec.apply(sourceCat)
727 if self.config.doRequirePrimary:
728 selected &= self.config.requirePrimary.apply(sourceCat)
729 if self.config.doSkySources:
730 selected |= self.config.skyFlag.apply(sourceCat)
731
732 self.log.info("Selected %d/%d sources", selected.sum(), len(sourceCat))
733
734 return pipeBase.Struct(selected=selected)
735
736

Member Data Documentation

◆ _DefaultName

str lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask._DefaultName = "sourceSelector"
staticprotectedinherited

Definition at line 65 of file sourceSelector.py.

◆ ConfigClass

lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.ConfigClass = BaseSourceSelectorConfig
staticinherited

Definition at line 64 of file sourceSelector.py.

◆ usesMatches

bool lsst.meas.algorithms.sourceSelector.BaseSourceSelectorTask.usesMatches = False
staticinherited

Definition at line 66 of file sourceSelector.py.


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