From 4ddcd9a44ece6317d543895b48018210694c5c39 Mon Sep 17 00:00:00 2001 From: dpieterse Date: Mon, 1 Jun 2026 16:58:40 +0200 Subject: [PATCH] Fixed numpy chained indexing bug Due to an indexing bug, a copy of the mask was updated instead of the mask_rej itself. This resulted in no pixels being discarded in the optimal photometry for sources with S/N <= 100 with too many outlier pixels, rather than rejecting the fraction of pixels with the highest deviation. This bug caused (seeing-dependent) jumps in light curves. --- zogy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zogy.py b/zogy.py index efbd305..9a963e2 100644 --- a/zogy.py +++ b/zogy.py @@ -8705,7 +8705,9 @@ def flux_optimal_iter (P, D, bkg_var, mask_use, nsigma_inn, nsigma_out, idx_limfrac = idx_sort[mask_use_inn][:npix_limfrac] # update inner mask_rej - mask_rej[mask_inn][idx_limfrac] = True + inner_indices = np.where(mask_inn)[0] + mask_rej[mask_inn] = False # reset mask + mask_rej[inner_indices[idx_limfrac]] = True if False: log.warning (