LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
Classes | Public Member Functions | Friends | List of all members
lsst::afw::detection::FootprintMergeList Class Referencefinal

List of Merged Footprints. More...

#include <FootprintMerge.h>

Public Member Functions

 FootprintMergeList (afw::table::Schema &sourceSchema, std::vector< std::string > const &filterList, afw::table::Schema const &initialPeakSchema)
 Initialize the merge with a custom initial peak schema. More...
 
 FootprintMergeList (afw::table::Schema &sourceSchema, std::vector< std::string > const &filterList)
 Initialize the merge with the default peak schema. More...
 
 ~FootprintMergeList ()
 
 FootprintMergeList (FootprintMergeList const &)
 
 FootprintMergeList (FootprintMergeList &&)
 
FootprintMergeListoperator= (FootprintMergeList const &)
 
FootprintMergeListoperator= (FootprintMergeList &&)
 
afw::table::Schema getPeakSchema () const
 Return the schema for PeakRecords in the merged footprints. More...
 
void addCatalog (std::shared_ptr< afw::table::SourceTable > sourceTable, afw::table::SourceCatalog const &inputCat, std::string const &filter, float minNewPeakDist=-1., bool doMerge=true, float maxSamePeakDist=-1.)
 Add objects from a SourceCatalog in the specified filter. More...
 
void clearCatalog ()
 Clear entries in the current vector. More...
 
void getFinalSources (afw::table::SourceCatalog &outputCat)
 Get SourceCatalog with entries that contain the final Footprint and SourceRecord for each entry. More...
 

Friends

class FootprintMerge
 

Detailed Description

List of Merged Footprints.

Stores a vector of FootprintMerges and SourceRecords that contain the union of different footprints and which filters it was detected in. Individual Footprints from a SourceCatalog can be added to the vector (note that any SourceRecords with parent!=0 will be skipped). If a Footprint overlaps an existing FootprintMerge, the Footprint will be added to it. If not, then a new FootprintMerge will be created and added to the vector.

The search algorithm uses a brute force approach over the current list. This should be fine if we are operating on smallish number of objects, such as at the tract level.

Definition at line 56 of file FootprintMerge.h.

Constructor & Destructor Documentation

