gammapy.image.block_reduce_hdu(input_hdu, block_size, func, cval=0)[source]

Provides block reduce functionality for image HDUs.



image_hdu : ImageHDU

Original image HDU, unscaled

block_size : ndarray

Array containing down-sampling integer factor along each axis.

func : callable

Function object which is used to calculate the return value for each local block. This function must implement an axis parameter such as numpy.sum or numpy.mean.

cval : float, optional

Constant padding value if image is not perfectly divisible by the block size. Default 0.


image_hdu : ImageHDU

Rebinned Image HDU