Density.center_of_mass#

static Density.center_of_mass(arr, cutoff=None)[source]#

Computes the center of mass of a numpy ndarray instance using all available elements. For template matching it typically makes sense to only input positive densities.

Parameters:
arrNDArray

Array to compute the center of mass of.

cutofffloat, optional

Densities less than or equal to cutoff are nullified for center of mass computation. By default considers all values.

Returns:
NDArray

Center of mass with shape (arr.ndim).