Skip to content

Commit

Permalink
Merge pull request #834 from lsst/tickets/DM-40781
Browse files Browse the repository at this point in the history
DM-40781: Add check for nans when computing grid psf quantities in property maps
  • Loading branch information
erykoff authored Sep 21, 2023
2 parents e37a0ae + 58a43a7 commit aab4165
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions python/lsst/pipe/tasks/healSparseMappingProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,18 @@ def compute_approx_psf_size_and_shape(ccd_row, ra, dec, nx=20, ny=20, orderx=2,
("psf_e2", "f8"),
("psf_area", "f8")])

cheb_size = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_size, ctrl)
# Protect against nans which can come in at the edges and masked regions.
good = np.isfinite(psf_size)
x = x[good]
y = y[good]

cheb_size = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_size[good], ctrl)
psf_array["psf_size"] = cheb_size.evaluate(pixel_x, pixel_y)
cheb_e1 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e1, ctrl)
cheb_e1 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e1[good], ctrl)
psf_array["psf_e1"] = cheb_e1.evaluate(pixel_x, pixel_y)
cheb_e2 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e2, ctrl)
cheb_e2 = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_e2[good], ctrl)
psf_array["psf_e2"] = cheb_e2.evaluate(pixel_x, pixel_y)
cheb_area = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_area, ctrl)
cheb_area = ChebyshevBoundedField.fit(lsst.geom.Box2I(bbox), x, y, psf_area[good], ctrl)
psf_array["psf_area"] = cheb_area.evaluate(pixel_x, pixel_y)

return psf_array
Expand Down

0 comments on commit aab4165

Please sign in to comment.