maad.features.acoustic_gradient_index

maad.features.acoustic_gradient_index(Sxx, dt, order=1, norm='per_bin', display=False)[source]

Compute the Acoustic Gradient Index (AGI) from a raw spectrogram.

This index must be computed on a raw spectrogram (background noise must remain).

Parameters:
Sxxndarray of floats

2d : Spectrogram

dtfloat

Time resolution in seconds.

normstring, optional, default is ‘per_bin’

Determine if the AGI is normalized by the global mean value (‘global’ mode) or by the median value per frequency bin (‘per_bin’)

Returns:
AGI_xx2d ndarray of scalars

Acoustic Gradient Index of the spectrogram

AGI_per_bin1d ndarray of scalars

AGI value for each frequency bin sum(AGI_xx,axis=1)

AGI_sumscalar

Sum of AGI value per frequency bin (Common definition) sum(AGI_per_bin)

AGI_mean ; scalar

average AGI value per frequency bin (independant of the number of frequency bin) mean(AGI_per_bin)

Examples

>>> import maad

During the day

>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav')
>>> Sxx_power,tn,fn,_ = maad.sound.spectrogram(s,fs)
>>> _, _, AGI_mean, _ = maad.features.acoustic_gradient_index(Sxx_power,tn[1]-tn[0])
>>> AGI_mean 
5.026112548525073

During the night

>>> s, fs = maad.sound.load('../data/cold_forest_night.wav')
>>> Sxx_power,tn,fn,_ = maad.sound.spectrogram(s,fs)
>>> _, _, AGI_mean, _ = maad.features.acoustic_gradient_index(Sxx_power,tn[1]-tn[0])
>>> AGI_mean 
1.45631461307782