[obspy-users] CWT

Martin van Driel vandriel at tomo.ig.erdw.ethz.ch
Thu Feb 7 09:09:25 CET 2013


Dear Javier and Jeremie,

just to clarify on w0: it has units of frequency and is a control 
parameter that influences the shape of the wavelet (roughly: how many 
wiggles within the gaussian window). This way it allows to adjust 
between time and frequency resolution. For more details on that: the cwt 
function in tf_misfit actually is a straight implementation of equations 
(4) and (5) in [1].

The relation between scale and (peak) frequency then is f = w0 / (2 pi 
a) where a is the scale.


Cheers,
Martin

[1]: Kristekova, M., Kristek, J., Moczo, P., & Day, S. M. (2006). 
Misfit Criteria for Quantitative Comparison of Seismograms. Bulletin of 
the Seismological Society of America, 96(5), 1836-1850.

On 02/07/2013 12:07 AM, Jeremie Vasseur wrote:
> Hi Javier,
>
> The cwt function in tf_misfit uses the following arguments:
>
> - st: the data array to be processed (either a list or a numpy.ndarray),
> - dt: the time difference between two samples in your data array,
> - w0: the natural frequency of the wavelet to be used, since only the Morlet wavelet is implemented,
> - fmin and fmax: lower and upper limit of the frequency range,
> - nf: number of scales (it discretizes the frequency range by this number) (default set to 100),
> - wl: the name of the wavelet to be applied (only 'morlet' is implemented).
>
> A short example would be:
>
>>>> from obspy.core import read
>>>> from obspy.signal.tf_misfit import cwt
>>>> import numpy as np, matplotlib.pyplot as plt
>>>> tr = read()[0]
>>>> npts = tr.stats.npts
>>>> samp_rate = tr.stats.sampling_rate
>>>> dt = npts / samp_rate
>>>> t = np.linspace(0, dt, npts)
>>>> scalogram = cwt(tr.data, 1/samp_rate, 8, 1, 50)
>>>> fig = plt.figure()
>>>> ax = fig.add_subplot(111)
>>>> ax.imshow(np.abs(scalogram)[-1::-1], extent=[t[0], t[-1], 1, 50], aspect='auto')
>>>> ax.set_xlabel("Time")
>>>> ax.set.ylabel("Frequency")
>>>> plt.show()
>
> Hope it helps.
>
> Cheers,
> Jeremie
>
> On 06.02.2013, at 21:47, javier francisco pacheco alvarado <javier.pacheco.alvarado at una.cr> wrote:
>
>> Dear Obspy users;
>>
>> In the Obspy Tutorial there is an example for the use of the cwt function but it uses the mlpy package of Python.
>> I would like to use the obspy function on tf_misfit, but on the library reference description, the call for the function is different from the description of the parameters.
>> Does any body has an example for the use of the cwt similar to the one that is described on the tutorial ?
>>
>> Thank you very much for your help
>>
>> Javier Fco. Pacheco.
>> _______________________________________________
>> obspy-users mailing list
>> obspy-users at lists.sevor.de
>> http://lists.obspy.org/cgi-bin/mailman/listinfo/obspy-users
>
> Jeremie Vasseur
> Physical Volcanology
> Earth & Env. Sciences
> LMU Munich, Germany
> +49 (0)89 21804330
>
>
> _______________________________________________
> obspy-users mailing list
> obspy-users at lists.sevor.de
> http://lists.obspy.org/cgi-bin/mailman/listinfo/obspy-users
>




More information about the obspy-users mailing list