def autocorr(trace):
"""This function takes an obspy trace object and performs a phase autocorrelation
of the trace with itself. First, the hilbert transform is taken to obtain the
analytic signal and hence the instantaneous phase. This is then passed to a
fortran script where phase correlation is performed after Schimmel et al., 2011.
This function relies on the shared object file phasecorr.so, which is the file
containing the fortran subroutine for phase correlation.
"""
import numpy as np
from scipy.signal import hilbert
from phasecorr import phasecorr
# Hilbert transform to obtain the analytic signal
htrans = hilbert(trace)
# Perform phase autocorrelation with instantaneous phase
pac = phasecorr(np.angle(htrans),np.angle(htrans),len(htrans))
return pac
phase_autocorr.py 文件源码
python
阅读 40
收藏 0
点赞 0
评论 0
评论列表
文章目录