maad.features.spectral_entropy

maad.features.spectral_entropy(Sxx, fn, flim=None, display=False)[source]

Compute different entropies based on the average spectrum, its variance, and its maxima [1] [2]

Parameters:
Sxxndarray of floats

Spectrogram (2d). It is recommended to work with PSD to be consistent with energy conservation

fn1d ndarray of floats

frequency vector

flimtupple (fmin, fmax), optional, default is None

Frequency band used to compute the spectral entropy. For instance, one may want to compute the spectral entropy for the biophony bandwidth

displayboolean, optional, default is False

Display the different spectra (mean, variance, covariance, max…)

Returns:
EASscalar

Entropy of Average Spectrum

ECUscalar

Entropy of spectral variance (along the time axis for each frequency)

ECVscalar

Entropy of Coefficient of Variation (along the time axis for each frequency)

EPSscalar

Entropy of spectral maxima (peaks)

EPS_KURTscalar

Kurtosis of spectral maxima

EPS_SKEWscalar

Skewness of spectral maxima

References

[1]

TOWSEY, Michael W. The calculation of acoustic indices derived from long-duration recordings of the natural environment. 2017. https://eprints.qut.edu.au/110634/1/QUTePrints110634_TechReport_Towsey2017August_AcousticIndices%20v3.pdf

[2]

QUT : https://github.com/QutEcoacoustics/audio-analysis. Michael Towsey, Anthony Truskinger, Mark Cottman-Fields, & Paul Roe. (2018, March 5). Ecoacoustics Audio Analysis Software v18.03.0.41 (Version v18.03.0.41). Zenodo. http://doi.org/10.5281/zenodo.1188744

Examples

>>> import maad
>>> s, fs = maad.sound.load('../data/cold_forest_daylight.wav')
>>> Sxx_power, tn, fn, _ = maad.sound.spectrogram (s, fs)  
>>> EAS, ECU, ECV, EPS, EPS_KURT, EPS_SKEW = maad.features.spectral_entropy(Sxx_power, fn, flim=(2000,10000)) 
>>> print('EAS: %2.2f / ECU: %2.2f / ECV: %2.2f / EPS: %2.2f / EPS_KURT: %2.2f / EPS_SKEW: %2.2f' % (EAS, ECU, ECV, EPS, EPS_KURT, EPS_SKEW)) 
EAS: 0.27 / ECU: 0.49 / ECV: 0.24 / EPS: 0.25 / EPS_KURT: 17.58 / EPS_SKEW: 3.55