3

I am a student and would like to know how to extract the approximation and detail coefficients (A5, D5, D4, D3, D2 and D1) after an applied DWT decomposition dB5 (Daubechies 5, level = 5)?

Laurent Duval
  • 31,850
  • 3
  • 33
  • 101

2 Answers2

1

This sounds quite doable, reading the online documentation, for instance: Multilevel DWT, IDWT and SWT, by adapting the example given:

>>> import pywt
>>> x = [3, 7, 1, 1, -2, 5, 4, 6]
>>> db1 = pywt.Wavelet('db1')
>>> cA3, cD3, cD2, cD1 = pywt.wavedec(x, db1)
>>> print(cA3)
[ 8.83883476]
>>> print(cD3)
[-0.35355339]
>>> print(cD2)
[ 4.  -3.5]
>>> print(cD1)
[-2.82842712  0.         -4.94974747 -1.41421356]
Laurent Duval
  • 31,850
  • 3
  • 33
  • 101
1

How do you get the rest of the approximation coefficients?

The pywt.wavelt only gives the highest level of the approximation coefficients (if level is set to 5 we only get cA5) as far as I understood.

lennon310
  • 3,590
  • 19
  • 24
  • 27
Syrine
  • 21
  • 2