4.10.1.13. eqcorrscan.utils.plotting.pretty_template_plot

eqcorrscan.utils.plotting.pretty_template_plot(template, size=(10.5, 7.5), save=False, savefile=None, title=False, background=False, picks=False)[source]

Plot of a single template, possibly within background data.

Parameters:
  • template (obspy.core.stream.Stream) Template stream to plot
  • size (tuple) tuple of plot size
  • save (bool) if False will plot to screen, if True will save
  • savefile (str) String to save plot as, required if save=True.
  • title (bool) String if set will be the plot title
  • background (obspy.core.stream.stream) Stream to plot the template within.
  • picks (list) List of obspy.core.event.origin.Pick picks.
Returns:

matplotlib.figure.Figure

Example

>>> from obspy import read
>>> import os
>>> from eqcorrscan.core import template_gen
>>> from eqcorrscan.utils.plotting import pretty_template_plot
>>> from eqcorrscan.utils import sfile_util
>>>
>>> test_file = os.path.join('eqcorrscan', 'tests', 'test_data', 'REA',
...                          'TEST_', '01-0411-15L.S201309')
>>> test_wavefile = os.path.join('eqcorrscan', 'tests', 'test_data', 'WAV',
...                              'TEST_',
...                              '2013-09-01-0410-35.DFDPC_024_00')
>>> event = sfile_util.readpicks(test_file)
>>> st = read(test_wavefile)
>>> st = st.filter('bandpass', freqmin=2.0, freqmax=15.0)
>>> for tr in st:
...     tr = tr.trim(tr.stats.starttime + 30, tr.stats.endtime - 30)
>>> template = template_gen._template_gen(event.picks, st, 2)
>>> pretty_template_plot(template, background=st, # doctest +SKIP
...                      picks=event.picks) 

(Source code, png, hires.png)

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