Coverage for python/lsst/meas/algorithms/astrometrySourceSelector.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # # Copyright 2008-2017 AURA/LSST. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. #
Such sources have good signal-to-noise, are well centroided, not blended, and not flagged with a handful of "bad" flags. """
doc="List of flags which cause a source to be rejected as bad", dtype=str, default=[ "base_PixelFlags_flag_edge", "base_PixelFlags_flag_interpolatedCenter", "base_PixelFlags_flag_saturatedCenter", "base_PixelFlags_flag_crCenter", "base_PixelFlags_flag_bad", ], ) doc="Type of source flux; typically one of Ap or Psf", dtype=str, default="Ap", ) dtype=float, doc="Minimum allowed signal-to-noise ratio for sources used for matching " "(in the flux specified by sourceFluxType); <= 0 for no limit", default=10, )
"""Select sources that are useful for astrometry.
Good astrometry sources have high signal/noise, are non-blended, and did not have certain "bad" flags set during source extraction. They need not be PSF sources, just have reliable centroids. """
"""Return a selection of sources that are useful for astrometry.
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.
Return ------ struct : `lsst.pipe.base.Struct` The struct contains the following data:
- selected : `array` of `bool`` Boolean array of sources that were selected, same length as sourceCat. """
"""Extract and save the necessary keys from schema with asKey."""
"""Return True for each source that is likely multiple sources.""" # have to currently manage footprints on a source-by-source basis.
"""Return True for each source that has a valid centroid""" """Return True for sources with non-finite centroids.""" ~np.isfinite(sourceCat.get(self.centroidYKey)) "Centroids not finite for %d unflagged sources." % (checkNonfiniteCentroid().sum()) & np.isfinite(sourceCat.get(self.centroidYErrKey)) \ & ~sourceCat.get(self.centroidFlagKey)
"""Return True for each source that has Signal/Noise > config.minSnr.""" else:
""" Return True for each source that is usable for matching, even if it may have a poor centroid.
For a source to be usable it must: - have a valid centroid - not be deblended - have a valid flux (of the type specified in this object's constructor) - have adequate signal-to-noise """
& ~self._isMultiple(sourceCat) \ & self._goodSN(sourceCat) \ & ~sourceCat.get(self.fluxFlagKey)
""" Return True for each source that is usable for matching and likely has a good centroid.
The additional tests for a good centroid, beyond isUsable, are: - not interpolated in the center - not saturated - not near the edge """
& ~sourceCat.get(self.saturatedKey) \ & ~sourceCat.get(self.interpolatedCenterKey) \ & ~sourceCat.get(self.edgeKey)
"""Return True if any of config.badFlags are set for this source.""" return any(source.get(flag) for flag in self.config.badFlags) |