Skip to content

Commit

Permalink
Use image caches to satisfy PSF bbox checks, when possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed May 2, 2022
1 parent 31dc256 commit b7107b6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/detection/Psf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ lsst::geom::Box2I Psf::computeBBox() const {
lsst::geom::Box2I Psf::computeBBox(lsst::geom::Point2D position, image::Color color) const {
if (isPointNull(position)) position = getAveragePosition();
if (color.isIndeterminate()) color = getAverageColor();
return doComputeBBox(position, color);
auto cached_image = _kernelImageCache->get(detail::PsfCacheKey(position, color));
if (cached_image.has_value()) {
return cached_image.value()->getBBox();
} else {
return doComputeBBox(position, color);
}
}

lsst::geom::Box2I Psf::computeImageBBox() const {
Expand All @@ -149,7 +154,12 @@ lsst::geom::Box2I Psf::computeImageBBox() const {
lsst::geom::Box2I Psf::computeImageBBox(lsst::geom::Point2D position, image::Color color) const {
if (isPointNull(position)) position = getAveragePosition();
if (color.isIndeterminate()) color = getAverageColor();
return doComputeImageBBox(position, color);
auto cached_image = _imageCache->get(detail::PsfCacheKey(position, color));
if (cached_image.has_value()) {
return cached_image.value()->getBBox();
} else {
return doComputeImageBBox(position, color);
}
}

std::shared_ptr<math::Kernel const> Psf::getLocalKernel() const {
Expand Down

0 comments on commit b7107b6

Please sign in to comment.