spafe.utils.vis#

spafe.utils.vis.tick_function(X, fb_type)[source]#

Return correct converted ticks.

Parameters
  • X (numpy.ndarray) – input ticks.

  • fb_type (str) – filter banks type to choose the correct conversion.

Returns

converted ticks to the correct scale.

Return type

(numpy.ndarray)

spafe.utils.vis.show_fbanks(fbanks, center_freqs, ref_freqs, title='Mel filter banks', ylabel='Weight', x1label='Frequency / Hz', x2label='Frequency / mel', figsize=(12, 5), fb_type='mel', show_center_freqs=True)[source]#

visualize a matrix including the filter banks coordinates. Each row corresponds to a filter.

Parameters
  • fbanks (numpy.ndarray) – 2d array including the the filter banks coordinates.

  • ref_freqs (numpy.ndarray) – 1d array reference frequencies

  • title (str) – plot title. (Default is “Mel filter banks”).

  • ylabel (str) – y-axis label. (Default is “Weight”).

  • x1label (str) – lower x-axis label. (Default is “Frequency/ Hz”).

  • x2label (str) – upper x-axis label. (Default is “Frequency/ mel”).

  • figsize (tuple) – size of figure. (Default is (12, 5)).

  • fb_type (str) – type of filter banks. (Default is “mel”).

  • show_center_freqs (bool) – if true show center frequencies. (Default is True).

spafe.utils.vis.show_spectrogram(spectrogram, fs, xmin, xmax, ymin, ymax, dbf=80.0, xlabel='Time (s)', ylabel='Frequency (Hz)', title='Mel spectrogram (dB)', figsize=(14, 4), cmap='jet', colorbar=True)[source]#

Visualize the spectrogram.

Parameters
  • feats (numpy.ndarray) – 2d array including the the features coefficients.

  • fs (int) – sampling rate.

  • xmin (float) – minimum x-axis value.

  • xmax (float) – maximum x-axis value.

  • ymin (float) – minimum y-axis value.

  • ymax (float) – maximum y-axis value.

  • dbf (float) – db reference value. (Default is 80.0).

  • xlabel (str) – x-axis label. (Default is “Time (s)”).

  • ylabel (str) – y-axis label. (Default is “Frequency (Hz)”).

  • title (str) – plot title. (Default is “Mel spectrogram (dB)”).

  • figsize (tuple) – size of figure. (Default is (14, 4)).

  • cmap (str) – matplotlib colormap to use. (Default is “jet”).

  • colorbar (bool) – if true add colorbar. (Default is True).

spafe.utils.vis.show_features(feats, title, ylabel, xlabel, figsize=(14, 4), cmap='jet')[source]#

visualize a matrix including the features coefficients. Each row corresponds to a frame.

Parameters
  • feats (numpy.ndarray) – 2d array including the the features coefficients.

  • title (str) – plot title.

  • ylabel (str) – y-axis label.

  • xlabel (str) – x-axis label.

  • figsize (tuple) – size of figure. (Default is (14, 4)).

  • cmap (str) – matplotlib colormap to use. (Default is “jet”).