Skip to main content

Ch 12: Morlet Wavelets and Wavelet Convolution

This chapter goes over how wavelets improve on FFT, and how (real) wavelets are constructed

12.1 Why Wavelets?

There are 2 main issues with FFT; They do not show change over time, and technically they shouldn't be used on EEG data since the Fourier Transform assumes that the signal is stationary / stable, which EEG signal isn't. We need time-resolved frequency decomposition methods, even if it is at the cost of some temporal and frequency precision.

Morlet Wavelets (also known as Gabor Wavelets) are one example of such a method. A Morlet Wavelet looks like a sine-wave in the middle but tapers off to zero on both ends. When used with convolution, they are useful for localizing changes in frequency characteristics over time.

image.png

The reason that the Fourier Transform is not time local is because the kernel used is just a sine wave with no locality at all. We can make it time local by making the sine wave itself localized.

A first attempt may be to take a single cycle of a sine wave as a kernel. While this technically works with the maximum temporal accuracy, we have very bad frequency precision, as well as artifacts from the sharp edges.

We can try to use a handful of sine wave cycles, as a "box-car" approach, however while we do improve frequency precision, we lose significant temporal precision since all sine waves are weighted the same, and we still have edge artifacts.

Instead, if we allow a Gaussian based smoothing on both ends of the sine wave, we can still maximize temporal accuracy at the center of the wavelet and retain the frequency accuracy, and also remove the artifact since we don't have hard edges.

This "Gaussian" wavelet is what a Morlet wavelet is.

image.png

It is important to note there are other types of wavelets as well. In this chapter we discuss real Morlet wavelets, but there are also complex Morlet wavelets (next chapter) as well as others. A wavelet must have values at or approaching zero on both ends, and must have an average value of 0. However, Morlet wavelets are discussed in this text specifically because they are good for EEG data decomposition.

And as discussed earlier with the issue about data being stationary, wavelets help resolve this too. Since the stationary principal only needs to hold valid during the period of the sine wave of the wavelet, this becomes a reasonable assumption since EEG data does remain stationary for a few hundred milliseconds at a time, as discussed in prior chapters.

12.2 How to Make Wavelets

To make a real Morlet wavelet, simply take a sine wave, create a Gaussian, and multiply them point by point. For this to work, the sine wave and Gaussian need the same number of points and the same sampling rate. The frequency of the wavelet is set by the frequency of the initial sine wave, (this is also referred to as peak frequency and occasionally center frequency). 

image.png

The Gaussian window (also known as the normal curve or bell curve) is created with the formula:

image.png

where a is the amplitude, t is time, m is the x-axis offset (which for EEG analysis is set to zero and can be ignored).

s is the standard deviation of the bell curve, which controls the width of the Gaussian, and is defined by:

image.png

where f is frequency, and n is an count of wavelet cycles. n is the value that can be tuned to trade off temporal precision and frequency precision. It is a non-trivial parameter that impacts analysis. In this book, a value of "6" was used.

just as the Fourier transform uses sine wave of many different frequencies, we use wavelets of different frequencies. However unlike Fourier transform where the frequencies possible are governed by the number of data points, we ourselves can define the number of wavelets we want to use and their frequencies.

A group of wavelets that have the same properties except for their frequency is called a "family"

There are some general rules about choosing frequencies though:

  • You cannot use frequencies slower than epochs. (IE if you have 1 second of data, you cannot use a frequencies slower than 1 Hz. In practice you should be considerable faster than the epoch).
  • The frequencies of the wavelets cannot exceed the Nyquist frequency (half the sampling rate).
  • Sampling Frequencies very close together (20.1 Hz vs 20.2 Hz) gives extremely similar results and is a waste of time. The Author recommends using 15-30 frequencies in general.
12.3 Wavelet Convolution as a Bandpass Filter

In previous chapters, it was demonstrated convolution can act a bandpass filter. To be more specific, Morlet Wavelets do act as a bandpass filter where the frequency response is Gaussian shaped, IE bandpass filtering. By taking the frequency spectrum of wavelet of a specific frequency, and multiply it with the frequency spectrum of EEG data, then inverse Fourier Transform that, we end up with bandpass filtered EEG data.

image.png

12.4 Limitations of Wavelet Convolution as Discussed Thus Far

In this chapter we discussed real (real-valued) Morlet Wavelets, however this specific approach has its own issues.

The first is that power and phase information are not readily apparent in bandpass-filtered data. One could theoretically use the Hilbert transform of the signal, but the next chapter discusses a better solution.

The other issue is result of the convolution with a Morlet wavelet depends on the phase of the original sine wave, which can impact results, even if other properties such as frequency are constant.

image.png

This occurs due to the simple math behind convolutions. The dot product becomes 0 when there is a 90 degree lag from the wavelet and a one signal sine wave.

This limitation, as well as the earlier issue of extracting phase and power information, of real-value Morlet waves can be handled by Complex Morlet Wavlets. This will be discussed next chapter.