Baseline Wander Removing from ECG with Python

Moklesur Rahman
3 min readMar 22, 2023

Baseline wandering in an ECG refers to the fluctuation of the baseline or the “zero” point of the ECG trace. This causes the entire signal to shift from its normal base. The frequency content of the baseline wander is in the range of 0.5 Hz. However, increased movement of the body during exercise or stress tests increases the frequency of baseline wandering. Baseline wandering can make it difficult to interpret the ECG and can lead to misdiagnosis if not properly addressed. To correct baseline wandering, ECG technicians may use filters or other techniques to remove or minimize the effects of the artifact.

Causes of baseline wander:

  • Patient movement — especially respiration.
  • Inadequate contact between electrodes and body surface.
  • Improper skin preparation.
  • Patient sweating.

There are several ways to remove baseline wandering from an ECG trace. These are:

  1. Filtering: One of the most common methods of removing baseline wander is by using a low-pass filter. This can help remove high-frequency noise and smooth out the ECG signal.
  2. Baseline Correction: This method involves determining the baseline of the ECG signal and then removing any deviation from this baseline. This can be done using mathematical algorithms such as spline interpolation or polynomial fitting.
  3. Wavelet Transform: This technique uses a mathematical method called wavelet…



Moklesur Rahman

PhD student | Computer Science | University of Milan | Data science | AI in Cardiology | Writer | Researcher