Signal Extension Modes for Discrete Wavelet Transform in PyWavelets

Discrete wavelet transform (DWT), border effects and signal extension modes

In previous posts, we have talked about many basic things on Wavelet transform (WT) including: basic concepts of WT, its classifications, applications, PyWavelets Library and its built-in wavelet families and members, visualization of wavelet and scaling functions and filter banks, as well as the process of DWT. I suggest you reading these basic ideas and concepts first if you are not so familiar with them.

In this post, I will talk about the border effects of DWT and signal extension modes to deal with this problem. In gerneral, signal extension modes are used to extend signals before signal process using Discrete wavelet transform (DWT) in order to minimize borders’ effects caused by DWT.

1. Border Effects of Discrete Wavelet Transform

In practice, digital signals are presented with finite arrays of values in mathematics and computer science. The basic algorithm for the Discrete Wavelet Transform (DWT) to process these signals is based on a simple scheme: convolution and downsampling. Thus, significant artifacts at the signal’s borders can be introduced during DWT decomposition process, which in turn may result in inaccurate computations of the DWT at the signal’s borders. This border distortion problem is known as border effects.

As usual, when a convolution is performed on finite-length signals, border distortions arise. Border effects are very common in many finite signals analysis and processing approaches using convolution operation. In this connection, we need some methods to extend the signal before processing it with DWT.

2. Signal Extension Modes

Signal extension modes refer to some extrapolation methods to extend the signal before computing the DWT.

There are different methods for extending the signal, and most widely used ones, such as:

  • zero-padding
  • smooth padding
  • periodic extension, and
  • boundary value replication (symmetrization)

3. Built-in Signal Extension Modes of PyWavelets

PyWavelets provides several methods of signal extrapolation that can be used to minimize the negative border effect. We have talked about PyWavelets library, and please glance over it if you are not family with it.

First, we need to import PyWavelets before use it.

import pywt

Then you can use the following command to print the built-in extension modes in PyWavelets.

print(pywt.Modes.modes)

The results are:

['zero', 'constant', 'symmetric', 'periodic', 'smooth', 'periodization', 'reflect', 'antisymmetric', 'antireflect']

So we can see that there are 9 built-in extension modes in PyWavelets. Let’s see what they are briefly as follows:

  • zero: extends a signal by adding zero samples
  • constant: extends a signal by replicating border values
  • symmetric: extends a signal by mirroring samples, also known as half-sample symmetric
  • periodic: extends a signal by treating it as a periodic one
  • smooth: extends a signal according to the first derivatives calculated on the edges (straight line)
  • periodization: like periodic but gives the smallest possible number of decomposition coefficients
  • reflect: extends a signal by reflecting samples, also known as whole-sample symmetric
  • antisymmetric: extends a signal by mirroring and negating samples, also known as half-sample anti-symmetric
  • antireflect: extends a signal by reflecting anti-symmetrically about the edge samples, also known as whole-sample anti-symmetric

The following figure can help you understand these extension mode methods, and this figure is reproduced used the code on the Online PyWavelet Document. In the figure, red dots are the signal values, and black dots are extended values.

Source: Figure is plotted based on the code from PyWavelets Documentation.

You can go to online document of PyWavelet to study them further. But for DWT, it is enough you only know what modes you want to use.

If you like this post or think it is helpful, please do not forget to give a clap to show your kind support. I appreciate it for your support! Your support is the best encouragement for me to produce more helpful products.

Online courses

If you are interested in learning how to apply wavelet transform to real-world cases with Python step by step, you are welcome to enroll my courses:

(1) Very basic one

Practical Python Wavelet Transforms (I): Fundamentals

(2) For Real-world projects

Practical Python Wavelet Transforms (I): Fundamentals

Bookmark
ClosePlease login
0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!

Please follow and like me:

Leave a Reply

Your email address will not be published. Required fields are marked *