4.15.1.3. eqcorrscan.utils.stacking.align_traces

eqcorrscan.utils.stacking.align_traces(trace_list, shift_len, master=False, positive=False, plot=False)[source]

Align traces relative to each other based on their cross-correlation value.

Uses the obspy.signal.cross_correlation.xcorr() function to find the optimum shift to align traces relative to a master event. Either uses a given master to align traces, or uses the first trace in the list.

Note

The cross-correlation function may yield an error/warning about shift_len being too large: this is raised by the obspy.signal.cross_correlation.xcorr() routine when the shift_len is greater than half the length of either master or a trace, then the correlation will not be robust. We may switch to a different correlation routine later.

Parameters:
  • trace_list (list) List of traces to align
  • shift_len (int) Length to allow shifting within in samples
  • master (obspy.core.trace.Trace) Master trace to align to, if set to False will align to the largest amplitude trace (default)
  • positive (bool) Return the maximum positive cross-correlation, or the absolute maximum, defaults to False (absolute maximum).
  • plot (bool) If true, will plot each trace aligned with the master.
Returns:

list of shifts and correlations for best alignment in seconds.

Return type:

list