mtuq.Wavelet¶
- class mtuq.Wavelet[source]¶
Bases:
object
Source wavelet/source-time function base class
Most easily, an analytical expression can be used to define the wavelet, but a user-supplied time series or on-the-fly numerical procedure can also be used. By inheriting from this class and implementing the
evaluate
method, all of these differents types of wavelets can be defined.Example
We can implement a Gaussian function with unit standard deviation as follows:
class SimpleGaussian(Wavelet): def evaluate(self, t): return ((2*np.pi)**0.5)**(-1.)*np.exp(-0.5*(t)**2.)
We can now evaluate
SimpleGaussian
on any given set, say, on the interval [-5, +5]:wavelet = SimpleGaussian() t = np.linspace(-5,. +5., 101) y = wavelet.evaluate(t)
Or we can convolve it with an ObsPy trace:
from obspy import read trace = read('http://examples.obspy.org/exaple_data.sac')[0] convolved_trace = wavelet.convolve(trace)
Public Methods
Convolves ObsPy trace with given wavelet
Evaluates wavelet at chosen points
Private Methods
Warning
Private methods are mainly for internal/developer use and their API might change without notice.
Convolves NumPy array with given wavelet
Evaluates wavelet on an interval about zero