From ec3b5144b491c817f741e3084896cffacabc9f26 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/table/wcsUtils.cc b/src/table/wcsUtils.cc index c46fc6119..ec5f6944f 100644 --- a/src/table/wcsUtils.cc +++ b/src/table/wcsUtils.cc @@ -93,6 +93,9 @@ void updateRefCentroids(geom::SkyWcs const &wcs, ReferenceCollection &refList) { Eigen::Matrix2f calculateCoordCovariance(geom::SkyWcs const &wcs, lsst::geom::Point2D center, Eigen::Matrix2f err) { + if (!isfinite(center.getX()) || !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