# 3. EQcorrscan tutorials

Welcome to EQcorrscan - this package is designed to compute earthquake detections using a paralleled matched-filter network cross-correlation routine, and analyse the results.

Before continuing with this tutorial please check that you have installed all the pre-requisite modules, as not all will be installed by the setup.py file. The list of these is in the Introduction section of this documentation.

As you will see, this package is divided into two main sub-modules, the core and utils sub-modules. The core sub-module contains the main, high-level functions:

bright_lights: | A brightness based template detection routine;
template_gen: | A series of routines to generate templates for match-filter detection from continuous or cut data, with pick-times either defined manually, or defined in event files;
match_filter: | The main matched-filter routines, this is split into several smaller functions to allow python-based parallel-processing;
subspace: | Subspace detection routine based on Harris (2006).
lag_calc: | Routines for calculating optimal lag-times for events detected by the match-filter routine, these lags can then be used to define new picks for high accuracy re-locations.

Some other high-level functions are included in the utils sub-module and are documented here with tutorials:

mag_calc: | Simple local magnitude calculation and high-precision relative moment calculation using singular-value decomposition.
clustering: | Routines for clustering earthquakes based on a range of metircs using agglomorative clustering methods.

The utils sub-module contains useful, but small functions. These functions are rarely cpu intensive, but perform vital operations, such as reading Seisan s-files (sfile_util), finding peaks in noisy data (findpeaks), converting a seisan database to hypoDD formatted files and computing cross-correlations between detections for HypoDD (a double difference relocation software) (catalog_to_dd), calculating magnitudes (mag_calc), clustering detections (clustering), stacking detections (stacking), making pretty plots (plotting), and processing seismic data in the same way repeatedly using Obspy‘s functionality (pre_processing).

What follows is an expanding set of tutorials that should take you through some of the key functionality of the EQcorrscan package.

- 3.1. Template creation
- 3.2. Matched-filter detection
- 3.3. Subspace Detection
- 3.4. Lag-time and pick correction
- 3.5. Magnitude calculation
- 3.6. Clustering and stacking