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

tickets/DM-8175 #54

Merged
merged 5 commits into from Dec 15, 2016
Merged

tickets/DM-8175 #54

merged 5 commits into from Dec 15, 2016

Conversation

yalsayyad
Copy link
Contributor

This ticket contains computeBBox implementations for WarpedPsf, CoaddPsf, and KernelPsf (trivial).

This ticket also includes commit to reduce some of the code duplication in testCoaddPsf, and a change to make consistent the x/y padding to the PSF image before warping it. The original author of that line (81 in WarpedPsf.cc) agrees with the change.

Copy link
Contributor

@jmeyers314 jmeyers314 left a comment

Choose a reason for hiding this comment

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

Nice job cleaning up the unit tests. Just a few small comments/questions.

}

afw::geom::Box2I overallBBox;
for (afw::table::ExposureCatalog::const_iterator i = subcat.begin(); i != subcat.end(); ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this would work or not, but I'm curious if this line might be clearer as

for (auto&& i : subcat) {

of even

for (auto&& cat : subcat) {

Copy link
Member

Choose a reason for hiding this comment

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

I think you'd just want for (auto i : subcat) {.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

without the &&, it tries to copy the elements into i:

src/CoaddPsf.cc:269:15: error: call to implicitly-deleted copy constructor of 'lsst::afw::table::ExposureRecord'
    for (auto exposureRecord : subcat) {

I'll change all the loops over the catalog to c++11 style, in a separate commit.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I'm an idiot. Of course; I was thinking that i would be an iterator type, not the record type. However, I think the appropriate invocation is then auto const & record; we want the element type to resolve to an lvalue const reference ExposureRecord const &, not an rvalue reference ExposureRecord &&.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is very interesting. I was trying to guess the best choice range declaration from the examples here. auto const & certainly sounds like a better option though, now that I know it exists!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, type deduction for auto is pretty weird. I remember thinking at one point that it all made sense, now that I understood it, but even though I now remember at least most of the rules I no longer remember why it had to be that way.

@@ -292,5 +296,9 @@ BOOST_AUTO_TEST_CASE(warpedPsf)
// TODO: improve this test; the ideal thing would be to repeat with
// finer resolutions and more stringent threshold
BOOST_CHECK(compare(*im,*im2) < 0.005);

//Check that computeBBox returns same dimensions as image
BOOST_CHECK((warped_psf->computeBBox().getWidth() - nx) == 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not BOOST_CHECK(warped_psf->computeBBox().getWidth() == nx); ?

afw::geom::AffineXYTransform xyTransform(t);

afw::math::SeparableKernel const& kernel = *wc.getWarpingKernel();
afw::geom::Point2I const& center = kernel.getCtr();
int const xPad = std::max(center.getX(), kernel.getWidth() - center.getX());
int const yPad = std::min(center.getY(), kernel.getHeight() - center.getY());
int const yPad = std::max(center.getY(), kernel.getHeight() - center.getY());
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this change suggest we're missing a unit test that would have caught this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've written a unit test for this and will move the discussion to the Jira ticket, because I want to attach pictures: https://jira.lsstcorp.org/browse/DM-8175

(afw::geom::Box2I const bbox,
afw::geom::AffineTransform const &t
) {
static const double maxTransformCoeff = 200.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're checking against maxTransformCoeff here, I think you can probably delete the check in warpAffine. Should probably bring the comment block down from there to here, though.

@yalsayyad yalsayyad force-pushed the tickets/DM-8175 branch 4 times, most recently from 6b195c7 to f7bff77 Compare December 14, 2016 22:49
@yalsayyad yalsayyad merged commit 181188a into master Dec 15, 2016
@ktlim ktlim deleted the tickets/DM-8175 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants