maad.util.entropy
- maad.util.entropy(x, axis=0)[source]
Compute the entropy of a vector (waveform) or matrix (spectrogram).
- Parameters:
- xndarray of floats
x is a vector (1d) or a matrix (2d)
- axisint, optional, default is 0
select the axis where the entropy is computed if x is a vector, axis=0 if x is a 2d ndarray, axis=0 => rows, axis=1 => columns
- Returns:
- Hfloat or ndarray of floats
entropy of x
Examples
>>> from maad import sound, util >>> s, fs = sound.load('../data/spinetail.wav') >>> H = util.entropy(s) >>> print ('Entropy is %2.4f' %H) Entropy is 0.9998