maad.features.roughness

maad.features.roughness(x, norm=None, axis=0)[source]

Computes the roughness (depends on the number of peaks and their amplitude) of a vector or matrix x (i.e. waveform, spectrogram…) Roughness = sum(second_derivation(x)²) [1] [2]

Parameters:
xndarray of floats

x is a vector (1d) or a matrix (2d)

normboolean, optional. Default is None
  • ‘global’ : normalize by the maximum value in the vector or matrix

  • ‘per_axis’ : normalize by the maximum value found along each axis

axisint, optional, default is 0

select the axis where the second derivation is computed

if x is a vector, axis=0

if x is a 2d ndarray, axis=0 => rows, axis=1 => columns

Returns:
yfloat or ndarray of floats

References

[1]

Described in Ramsay, J. O., & Silverman, B. W. (2005). Principal components analysis for functional data. Functional data analysis, 147-172. https://link.springer.com/content/pdf/10.1007/0-387-22751-2_8.pdf

[2]

Ported from SEEWAVE R Package http://rug.mnhn.fr/seewave. Sueur, J., Aubin, T., & Simonis, C. (2008). Seewave, a free modular tool for sound analysis and synthesis. Bioacoustics, 18(2), 213-226. DOI: 10.1080/09524622.2008.9753600