◆ FootprintMergeList() [1/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( afw::table::Schema sourceSchema,
std::vector< std::string > const &  filterList,
afw::table::Schema const &  initialPeakSchema 
)

Initialize the merge with a custom initial peak schema.

Parameters
[in,out]sourceSchemaInput schema for SourceRecords to be merged, modified on return to include 'merge_footprint_<filter>' Flag fields that will indicate the origin of the source.
[in]filterListSequence of filter names to be used in Flag fields.
[in]initialPeakSchemaInput schema of PeakRecords in Footprints to be merged.

The output schema for PeakRecords will include additional 'merge_peak_<filter>' Flag fields that indicate the origin of peaks. This can be accessed by getPeakSchema().

Definition at line 206 of file FootprintMerge.cc.

209  : _peakSchemaMapper(initialPeakSchema) {
210  _initialize(sourceSchema, filterList);
211 }

◆ FootprintMergeList() [2/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( afw::table::Schema sourceSchema,
std::vector< std::string > const &  filterList 
)

Initialize the merge with the default peak schema.

Parameters
[in,out]sourceSchemaInput schema for SourceRecords to be merged, modified on return to include 'merge_footprint_<filter>' Flag fields that will indicate the origin of the source.
[in]filterListSequence of filter names to be used in Flag fields.

The output schema for PeakRecords will include additional 'merge_peak_<filter>' Flag fields that indicate the origin of peaks. This can be accessed by getPeakSchema().

Definition at line 213 of file FootprintMerge.cc.

215  : _peakSchemaMapper(PeakTable::makeMinimalSchema()) {
216  _initialize(sourceSchema, filterList);
217 }
static afw::table::Schema makeMinimalSchema()
Return a minimal schema for Peak tables and records.
Definition: Peak.h:137

◆ ~FootprintMergeList()

lsst::afw::detection::FootprintMergeList::~FootprintMergeList ( )
default

◆ FootprintMergeList() [3/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( FootprintMergeList const &  )
default

◆ FootprintMergeList() [4/4]

lsst::afw::detection::FootprintMergeList::FootprintMergeList ( FootprintMergeList &&  )
default

Member Function Documentation

◆ addCatalog()

void lsst::afw::detection::FootprintMergeList::addCatalog ( std::shared_ptr< afw::table::SourceTable sourceTable,
afw::table::SourceCatalog const &  inputCat,
std::string const &  filter,
float  minNewPeakDist = -1.,
bool  doMerge = true,
float  maxSamePeakDist = -1. 
)

Add objects from a SourceCatalog in the specified filter.

Iterate over all objects that have not been deblendend and search for an overlapping FootprintMerge in _mergeList. If it overlaps, then it will be added to it, otherwise it will create a new one. If minNewPeakDist < 0, then new peaks will not be added to existing footprints. If minNewPeakDist >= 0, then new peaks will be added that are farther away than minNewPeakDist to the nearest existing peak.

The SourceTable is used to create new SourceRecords that store the filter information.

Definition at line 241 of file FootprintMerge.cc.

243  {
244  FilterMap::const_iterator keyIter = _filterMap.find(filter);
245  if (keyIter == _filterMap.end()) {
246  throw LSST_EXCEPT(pex::exceptions::LogicError,
247  (boost::format("Filter %s not in original list") % filter).str());
248  }
249 
250  // If list is empty or merging not requested, don't check for any matches, just add all the objects
251  bool checkForMatches = !_mergeList.empty() && doMerge;
252 
253  for (afw::table::SourceCatalog::const_iterator srcIter = inputCat.begin(); srcIter != inputCat.end();
254  ++srcIter) {
255  // Only consider unblended objects
256  if (srcIter->getParent() != 0) continue;
257 
258  std::shared_ptr<Footprint> foot = srcIter->getFootprint();
259 
260  // Empty pointer to account for the first match in the catalog. If there is more than one
261  // match, subsequent matches will be merged with this one
263 
264  if (checkForMatches) {
265  FootprintMergeVec::iterator iter = _mergeList.begin();
266  while (iter != _mergeList.end()) {
267  // Grow by one pixel to allow for touching
268  lsst::geom::Box2I box((**iter).getBBox());
269  box.grow(lsst::geom::Extent2I(1, 1));
270  if (box.overlaps(foot->getBBox()) && (**iter).overlaps(*foot)) {
271  if (!first) {
272  first = *iter;
273  // Spatially extend existing FootprintMerge in order to connect subsequent,
274  // now-overlapping FootprintMerges. If a subsequent FootprintMerge overlaps with
275  // the new footprint, it's now guaranteed to overlap with this first FootprintMerge.
276  // Hold off adding foot's lower-priority footprints and peaks until the
277  // higher-priority existing peaks are merged into this first FootprintMerge.
278  first->addSpans(foot);
279  } else {
280  // Add existing merged Footprint to first
281  first->add(**iter, _filterMap, minNewPeakDist, maxSamePeakDist);
282  iter = _mergeList.erase(iter);
283  continue;
284  }
285  }
286  ++iter;
287  } // while mergeList
288  } // if checkForMatches
289 
290  if (first) {
291  // Now merge footprint including peaks into the newly-connected, higher-priority FootprintMerge
292  first->add(foot, _peakSchemaMapper, keyIter->second, minNewPeakDist, maxSamePeakDist);
293  } else {
294  // Footprint did not overlap with any existing FootprintMerges. Add to MergeList
295  _mergeList.push_back(std::make_shared<FootprintMerge>(foot, sourceTable, _peakTable,
296  _peakSchemaMapper, keyIter->second));
297  }
298  }
299 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
T begin(T... args)
An integer coordinate rectangle.
Definition: Box.h:55
T empty(T... args)
T end(T... args)
T erase(T... args)
T find(T... args)
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
T push_back(T... args)

◆ clearCatalog()

void lsst::afw::detection::FootprintMergeList::clearCatalog ( )
inline

Clear entries in the current vector.

Definition at line 113 of file FootprintMerge.h.

113 { _mergeList.clear(); }
T clear(T... args)

◆ getFinalSources()

void lsst::afw::detection::FootprintMergeList::getFinalSources ( afw::table::SourceCatalog outputCat)

Get SourceCatalog with entries that contain the final Footprint and SourceRecord for each entry.

The resulting Footprints will be normalized, meaning that there peaks are sorted, and areas are calculated.

Definition at line 301 of file FootprintMerge.cc.

301  {
302  // Now set the merged footprint as the footprint of the SourceRecord
303  for (FootprintMergeVec::iterator iter = _mergeList.begin(); iter != _mergeList.end(); ++iter) {
304  outputCat.push_back((**iter).getSource());
305  }
306 }

◆ getPeakSchema()

afw::table::Schema lsst::afw::detection::FootprintMergeList::getPeakSchema ( ) const
inline

Return the schema for PeakRecords in the merged footprints.

Definition at line 93 of file FootprintMerge.h.

93 { return _peakTable->getSchema(); }

◆ operator=() [1/2]

FootprintMergeList & lsst::afw::detection::FootprintMergeList::operator= ( FootprintMergeList &&  )
default

◆ operator=() [2/2]

FootprintMergeList & lsst::afw::detection::FootprintMergeList::operator= ( FootprintMergeList const &  )
default

Friends And Related Function Documentation

◆ FootprintMerge

friend class FootprintMerge
friend

Definition at line 134 of file FootprintMerge.h.


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