pyFDN.plot_spectrogram#

pyFDN.plot_spectrogram(ir, fs, *, nperseg=1024, noverlap=None, window='blackman', xlim=(None, None), ylim=(None, None), dynamic_range=80.0, title='Spectrogram', xlabel='Time [s]', ylabel='Frequency [Hz]', height=500, colorscale='Viridis')[source]#

Plot spectrogram of a 1-D signal as a Matplotlib image.

Uses the same default parameters as the Poletti example: Blackman window, 1024-point segments, 75% overlap, log y-axis, dB magnitude.

Parameters:
  • ir (array-like, 1-D) – Time-domain signal (e.g. one channel of an impulse response).

  • fs (float) – Sample rate in Hz (for axis labels and frequency scale).

  • nperseg (int) – Length of each segment for the STFT. Default 1024.

  • noverlap (int, optional) – Number of overlapping samples. Default nperseg // 4 * 3 (75% overlap).

  • window (str or tuple) – Window name or (name, param). Default “blackman”.

  • xlim (tuple (xmin, xmax)) – Time axis limits in seconds. Use None for auto.

  • ylim (tuple (ymin, ymax)) – Frequency axis limits in Hz. Use None for auto (ymax defaults to fs/2).

  • dynamic_range (float, optional) – Color (magnitude) range in dB below the peak of the displayed spectrogram. Default 80. Use None for Plotly’s auto scaling.

  • title (str, optional) – Figure title.

  • xlabel (str) – Axis labels.

  • ylabel (str) – Axis labels.

  • height (int) – Figure height in pixels.

  • colorscale (str) – Colormap name (lowercased to a Matplotlib colormap). Default “Viridis”.

Returns:

fig

Return type:

matplotlib.figure.Figure