Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review for DM-1946: HSC backport of Footprint merge code #22

Merged
merged 24 commits into from Apr 24, 2015

Conversation

TallJimbo
Copy link
Member

No description provided.

rearmstr and others added 20 commits April 22, 2015 11:22
Rename 'merge' private member to _merge.

Make overlaps() method const.

Add emacs file mode tag.
FootprintMerge needs to modify Footprint's bounding box directly,
but normally we don't want to give users the ability to modify it, so
we replace the non-const reference accessor with a friend statement.
FootprintMerge is only used as a helper class for FootprintMergeList,
which has the public interfaces we use.  While it could currently be
used on its own, future changes will make that harder to maintain,
so it seems best to just make it a truly private class.
Prior to this change, adding a new Footprint that connected two
previously-separate merges would result in the flags from one of
the existing merges being lost.  To fix this, we had to remove
the SourceMerge struct in and instead have FootprintMerge hold
the output SourceRecord itself.
Some of this test code wasn't quite testing what it claimed to be testing,
because the arrays being passed in were not all the same size, and zip()
silently iterates over the smallest of its arguments.  The removal of
some of the test utility code in this change is just to make it so we have
to worry about that problem in fewer places.

Also changed the failure mode to an exception instead of a warning
and no-op; seems like a logic error that should be fatal in order to
better catch bugs in higher-level code.
Simplifies and speeds up logic in FootprintMergeList by erasing duplicates items immediately.
For backwards compatibility, we're keeping around
all the old Footprint constructors, which use the
default Peak minimal schema.  But we now have a
ctor that accepts a custom schema, and a Python
accessible way to change the schema.

Conflicts:
	include/lsst/afw/detection/Footprint.h
	src/detection/Footprint.cc
Many of the operations that created new Footprints from old ones
internally used the Footprint default constructor, not the copy
constructor, and that meant they weren't transferring the new
peaks properly.

Conflicts:
	src/detection/Footprint.cc

Note that recent improvements on the Footprint grow and shrink
algorithms require a separate commit to ensure the peaks are
being transferred and updated properly.
// Iterate over peaks from the original footprint and add them IF they are contained
// within the shrunken footprint.
for (auto peakIter = foot.getPeaks().begin(); peakIter != foot.getPeaks().end(); peakIter++) {
if (shrunk->contains(geom::Point2I(peakIter->getIx(), peakIter->getIy()))) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test, you can just use:

shrunk->contains(peakIter->getI())

laurenam and others added 4 commits April 24, 2015 15:56
Peaks from the original Footprint need to be copied into the new
Footprints returned by the growFootprint and shrinkFootprint
functions.  For the latter, only those Peaks lying within the
shrunken Footprint get added.

The unittest code was updated to test these changes.
The tests/footprintMergeCatalog.py code made use of meas_algorithms
DoubleGaussianPsf to create a psf for a generated image.  Since afw
does not require meas_algorithms as a build dependency, it cannot be
assumed that the latter is set up and available.  The psf is now
created using afw.detection's GaussianPsf.
@laurenam laurenam merged commit eb85b0c into master Apr 24, 2015
@timj timj deleted the u/lauren/DM-1946 branch February 18, 2021 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants