Skip to content

Combiner.sigma_clipping overwrites existing masks #849

Open
@kbwestfall

Description

@kbwestfall

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions