From 728f35e50e067f1b28a33a2faa952359fe3453c2 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Fri, 27 Oct 2023 02:15:00 -0700 Subject: [PATCH] Properly handle non-finite position If either position is NaN, the `makeSkyWcs` call further down will fail because `skyCenter` is also NaN. --- src/table/wcsUtils.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/table/wcsUtils.cc b/src/table/wcsUtils.cc index c46fc6119..d1ce67580 100644 --- a/src/table/wcsUtils.cc +++ b/src/table/wcsUtils.cc @@ -22,6 +22,7 @@ * see . */ +#include #include #include @@ -93,6 +94,9 @@ void updateRefCentroids(geom::SkyWcs const &wcs, ReferenceCollection &refList) { Eigen::Matrix2f calculateCoordCovariance(geom::SkyWcs const &wcs, lsst::geom::Point2D center, Eigen::Matrix2f err) { + if (!std::isfinite(center.getX()) || !std::isfinite(center.getY())) { + return Eigen::Matrix2f::Constant(NAN); + } // Get the derivative of the pixel-to-sky transformation, then use it to // propagate the centroid uncertainty to coordinate uncertainty. Note that // the calculation is done in arcseconds, then converted to radians in