rhenanbartels / hrv

A Python package for heart rate variability analysis
BSD 3-Clause "New" or "Revised" License
198 stars 58 forks source link

Artifact removal, outlier detection and baseline wander removal #16

Closed hooman650 closed 4 years ago

hooman650 commented 5 years ago

Hi,

Thanks for the hrv toolbox. I have noticed that there are numerous HRV toolboxes that perform the same function (computing time, frequency and nonlinearity parameters). But what I find missing in all of these are automated methods to remove outliers in RR intervals and also the baseline wandering. These substantially change the computed outcomes. I suggest looking into the page 11 of the document below for some ideas in this regard: https://www.kubios.com/downloads/Kubios_HRV_Users_Guide.pdf

Also look into the paper below, how smoothness priors could be used to remove baseline wandering: https://pdfs.semanticscholar.org/7b28/41f2b7013eccb3b75f72a1aada97ab66d551.pdf

These are relatively simple to implement but having these would make this toolbox definitely much more useful than the other very many ones that do the same operations.

Thanks Hooman

rhenanbartels commented 5 years ago

Hi @hooman650, thank you very much for the suggestions. I will work on them during the weekend.

Cheers!

rhenanbartels commented 4 years ago

Hi @hooman650, following your suggestions, I've implemented the following features regarding artifact removal and baseline trend removal:

Artifact removal

It worth noticing that the previous version also offered 3 functions to remove artifacts:

Detrending functions

In order to remove simple slow or more complex trends, I've implemented 3 functions to remove low-frequency components from the RRi series:

With the detrend methods, I have also created an RRiDetrend class, which has the same behavior of base RRi class, but skip some validations of the RRi values, such as the tachogram can only have positive values.

Best regards,

Rhenan