doubt about scales in wavedec

469 views
Skip to first unread message

dawe

unread,
Feb 18, 2010, 4:21:38 AM2/18/10
to PyWavelets
Hi,
as I perform a wavedec I obtain the coefficient for all levels
requested, say cD1, cD2 and cD3 for 3 level decomposition. Are these
coefficient ordered from high scale to low scale? I believe yes, but I
would like somebody could confirm this to me...

thanks

d

Filip Wasilewski

unread,
Mar 17, 2010, 4:15:20 PM3/17/10
to PyWavelets

Hi Dave,

Let's take the following example to be precise about ordering of the
output:

>>> coeffs = pywt.wavedec([1,2,3,4,5,6,7,8], 'db1', level=2)
>>> cA2, cD2, cD1 = coeffs

Here, cAn and cDn denotes approximation and details coefficients at
level n [1].

The scale doubles with every level, so in this case cA2 and cD2 will
have a higher scale than cD1 [2]. In terms of frequency, if the
original signal has a frequency range from 0 to f, the cA2, cD2 and
cD1 coefficients will cover 0-f/4, f/4-f/2 and f/2-f frequencies
correspondingly [3, 4],

[1] http://www.pybytes.com/pywavelets/ref/dwt-discrete-wavelet-transform.html#multilevel-decomposition-using-wavedec
[2] http://users.rowan.edu/~polikar/WAVELETS/WTpart4.html, The Subband
Coding and The Multiresolution Analysis
[3] http://en.wikipedia.org/wiki/Discrete_wavelet_transform#Cascading_and_Filter_banks
[4] http://paos.colorado.edu/research/wavelets/faq.html#scale

Filip Wasilewski
http://filipwasilewski.pl/

Davide Cittaro

unread,
Mar 17, 2010, 4:20:39 PM3/17/10
to pywav...@googlegroups.com
Hi Filip, 
Thanks for the answer, I started to believe the group was dead :-/

On Mar 17, 2010, at 9:15 PM, Filip Wasilewski wrote:


The scale doubles with every level, so in this case cA2 and cD2 will
have a higher scale than cD1 [2]. In terms of frequency, if the
original signal has a frequency range from 0 to f, the cA2, cD2 and
cD1 coefficients will cover 0-f/4, f/4-f/2 and f/2-f frequencies
correspondingly [3, 4],

This is a precious info to me...
Do you think it would be wise to set cD1 array to zero in order to suppress all high frequency signals in my data? I see that pywt implements thresholding (either soft and hard) but I have no clue on how to choose the threshold... I know this is a completely different question :-)

Thanks again,

d


Filip Wasilewski

unread,
Mar 18, 2010, 5:29:35 PM3/18/10
to PyWavelets
Hi,

On Mar 17, 9:20 pm, Davide Cittaro <daweonl...@gmail.com> wrote:
> Hi Filip,
> Thanks for the answer, I started to believe the group was dead :-/

That's because I only have very little time to contribute to this
project.

> On Mar 17, 2010, at 9:15 PM, Filip Wasilewski wrote:
>
> > The scale doubles with every level, so in this case cA2 and cD2 will
> > have a higher scale than cD1 [2]. In terms of frequency, if the
> > original signal has a frequency range from 0 to f, the cA2, cD2 and
> > cD1 coefficients will cover 0-f/4, f/4-f/2 and f/2-f frequencies
> > correspondingly [3, 4],
>
> This is a precious info to me...
> Do you think it would be wise to set cD1 array to zero in order to suppress all high frequency signals in my data?

You should just try and see what happens:) Reducing or setting to zero
some sets of coefficients and then doing an inverse transform is a
common method of removing unnecessary information like high frequency
noise or low frequency artifacts (i.e. wandering baseline) from the
signal.

> I see that pywt implements thresholding (either soft and hard) but I have no clue on how to choose the threshold... I know this is a completely different question :-)

Well, you can either experimentally come up with a threshold method
that works best in your case or look for papers on the given topic.
There are many papers and books on wavelet denoising and signal
analysis. Just fire up google or google scholar and search for
something from David Donoho, Iain Johnstone or Ronald Coifman.

Filip Wasilewski
http://filipwasilewski.pl/

Reply all
Reply to author
Forward
0 new messages