5.11.1.9. eqcorrscan.utils.plotting.peaks_plot

eqcorrscan.utils.plotting.peaks_plot(data, starttime, samp_rate, save=False, peaks=[(0, 0)], savefile=None)[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
  • save (bool) – Save figure or plot to screen.
  • peaks (list) – List of tuples of peak locations and amplitudes (loc, amp)
  • savefile (str) – Path to save to, only used if save=True
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, png, hires.png)

../../_images/eqcorrscan-utils-plotting-peaks_plot-1.png