This will help to change a certain time and frequency of a signal using wavelet transform.
This file is used to save wavelet functions. In my respository, the real part of Shannon Wavelet is used as an example. It can be used because real part of Shannon Wavelets are orthogonal[1]. According to Wikipedia of Shannon Wavelet, the expression of the real part of Shannon Wavelets can be written as:
In which
The window function for wavelet can be written as:
In which s is scale,
WShannon_sp is ???
This file is used to calculate the time and frequency window. For a given time shift and scale, we have to decide the center time
Time center:
RMS radius of time:
The center and radius for frequency is similar to time, they can be represented as:
Frequecny center:
RMS radius of frequency:
In which,
This file are using the formulas above to calculate the important parameters of time-frequency windows.
This file can be divided into three parts, they are dealing with 1.wavelet transform, 2.phase calculation and randomization, 3. reconstruct of the signal.
Continuous wavelet transform can cover the whole time and frequency domian, which is unpractical. As we are only considering change a certain part of time and frequency, we can only integrate in a certain range to find out the wavelet coefficient of certain time and frequency.
The wavelet coefficient for all time range and frequency range:
If we have assign a certain time and frequency and want to figure out its wavelet coefficient and the wavelet coefficient which is consecutive to it. We have to notice, that the two wavelet have the same frequency but different time shift. However, same frequency means that they have the same RMS time radius. Thus we assume that the distance of center time of two consecutive wavelets is twice the RMS time radius.
We assume to change the signal in scale of 1 and time shift of 10.003( this is to hope that in the later calculation we won't divide by 0).
dt= 0.01
i=np.arange(0, 119, dt)
W1=np.sum(signal[i]* wavelets.WShannon(i, tshi, sca)*dt)
W2=np.sum(signal[i]* wavelets.WShannon(i, tshi+2*TR, sca)*dt)
To find out the corresponding signal of these two parts, we need to do inverse wavelet transform of them. The inverse wavelet transform is :
We need to calculate the
freq, Amp= TF.FT(wavelets.WShannon, tshi, sca)
dw=freq[1]-freq[0]
i=np.arange(0, len(Amp))
Cpsi=np.sum(Amp[i]**2/freq[i]*dw)
This is the Fourier Transform of the wavelet:
Then we can rewrite the presentation of inverse wavelet transform as:
It's obvious that the left part of the sentence $\dfrac{W_{\psi}f(b,a)}{C_{\psi}}$is a constant. And we are going to integrate
In the pyfile
We calculate different time
We can find the pick up part of the signal.
The phase is assumed to be:
And for the same reason, we will get the picked part of the signal after randomization.
[1]:Fundmentals of Wavelets, p118