obspy.imaging.spectrogram.spectrogram

spectrogram(data, samp_rate, per_lap=0.9, wlen=None, log=False, outfile=None, fmt=None, axes=None, dbscale=False, mult=8.0, cmap=<matplotlib.colors.LinearSegmentedColormap object>, zorder=None, title=None, show=True, clip=[0.0, 1.0])[source]

Computes and plots spectrogram of the input data.

Parameters:
  • data – Input data

  • samp_rate (float) – Samplerate in Hz

  • per_lap (float) – Percentage of overlap of sliding window, ranging from 0 to 1. High overlaps take a long time to compute.

  • wlen (int or float) – Window length for fft in seconds. If this parameter is too small, the calculation will take forever. If None, it defaults to a window length matching 128 samples.

  • log (bool) – Logarithmic frequency axis if True, linear frequency axis otherwise.

  • outfile (str) – String for the filename of output file, if None interactive plotting is activated.

  • fmt (str) – Format of image to save

  • axes (matplotlib.axes.Axes) – Plot into given axes, this deactivates the fmt and outfile option.

  • dbscale (bool) – If True 10 * log10 of color values is taken, if False the sqrt is taken.

  • mult (float) – Pad zeros to length mult * wlen. This will make the spectrogram smoother.

  • cmap (matplotlib.colors.Colormap) – Specify a custom colormap instance. If not specified, then the default ObsPy sequential colormap is used.

  • zorder (float) – Specify the zorder of the plot. Only of importance if other plots in the same axes are executed.

  • title (str) – Set the plot title

  • show (bool) – Do not call plt.show() at end of routine. That way, further modifications can be done to the figure before showing it.

  • clip ([float, float]) – adjust colormap to clip at lower and/or upper end. The given percentages of the amplitude range (linear or logarithmic depending on option dbscale) are clipped.