LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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 203 of file FootprintMerge.cc.

206  : _peakSchemaMapper(initialPeakSchema) {
207  _initialize(sourceSchema, filterList);
208 }

◆ 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 210 of file FootprintMerge.cc.

212  : _peakSchemaMapper(PeakTable::makeMinimalSchema()) {
213  _initialize(sourceSchema, filterList);
214 }
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 237 of file FootprintMerge.cc.

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

297  {
298  // Now set the merged footprint as the footprint of the SourceRecord
299  for (auto const &iter : _mergeList) {
300  outputCat.push_back((*iter).getSource());
301  }
302 }

◆ 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: