I have to filter the signal of an ECG with the wavelet method with Python. The data is in a txt file. I can create my dataframe with pandas, display that with seaborn, but can not find a way to apply the filter.

The wavelet method is imposed. I do not really know how to do it.

First I tried to understand the mathematical formula to transcribe it into a python algorithm: it's clearly beyond my abilities and my knowledge (and filling this gap would take me months, even years)

I also tried using the python pywavelets library.

The problem is that I do not know what to do with cA and cD :

cA, cD = pywt.dwt([1, 2, 3, 4], 'db1')

My research on google (in English and French) directs me towards papers of scientific research which are also outside my capacities of comprehension.

  • 1
    $\begingroup$ Actually this package should be the right choice for your problem. But first you should try to understand what is your goal and what you want to compute. A first step could be to watch these introductory videos youtube.com/watch?v=QX1-xGVFqmw to get a grasp what the wavelet transform is. $\endgroup$
    – varantir
    Commented Feb 27, 2019 at 13:39
  • $\begingroup$ je suis dans la même situation que toi, peux-tu, s'il te plait, me dire si t'as trouver une solution !! Merci (I am in the same situation as you, can you, please, tell me if you have a solution !! Thank you) $\endgroup$
    – DamiaMHD
    Commented Apr 3, 2019 at 16:03

1 Answer 1


I will try to answer the question after working on this school project.

First, why filter an ECG using wavelets? I had a raw signal, full of noise. The filtering of the signal using the wavelet method makes it possible to capture spatial and temporal information very important for an unusual detection.

Here is a tutorial that inspired me, it perfectly describes the role of coefficients:: https://medium.com/@andrewtan_36013/electrocardiograms-qrs-detection-using-wavelet-analysis-a1070505efee


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.