I am currently in my last year of Master in Bioengineering, and am studying the application of the wavelet transform for various uses. For instance, wavelet analysis can be used to calculate the covariance between two one-dimensional (dimension 1*N) signals x and y, via the following formula provided by Schaller et al.,2017 and Paleri,2022 :
covariance formula(click on the blue underlined caracters to see the formula)
where :
- Tx(a,b) are the wavelet coefficients of x
- T*y(a,b) are the complex conjugates of the wavelet coefficients of y
- a is the scale corresponding to the coefficient
- j is the scale index
- n is the time index
- dt and dj are the discretization steps of the time domain and scale domain respectively
- C(delta) is the reconstruction factor, that has a value of 0.776 for the Morlet wavelet according to Torrence et Compo, 1998.
NB : In these three articles (Paleri et al., Schaller et al. and Torrence et Compo), the wavelet are normalized to have unit energy, which is a synonym of the L²-normalization. This normalization implies that the daughter wavelets are calculated with a factor a^(-0.5) compared to the mother wavelet (see the formula provided in Schaller et al., 2017 : daughter wavelet. This normalization has an impact on the calculated C(delta)).
I implemented this formula in Python. But when I take two real (non-complex) artificial signal x and y of zero mean, the calculated covariance differs from the covariance of the numpy function np.cov(). Here is a graphical representation of x and y : y_signal x_signal(click on the blue underlined caracters)
The covariance calculated with wavelets is : -0.001757, while the covariance calculated with numpy.cov is : -0.001499
My question : Does anybody have an idea why the calculation of the covariance differs?
- Bonus question : the covariance calculated with the Mexican hat wavelet (using the respective reconstruction factor, also found in Torrence et Compo,1998) is totally incorrect. If you have any idea why, feel free to give me a hint!