nabu.misc.binning module

nabu.misc.binning.binning(img, bin_factor, out_dtype=<class 'numpy.float32'>)[source]

Bin an image by a factor of “bin_factor”.

Parameters:
  • bin_factor (tuple of int) – Binning factor in each axis.

  • out_dtype (dtype, optional) – Output data type. Default is float32.

Notes

If the image original size is not a multiple of the binning factor, the last items (in the considered axis) will be dropped. The resulting shape is (img.shape[0] // bin_factor[0], img.shape[1] // bin_factor[1])

nabu.misc.binning.binning_n_alt(img, bin_factor, out_dtype=<class 'numpy.float32'>)[source]

Alternate, “clever” but slower implementation