ndcube.utils.cube.propagate_rebin_uncertainties(uncertainty, data, mask, operation, operation_ignores_mask=False, propagation_operation=None, correlation=0, **kwargs)[source]#

Default algorithm for uncertainty propagation in rebin().

First dimension of uncertainty, data and mask inputs represent the pixels in the bin being aggregated by the rebin process while the latter dimensions must have the same shape as the rebinned data. The operation input is the function used to aggregate elements in the first dimension, e.g. numpy.sum.

  • uncertainty (astropy.nddata.NDUncertainty) – Cannot be instance of astropy.nddata.UnknownUncertainty. The uncertainties associated with the data. The first dimension represents pixels in each bin being aggregated while trailing dimensions must have the same shape as the rebinned data.

  • data (array-like or None) – The data associated with the above uncertainties. Must have same shape as above.

  • mask (array-like of bool or None) – Indicates whether any uncertainty elements should be ignored in propagation. If True, corresponding uncertainty element is ignored. If False, it is used. Must have same shape as above.

  • operation (function) – The function used to aggregate the data for which the uncertainties are being propagated here.

  • operation_ignores_mask (bool) – Determines whether masked values are used or excluded from calculation. Default is False causing masked data and uncertainty to be excluded.

  • propagation_operation (function) – The operation which defines how the uncertainties are propagated. This can differ from operation, e.g. if operation is sum, then propagation_operation should be add.

  • correlation (int) – Passed to astropy.nddata.NDUncertainty.propagate. See that method’s docstring. Default=0.


new_uncertainty (same type as uncertainty input.) – The propagated uncertainty. Same shape as input uncertainty without its first dimension.