Note

You are not reading the most up to date version of Gammapy documentation.
Access the latest stable version v1.3 or the list of Gammapy releases.

image_groupby

gammapy.image.image_groupby(images, labels)[source]

Group pixel by labels.

This function is similar to scipy.ndimage.measurements.labeled_comprehension, but more general because it supports multiple input and output images.

Parameters:

images : list of ndarray

List of image objects.

labels : ndarray

Labels for pixel grouping.

Returns:

groups : list of ndarray

Grouped pixels acording to the labels.