Skip to content

Commit

Permalink
Fix non-finite reduced chi2 value in some situations
Browse files Browse the repository at this point in the history
  • Loading branch information
aymgal committed Jun 3, 2024
1 parent c445f49 commit bed8536
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions herculens/LensImage/lens_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ def normalized_residuals(self, data, model, mask=None):
if mask is not None:
# outside the mask just add pure data
norm_res_tot += (data / noise) * (1. - mask)
# make sure there is no NaN or infinite values
norm_res_model = np.where(np.isfinite(norm_res_model), norm_res_model, 0.)
norm_res_tot = np.where(np.isfinite(norm_res_tot), norm_res_tot, 0.)
return norm_res_model, norm_res_tot

def reduced_chi2(self, data, model, mask=None):
Expand Down

0 comments on commit bed8536

Please sign in to comment.