# Extract approximation and detail coefficients

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)?

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]


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.

• This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
– MBaz
Sep 12 at 23:10