scientisst / BioSPPy

Biosignal Processing in Python
https://biosppy.readthedocs.io/
Other
66 stars 21 forks source link

Improve ECG filtering in ecg.ecg #12

Closed sofia3ms closed 1 year ago

sofia3ms commented 1 year ago

The current bandpass filter in ecg.ecg has cutoff frequencies between 3 and 45 Hz. The 3 Hz cutoff significantly alters or even removes some important features from the signal (such as the P and T waves).

I propose changing the lower cutoff frequency to 0.5 Hz. Since this new filter doesn't remove the signal's DC component, it is necessary to subtract the mean from the signal after filtering.

rafaelscsilva commented 1 year ago

Thank you @sofia3ms for the PR regarding the ECG filtering, which we had previously discussed.

After some experiments with the filters, I have noticed that both the current and proposed bandpass FIR filters may not adequately attenuate the low frequencies (the first stopband). This could be due to the low cutoff frequency and filter order.

Because of this, it appears that we will need an alternative filter design capable of effectively eliminating low-frequency components (e.g., baseline wander) and DC offset without compromising the signal's morphological features. One potential approach could be to increase the filter order while maintaining the low cutoff frequency. Regarding the DC offset, removing the signal's mean seems appropriate.

Please feel free to make a suggestion regarding these observations.