6.2.10.8. eqcorrscan.utils.plotting.peaks_plot

eqcorrscan.utils.plotting.peaks_plot(data, starttime, samp_rate, peaks=None, **kwargs)[source]

Plot peaks to check that the peak finding routine is running correctly.

Used in debugging for the EQcorrscan module.

Parameters:
  • data (numpy.array) – Numpy array of the data within which peaks have been found

  • starttime (obspy.core.utcdatetime.UTCDateTime) – Start time for the data

  • samp_rate (float) – Sampling rate of data in Hz

  • peaks (list) – List of tuples of peak locations and amplitudes (loc, amp)

  • title (str) – Title of figure

  • show (bool) – Whether to show the figure or not (defaults to True)

  • save (bool) – Whether to save the figure or not (defaults to False)

  • savefile (str) – Filename to save figure to, if save==True (defaults to “EQcorrscan_figure.png”)

  • return_figure (bool) – Whether to return the figure or not (defaults to True), if False then the figure will be cleared and closed.

  • size (tuple of float) – Figure size as (width, height) in inches. Defaults to (10.5, 7.5)

Returns:

matplotlib.figure.Figure

Example

>>> import numpy as np
>>> from eqcorrscan.utils import findpeaks
>>> from eqcorrscan.utils.plotting import peaks_plot
>>> from obspy import UTCDateTime
>>> data = np.random.randn(200)
>>> data[30] = 100
>>> data[60] = 40
>>> threshold = 10
>>> peaks = findpeaks.find_peaks2_short(data, threshold, 3)
>>> peaks_plot(data=data, starttime=UTCDateTime("2008001"),
...            samp_rate=10, peaks=peaks)  

(Source code)