lsst.meas.algorithms  19.0.0-17-gde1f5b76+6
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask Class Reference
Inheritance diagram for lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask:

Public Member Functions

def __init__ (self, columnName=None, schema=None, doc=None, **kwargs)
 
def run (self, sources, prior=None, expId=0)
 
def select (self, numSources, expId=0)
 
def applySelectionPrior (self, prior, selection)
 
def markSources (self, sources, selection)
 

Public Attributes

 columnName
 
 key
 

Static Public Attributes

 ConfigClass = ReserveSourcesConfig
 

Detailed Description

Reserve sources from analysis

We randomly select a fraction of sources that will be reserved
from analysis. This allows evaluation of the quality of model fits
using sources that were not involved in the fitting process.

Constructor parameters
----------------------
columnName : `str`, required
    Name of flag column to add; we will suffix this with "_reserved".
schema : `lsst.afw.table.Schema`, required
    Catalog schema.
doc : `str`
    Documentation for column to add.
config : `ReserveSourcesConfig`
    Configuration.

Definition at line 41 of file reserveSourcesTask.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.__init__ (   self,
  columnName = None,
  schema = None,
  doc = None,
**  kwargs 
)

Definition at line 62 of file reserveSourcesTask.py.

Member Function Documentation

◆ applySelectionPrior()

def lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.applySelectionPrior (   self,
  prior,
  selection 
)
Apply selection to full catalog

The `select` method makes a random selection of sources. If those
sources don't represent the full population (because a sub-selection
has already been made), then we need to generate a selection covering
the entire population.

Parameters
----------
prior : `numpy.ndarray` of type `bool`
    Prior selection of sources, identifying the subset from which the
    random selection has been made.
selection : `numpy.ndarray` of type `bool`
    Selection of sources in subset identified by `prior`.

Returns
-------
full : `numpy.ndarray` of type `bool`
    Selection applied to full population.

Definition at line 136 of file reserveSourcesTask.py.

◆ markSources()

def lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.markSources (   self,
  sources,
  selection 
)
Mark sources in a list or catalog

This requires iterating through the list and setting the flag in
each source individually. Even if the `sources` is a `Catalog`
with contiguous records, it's not currently possible to set a boolean
column (DM-6981) so we need to iterate.

Parameters
----------
catalog : `lsst.afw.table.Catalog` or `list` of `lsst.afw.table.Record`
    Catalog in which to flag selected sources.
selection : `numpy.ndarray` of type `bool`
    Selection of sources to mark.

Definition at line 161 of file reserveSourcesTask.py.

◆ run()

def lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.run (   self,
  sources,
  prior = None,
  expId = 0 
)
Select sources to be reserved

Reserved sources will be flagged in the catalog, and we will return
boolean arrays that identify the sources to be reserved from and
used in the analysis. Typically you'll want to use the sources
from the `use` array in your fitting, and use the sources from the
`reserved` array as an independent test of your fitting.

Parameters
----------
sources : `lsst.afw.table.Catalog` or `list` of `lsst.afw.table.Record`
    Sources from which to select some to be reserved.
prior : `numpy.ndarray` of type `bool`, optional
    Prior selection of sources. Should have the same length as
    `sources`. If set, we will only consider for reservation sources
    that are flagged `True` in this array.
expId : `int`
    Exposure identifier; used for seeding the random number generator.

Return struct contents
----------------------
reserved : `numpy.ndarray` of type `bool`
    Sources to be reserved are flagged `True` in this array.
use : `numpy.ndarray` of type `bool`
    Sources the user should use in analysis are flagged `True`.

Definition at line 69 of file reserveSourcesTask.py.

◆ select()

def lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.select (   self,
  numSources,
  expId = 0 
)
Randomly select some sources

We return a boolean array with a random selection. The fraction
of sources selected is specified by the config parameter `fraction`.

Parameters
----------
numSources : `int`
    Number of sources in catalog from which to select.
expId : `int`
    Exposure identifier; used for seeding the random number generator.

Returns
-------
selection : `numpy.ndarray` of type `bool`
    Selected sources are flagged `True` in this array.

Definition at line 109 of file reserveSourcesTask.py.

Member Data Documentation

◆ columnName

lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.columnName

Definition at line 66 of file reserveSourcesTask.py.

◆ ConfigClass

lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.ConfigClass = ReserveSourcesConfig
static

Definition at line 59 of file reserveSourcesTask.py.

◆ key

lsst.meas.algorithms.reserveSourcesTask.ReserveSourcesTask.key

Definition at line 67 of file reserveSourcesTask.py.


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