Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom uncertainty propagation functions to operation on UnknownUncertainty objects in NDCube.rebin #639

Open
DanRyanIrish opened this issue Sep 11, 2023 · 0 comments

Comments

@DanRyanIrish
Copy link
Member

DanRyanIrish commented Sep 11, 2023

Describe the feature

Currently NDCube.rebin raises a warning if the uncertainty type is unknown (see here) and proceeds without propagating the uncertainty. While this is justified for the default uncertainty propagation function, it is confusing as it allows users to supply a disallowed kwarg without erroring. Moreover, users may have "unknown" uncertainty types that they know how to propagate, e.g. instrument-specific uncertainties. However, this is forbidden by the current NDCube.rebin implementation. Instead, if a user supplies a propagation function, the responsibility for deciding what types are valid should go to that function.

Proposed solution

Move the check at L1135 to L1146 and convert the warning to an error, i.e.

if propagate_uncertainties is True:
    if isinstance(self.uncertainty, astropy.nddata.UnknownUncertainty):
        raise ValueError("self.uncertainty is of type UnknownUncertainty which does not "
                         "support uncertainty propagation.")
    propagate_uncertainties = utils.cube.propagate_rebin_uncertainties
# Continue function...

This will error if the uncertainty type is unknown only if the default propagation function is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant