maad.features.acoustic_diversity_index

maad.features.acoustic_diversity_index(Sxx, fn, fmin=0, fmax=20000, bin_step=1000, dB_threshold=-50, index='shannon')[source]

Compute the Acoustic Diversity Index (ADI) from a spectrogram [1].

The diversity can be computed using Shannon, Simpson, or the inverse Simpson diversity index.

Parameters:
Sxxndarray of floats

2d : amplitude spectrogram. In order to obtain the same output as for soundecology, the signal and the spectrogram need to be processed without detrend on. maad.sound.load(“myfile.wav”, …, detrend = False) maad.sound.spectrogram(s, fs, …, detrend = False) For a complete example, see the example below

fn1d ndarray of floats

frequency vector

fminscalar, optional, default is 0

Minimum frequency in Hz

fmaxscalar, optional, default is 20000

Maximum frequency in Hz

bin_stepscalar, optional, default is 500

Frequency step in Hz

dB_thresholdscalar, optional, default is -50dB

Threshold to compute the score (ie. the number of data > threshold, normalized by the length)

indexstring, optional, default is “shannon”
  • “shannon” : Shannon entropy is calculated on the vector of scores

  • “simpson” : Simpson index is calculated on the vector of scores

  • “invsimpson” : Inverse Simpson index is calculated on the vector of scores

Returns:
ADIscalar

Acoustic Diversity Index of the spectrogram (ie. index of the vector of scores)

Notes

The Acoustic Eveness Index (AEI) and the Acoustic Diversity Index (ADI) are negatively correlated.

References

[1]

Villanueva-Rivera, L. J., B. C. Pijanowski, J. Doucette, and B. Pekin. 2011. A primer of acoustic analysis for landscape ecologists. Landscape Ecology 26: 1233-1246.`DOI: 10.1007/s10980-011-9636-9 <https://doi.org/10.1007/s10980-011-9636-9>`_

Examples

>>> import maad

Load the signal and compute the spectrogram to give the same result as soundecology

>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav', detrend=False)
>>> Sxx, tn, fn, ext = maad.sound.spectrogram (s, fs, nperseg=int(fs/10), noverlap=0, mode='amplitude', detrend=False) 
>>> ADI  = maad.features.acoustic_diversity_index(Sxx,fn,fmax=10000)
>>> print('ADI : %2.2f ' %ADI) 
ADI : 2.05

Load the signal and compute the spectrogram as usual (detrend ON) such that the dB threshold needs to be adapted to give results that are more or less in line with soundecology

>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav') 
>>> Sxx, tn, fn, ext = maad.sound.spectrogram (s, fs, mode='amplitude')   
>>> ADI  = maad.features.acoustic_diversity_index(Sxx,fn,fmax=10000, dB_threshold = -47)
>>> print('ADI : %2.2f ' %ADI) 
ADI : 2.06