maad.features.shape_features_raw

maad.features.shape_features_raw(im, resolution='low', opt_shape=None)[source]

Computes raw shape of 2D signal (image or spectrogram) at multiple resolutions using 2D Gabor filters. Contrary to shape_features, this function delivers the raw response of the spectrogram to each filter of the filter bank. This function can be used to have access to spectrograms filtered by the filterbank.

Parameters:
Sxx: 2D array

Spectrogram to be analysed

resolution:

Resolution of analysis, i.e. number of filters used. Three presets are provided, ‘low’, ‘mid’ and ‘high’, which control the number of filters.

opt_shape: dictionary (optional)

options for the filter bank (kbank_opt) and the number of scales (npyr)

Returns:
shape_raw: list

Raw shape response of spectrogram to every filter of the filter bank. Every element of the list is the response to one of the filters. Detail of each filter are available in the params DataFrame returned.

params: pandas DataFrame

Corresponding parameters of the 2D fileters used to compute the shape coefficient. Params has 4 fields (theta, freq, pyr_level, scale)

Examples

>>> import maad

Scatter the spectrogram acoustic components using 2D Gabor filters.

>>> from maad.sound import load, spectrogram 
>>> from maad.features import shape_features_raw
>>> from maad.util import power2dB, plot2d
>>> s, fs = load('../data/spinetail.wav')
>>> Sxx, tn, fn, ext = spectrogram(s, fs, db_range=80, display=True) 
>>> Sxx_db = power2dB(Sxx, db_range=80)
>>> shape_raw, params = shape_features_raw(Sxx_db, resolution='low')
>>> fig, ax = plot2d(shape_raw[0], **{'extent':ext, 'title': 'High-frequency vertical component'})
>>> fig, ax = plot2d(shape_raw[13], **{'extent':ext, 'title': 'Low-frequency vertical components'})
>>> fig, ax = plot2d(shape_raw[2], **{'extent':ext, 'title': 'High-frequency horizontal components'})
>>> fig, ax = plot2d(shape_raw[15], **{'extent':ext, 'title': 'Low-frequency horizontal components'})