Coverage for python/lsst/ip/diffim/diaCatalogSourceSelector.py : 70%

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-2016 LSST Corporation. # # 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 <http://www.lsstcorp.org/LegalNotices/>. #
# Selection cuts on the input source catalog doc="specify the minimum psfFlux for good Kernel Candidates", dtype=float, default=0.0, check=lambda x: x >= 0.0, ) doc="specify the maximum psfFlux for good Kernel Candidates (ignored if == 0)", dtype=float, default=0.0, check=lambda x: x >= 0.0, ) # Selection cuts on the reference catalog doc="Select objects that are flagged as stars", dtype=bool, default=True ) doc="Select objects that are flagged as galaxies", dtype=bool, default=False ) doc="Include objects that are known to be variable", dtype=bool, default=False ) doc="Minimum g-r color for selection (inclusive)", dtype=float, default=0.0 ) doc="Maximum g-r color for selection (inclusive)", dtype=float, default=3.0 )
"base_PixelFlags_flag_edge", "base_PixelFlags_flag_interpolatedCenter", "base_PixelFlags_flag_saturatedCenter", "slot_Centroid_flag", ]
"""A functor to check whether a source has any flags set that should cause it to be labeled bad."""
return False return False
## @addtogroup LSST_task_documentation ## @{ ## @page DiaCatalogSourceSelectorTask ## @ref DiaCatalogSourceSelectorTask_ "DiaCatalogSourceSelectorTask" ## @copybrief DiaCatalogSourceSelectorTask ## @}
"""!Select sources for Kernel candidates
@anchor DiaCatalogSourceSelectorTask_
@section ip_diffim_diaCatalogSourceSelector_Contents Contents
- @ref ip_diffim_diaCatalogSourceSelector_Purpose - @ref ip_diffim_diaCatalogSourceSelector_Initialize - @ref ip_diffim_diaCatalogSourceSelector_IO - @ref ip_diffim_diaCatalogSourceSelector_Config - @ref ip_diffim_diaCatalogSourceSelector_Debug
@section ip_diffim_diaCatalogSourceSelector_Purpose Description
A naive star selector based on second moments. Use with caution.
@section ip_diffim_diaCatalogSourceSelector_Initialize Task initialisation
@copydoc \_\_init\_\_
@section ip_diffim_diaCatalogSourceSelector_IO Invoking the Task
Like all star selectors, the main method is `run`.
@section ip_diffim_diaCatalogSourceSelector_Config Configuration parameters
See @ref DiaCatalogSourceSelectorConfig
@section ip_diffim_diaCatalogSourceSelector_Debug Debug variables
DiaCatalogSourceSelectorTask has a debug dictionary with the following keys: <dl> <dt>display <dd>bool; if True display debug information <dt>displayExposure <dd>bool; if True display exposure <dt>pauseAtEnd <dd>bool; if True wait after displaying everything and wait for user input </dl>
For example, put something like: @code{.py} import lsstDebug def DebugInfo(name): di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively if name.endswith("catalogStarSelector"): di.display = True
return di
lsstDebug.Info = DebugInfo @endcode into your `debug.py` file and run your task with the `--debug` flag. """
"""Return a selection of sources for Kernel candidates.
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` A match vector as produced by meas_astrom. 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. """
raise RuntimeError("DiaCatalogSourceSelector requires matches")
if displayExposure: ds9.mtv(mi, title="Kernel candidates", frame=lsstDebug.frame) # # Look for flags in each Source #
# Go through and find all the acceptable candidates in the catalogue
symbs = [] ctypes = []
symbs.append("+") ctypes.append(ds9.RED) else: except KeyError: self.log.warn("Cannot cut on color info; fields 'g' and 'r' do not exist") doColorCut = False isRightColor = True else:
symbs.append("+") ctypes.append(ds9.GREEN) symbs.append("o") ctypes.append(ds9.BLUE)
with ds9.Buffering(): for (ref, source, d), symb, ctype in zip(matches, symbs, ctypes): if display and displayExposure: ds9.dot(symb, source.getX() - mi.getX0(), source.getY() - mi.getY0(), size=4, ctype=ctype, frame=lsstDebug.frame)
lsstDebug.frame += 1 if pauseAtEnd: input("Continue? y[es] p[db] ")
|