ccdproc icon indicating copy to clipboard operation
ccdproc copied to clipboard

`Combiner.sigma_clipping` overwrites existing masks

Open kbwestfall opened this issue 4 months ago • 1 comments

astropy==6.1.4 ccdproc==2.4.2 numpy==2.1.2

The current implementation of Combine.sigma_clipping overwrites any existing mask. Is that intended?

I.e., instead of:

        self.data_arr.mask = sigma_clip(self.data_arr.data,
                                        sigma_lower=low_thresh,
                                        sigma_upper=high_thresh,
                                        axis=kwd.get('axis', 0),
                                        copy=kwd.get('copy', False),
                                        maxiters=kwd.get('maxiters', 1),
                                        cenfunc=func,
                                        stdfunc=dev_func,
                                        masked=True,
                                        **kwd).mask

would it make sense to instead do:

        self.data_arr.mask |= sigma_clip(self.data_arr.data,
                                         sigma_lower=low_thresh,
                                         sigma_upper=high_thresh,
                                         axis=kwd.get('axis', 0),
                                         copy=kwd.get('copy', False),
                                         maxiters=kwd.get('maxiters', 1),
                                         cenfunc=func,
                                         stdfunc=dev_func,
                                         masked=True,
                                         **kwd).mask

If so, I can submit a short PR.

kbwestfall avatar Oct 22 '24 19:10 kbwestfall