bin_array

gunagala.utils.bin_array(data, binning_factor, bin_func=<function sum>)[source]

Bin 2D array data by a given factor using a given binning function.

Parameters:
data: numpy.array

Array to be binned.

binning_factor: int

Size of the binning regions, in pixels.

bin_func: function, optional

Function to be used to combine the pixel values within each binning region. The function must accept a numpy.array as the first argument, and accept an axis keyword argument to specify which array axis to peform the combination on. Default numpy.sum().

Returns:
binned: numpy.array

Binned array.