def time(self, t, s=1.0):
"""
Return a DOG wavelet,
When m = 2, this is also known as the "Mexican hat", "Marr"
or "Ricker" wavelet.
It models the function::
``A d^m/dx^m exp(-x^2 / 2)``,
where ``A = (-1)^(m+1) / (gamma(m + 1/2))^.5``
and ``x = t / s``.
Note that the energy of the return wavelet is not normalised
according to s.
Parameters
----------
t : float
Time. If s is not specified, this can be used as the
non-dimensional time t/s.
s : scalar
Width parameter of the wavelet.
Returns
-------
float : value of the ricker wavelet at the given time
Notes
-----
The derivative of the gaussian has a polynomial representation:
from http://en.wikipedia.org/wiki/Gaussian_function:
"Mathematically, the derivatives of the Gaussian function can be
represented using Hermite functions. The n-th derivative of the
Gaussian is the Gaussian function itself multiplied by the n-th
Hermite polynomial, up to scale."
http://en.wikipedia.org/wiki/Hermite_polynomial
Here, we want the 'probabilists' Hermite polynomial (He_n),
which is computed by scipy.special.hermitenorm
"""
x = t / s
m = self.m
# compute the hermite polynomial (used to evaluate the
# derivative of a gaussian)
He_n = scipy.special.hermitenorm(m)
gamma = scipy.special.gamma
const = (-1) ** (m + 1) / gamma(m + 0.5) ** .5
function = He_n(x) * np.exp(-x ** 2 / 2)
return const * function
评论列表
文章目录