Skip to content

Commit

Permalink
REF remove exception and refactor a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Mar 22, 2024
1 parent f7052c8 commit bf9afbe
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions piff_package/piff/psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,18 +613,16 @@ def _do_ngmix_fit(*, img, cen_xy, scale, ntry=10):
irr -= pixel_var
icc -= pixel_var
_g1, _g2, _T = ngmix.moments.mom2g(irr, irc, icc)
res["pars"][2] = _g1
res["pars"][3] = _g2
res["pars"][4] = _T
except Exception:
_g1 = np.nan
_g2 = np.nan
_T = np.nan
res["pars"][2] = _g1
res["pars"][3] = _g2
res["pars"][4] = _T
res["flags"] |= 2**1

res["pars"][2] = _g1
res["pars"][3] = _g2
res["pars"][4] = _T

if res["flags"] == 0:
return res["pars"], res
else:
Expand Down Expand Up @@ -1022,7 +1020,6 @@ def _compute_smooth_model(self, *, wcs, properties, chipnum):

def _eval_smooth_model(self, *, x, y, chipnum, **properties):
if self._smooth_model_failed:
raise RuntimeError("Failed to compute smooth model")
return galsim.Moffat(beta=2.5, fwhm=1.0, flux=1.0)
else:
_props = [y / 4097, x / 2049] + [
Expand Down

0 comments on commit bf9afbe

Please sign in to comment.