3.4. lag_calc — EQcorrscan 0.1.0 documentation

# 3.4. lag_calc

Functions to generate lag-times for events detected by correlation.

Part of the EQcorrscan module to integrate seisan nordic files into a full cross-channel correlation for detection routine. EQcorrscan is a python module designed to run match filter routines for seismology, within it are routines for integration to seisan and obspy. With obspy integration (which is necessary) all main waveform formats can be read in and output.

This main section contains a script, LFE_search.py which demonstrates the usage of the built in functions from template generation from picked waveforms through detection by match filter of continuous data to the generation of lag times to be used for relative locations.

The match-filter routine described here was used a previous Matlab code for the Chamberlain et al. 2014 G-cubed publication. The basis for the lag-time generation section is outlined in Hardebeck & Shelly 2011, GRL.

Code generated by Calum John Chamberlain of Victoria University of Wellington, 2015.

Note

Pre-requisites:

  - gcc - for the installation of the openCV correlation routine

  - python-cv2 - Python bindings for the openCV routines

  - python-joblib - used for parallel processing

  - python-obspy - used for lots of common seismological processing
      - requires:
          - numpy
          - scipy
          - matplotlib

  - NonLinLoc - used outside of all codes for travel-time generation

Copyright 2015 Calum Chamberlain

This file is part of EQcorrscan.

> EQcorrscan is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

> EQcorrscan is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

> You should have received a copy of the GNU General Public License along with EQcorrscan. If not, see <http://www.gnu.org/licenses/>.

`lag_calc.` `_channel_loop`(detection, template, i=0)

  Utility function to take a stream of data for the detected event and parse the correct data to lag_gen

  Parameters: | detection (obspy.Stream) – Stream of data for the slave event detected using template template (obspy.Stream) – Stream of data as the template for the detection. i (int, optional) – Used to track which process has occured when running in parallel
  Returns: | picks, a tuple of (lag in s, cross-correlation value, station, chan)

`lag_calc.` `day_loop`(detection_streams, template)

  Function to loop through multiple detections for one template - ostensibly designed to run for the same day of data for I/O simplicity, but as you are passing stream objects it could run for all the detections ever, as long as you have the RAM!

  Parameters: | detection_streams (List of obspy.Stream) – List of all the detections for this template that you want to compute the optimum pick for. template (obspy.Stream) – The original template used to detect the detections passed
  Returns: | lags - List of List of tuple: lags[i] corresponds to detection[i], lags[i][j] corresponds to a channel of detection[i], within this tuple is the lag (in seconds), normalised correlation, station and channel.

`lag_calc.` `lag_calc`(detections, detect_data, templates, shift_len=0.2, min_cc=0.4)

  Overseer function to take a list of detection objects, cut the data for them to lengths of the same length of the template + shift_len on either side. This will then write out SEISAN s-file for the detections with pick times based on the lag-times found at the maximum correlation, providing that correlation is above the min_cc.

  Parameters: | detections (List of DETECTION) – List of DETECTION objects detect_data (obspy.Stream) – All the data needed to cut from - can be a gappy Stream templates (List of tuple of String, obspy.Stream) – List of the templates used as tuples of template name, template shift_len (float) – Shift length allowed for the pick in seconds, will be plus/minus this amount - default=0.2 min_cc (float) – Minimum cross-correlation value to be considered a pick, default=0.4