DEV Community


Posted on

What is CWT/Scarogram?

1. CWT/Scarogram

Scarogram is a 2-dimentional image created by applying CWT(Continous Wavelet Transform) to 1-dimentional signal.


2. Wavelet Transform

2.1 Wavelet

What is wavelet? It is a function that take time as an argument. Generally, be represented as Ψ(t)\Psi(t) .

Wavelet has a variety of types. Morlet is a famous one.
Image description

To be a proper wavelet, function has to satisfy 2 main constraints.

  1. Zero mean:
    +Ψ(t)dt=0\int^{+ \infty}_{- \infty} \Psi (t)dt = 0
  2. Finite energy:
    +Ψ(t)2dt<\int^{+ \infty}_{- \infty} |\Psi(t)|^2 dt < \infty

Example, sin function not satisfy condition 2, because it has infinite energy.
You can think of those constraints as indicating a converging fanction with zero mean.

2.2 Adhust Wavelet

I use wavelet for this transfrom.


From here on, I will use Morlet as an example.

Image description

When we adjust tt , the morlet changes shape accordingly.
(tb)(t - b)
b = 2

Image description

a = 0.5

Image description

Then, we can make various morlet by use Ψ(tba)\Psi(\dfrac{t-b}{a}) ,
b = -2, a = 0.25

Image description

2.3 Wavelet Transform

Wavelet Transform create image that one axis represent frequency, and one another represent time from signal.

・Wavelet Transform

y(t)T(t,f)y(t) \rightarrow T(t,f)

The right arrow represent Wavelet Transform, what is going on there? Let's check in below.

・Calculation 1

y(t)Ψa,b(t)y(t) \cdot \Psi_{a,b}(t)

yy : Be analyzed signal

Image description

This calculation creates a ew function that shows how similar each function is. At every point, if the values of each function are close, the new

It represent similarity of two waves y(t) and Ψ.

・Calculation 2

T(a,b)=+y(t)Ψa,b(t)dtT(a,b) = \int^{+\infty}{-\infty} y(t) \cdot \Psi{a,b}(t) dt

This formula calculates the total area of overlap between the Morlet and the original formula, assuming that if the overlapped parts have the same sign, it is a plus, and if they have different signs, it is a minus.
In other words, it shows the degree of overlap between morlet and the original signal.

2.4 Imaginary part

Wavelet has a imaginary part. And as same with real part, T_i(a,b) is calculated by imaginary part.

2.5 Result of Transform

The T(a, b) is the result of WT.
T is a function representing the degree of matching between the Morlet wavelet and the original function.

If you change parameter b, T shows similarity between two functions in the time direction. It makes a one-dimensional wave show where there is a wave that has the same frequency as T (based on parameter a).

When you repeat the same process by changing parameter a, you can obtain various waves that show where each wave has the same frequency corresponding to parameter a.

After obtaining T(a,b) and T_i(a,b) in this way, obtain the square of their absolute value as power.

power=T(a,b)2+Ti(a,b)22=T(a,b)2+Ti(a,b)2power = \sqrt{T(a,b)^2 + T_i(a,b)^2}^2 = T(a,b)^2 + T_i(a,b)^2

When you get this far, all you have to do is color map the frequency components of each power and arrange them in time. And you'll get Scarogram.
It's same operation when you create spectrogram.

It shows at what time in the original waveform a waveform with the same frequency component (varied by a) as the wavelet exists.


This time, I explained about CWT/Scarogram.
thank you for reading.


(1) Wavelets: a mathematical microscope, Artem Kirsanov

Top comments (0)