Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « scipy.ndimage »

Fonction sum_labels - module scipy.ndimage

Signature de la fonction sum_labels

def sum_labels(input, labels=None, index=None) 

Description

help(scipy.ndimage.sum_labels)

Calculate the sum of the values of the array.

Parameters
----------
input : array_like
    Values of `input` inside the regions defined by `labels`
    are summed together.
labels : array_like of ints, optional
    Assign labels to the values of the array. Has to have the same shape as
    `input`.
index : array_like, optional
    A single label number or a sequence of label numbers of
    the objects to be measured.

Returns
-------
sum : ndarray or scalar
    An array of the sums of values of `input` inside the regions defined
    by `labels` with the same shape as `index`. If 'index' is None or scalar,
    a scalar is returned.

See Also
--------
mean, median

Examples
--------
>>> from scipy import ndimage
>>> input =  [0,1,2,3]
>>> labels = [1,1,2,2]
>>> ndimage.sum_labels(input, labels, index=[1,2])
[1.0, 5.0]
>>> ndimage.sum_labels(input, labels, index=1)
1
>>> ndimage.sum_labels(input, labels)
6




Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé