Skip to content

Commit

Permalink
Merge branch 'tickets/DM-35870'
Browse files Browse the repository at this point in the history
  • Loading branch information
leeskelvin committed Sep 1, 2022
2 parents bafd67b + e3a6796 commit 7bc907a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ImagePsf.cc
Expand Up @@ -44,12 +44,21 @@ namespace algorithms {

double ImagePsf::doComputeApertureFlux(double radius, geom::Point2D const& position,
afw::image::Color const& color) const {
afw::image::Image<double> const& image(*computeKernelImage(position, color, INTERNAL));

geom::Point2D const center(0.0, 0.0);
afw::geom::ellipses::Axes const axes(radius, radius);
afw::geom::ellipses::Ellipse ellipse(axes, center);
geom::Box2I box(ellipse.computeBBox());
// perhaps needs a grow here
afw::image::Image<double> image(*computeKernelImage(position, color, INTERNAL));
if (!image.getBBox().contains(box)) {
box.include(image.getBBox());
afw::image::Image<double> paddedImage(box);
paddedImage = 0.0;
paddedImage.assign(image, image.getBBox());
image = paddedImage;
}
base::ApertureFluxResult result = base::ApertureFluxAlgorithm::computeSincFlux(
image, afw::geom::ellipses::Ellipse(axes, center), base::ApertureFluxControl());
image, ellipse, base::ApertureFluxControl());
return result.instFlux;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/test_imagePsf.cc
Expand Up @@ -120,4 +120,6 @@ BOOST_AUTO_TEST_CASE(PsfApertureFlux) {
checkApertureFlux(25, 5.0, 3.0, 1E-2);
checkApertureFlux(25, 5.0, 5.0, 1E-2);
checkApertureFlux(25, 5.0, 10.0, 1E-2);
// test when the aperture is larger than the bounding box
checkApertureFlux(45, 5.0, 30.0, 1E-2);
}

0 comments on commit 7bc907a

Please sign in to comment.