eqcorrscan.core.template_gen.from_sfile

eqcorrscan.core.template_gen.from_sfile(sfile, lowcut, highcut, samp_rate, filt_order, length, swin, prepick, all_horiz=False, delayed=True, plot=False, debug=0)[source]

Generate multiplexed template from a Nordic (Seisan) s-file.

Function to read in picks from sfile then generate the template from the picks within this and the wavefile found in the pick file.

Parameters:
  • sfile (str) sfilename must be the path to a seisan nordic type s-file containing waveform and pick information.
  • lowcut (float) Low cut (Hz), if set to None will look in template defaults file
  • highcut (float) High cut (Hz), if set to None will look in template defaults file
  • samp_rate (float) New sampling rate in Hz, if set to None will look in template defaults file
  • filt_order (int) Filter level, if set to None will look in template defaults file
  • length (float) Extract length in seconds, if None will look in template defaults file.
  • swin (str) Either ‘all’, ‘P’ or ‘S’, to select which phases to output.
  • prepick (float) Length to extract prior to the pick in seconds.
  • all_horiz (bool) To use both horizontal channels even if there is only a pick on one of them. Defaults to False.
  • delayed (bool) If True, each channel will begin relative to it’s own pick-time, if set to False, each channel will begin at the same time.
  • plot (bool) Turns template plotting on or off.
  • debug (int) Debug level, higher number=more output.
Returns:

Newly cut template.

Return type:

obspy.core.stream.Stream

Warning

This will use whatever data is pointed to in the s-file, if this is not the coninuous data, we recommend using other functions. Differences in processing between short files and day-long files (inherent to resampling) will produce lower cross-correlations.

Example

>>> from eqcorrscan.core.template_gen import from_sfile
>>> import os
>>> sfile = os.path.join('eqcorrscan', 'tests', 'test_data',
...                      'REA', 'TEST_', '01-0411-15L.S201309')
>>> template = from_sfile(sfile=sfile, lowcut=5.0, highcut=15.0,
...                       samp_rate=50.0, filt_order=4, swin='P',
...                       prepick=0.2, length=6, all_horiz=True)
>>> print(len(template))
15
>>> print(template[0].stats.sampling_rate)
50.0
>>> template.plot(equal_scale=False, size=(800,600)) 

(Source code, png, hires.png)

../../_images/eqcorrscan-core-template_gen-from_sfile-1.png