maad.util.moments

maad.util.moments(X, axis=None)[source]

Computes the first 4th moments of a vector (1d, ie. spectrum or waveform) or spectrogram (2d)

  • mean

  • variance

  • skewness

  • kurtosis

Parameters:
Xndarray of floats

vector (1d : spectrum, waveform) or matrix (2d : spectrogram).

axisinterger, optional, default is None

if spectrogram (2d), select the axis to estimate the moments.

Returns:
meanfloat

mean of X

varfloat

variance of X

skewfloat

skewness of X

kurtfloat

kurtosis of X

Examples

>>> from maad import sound, util
>>> s, fs = sound.load('../data/spinetail.wav')
>>> mean, var, skew, kurt = util.moments(s)
>>> print ('mean:%2.4f / var:%2.4f / skew:%2.4f / kurt:%2.4f' %(mean, var, skew, kurt)) 
mean:-0.0000 / var:0.0012 / skew:-0.0065 / kurt:24.7116