-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difficulty getting RR interval artefact handling working #1062
Comments
Hey, I don't mind taking a look at your situation when I have some extra time. If you are willing to send the data, the code you used and the sampling rate of the original data, then I would take a look at it. |
Hi @DerAndereJohannes,
As you can see, the sampling rate is 1000. Thank you! |
Hi @DerAndereJohannes, It works fairly well. Works most of the time, only has problems when there are lots of successive artefacts. |
Hi Chris, sorry for the late response and thanks for all the info and conducting additional research. I think I have found the issue with your problem. It has to do with the artifact correction mechanism that is used on fixing both the long/short beats and the Ectopic beat (NeuroKit seems to handle these identically) specifically on data with subsequent artifacts (all other instances are not affected). More specifically, the main problem is that there are 2 detected artifacts right after each other in the data (for you peak 58 and 59). Since Neurokit tries to achieve the interpolating by using the data from the previous and next peak (for peak 58 it would try between 57 and 59), it uses artifacted data as in the correction method. This is of course not intended and creates these issues. Of course these errors then propagate further. In addition, I noticed that the correction mechanisms are applied sequentially, so the order of when an artifact correction is not accounted for and leads to different results depending on what type of error first occurs (especially a problem with subsequent artifacts). This is also a big issue. Thank you very much for your find, I will try to create a fix tomorrow for the repository if that is alright with you. |
Thanks @DerAndereJohannes, let me know when in has been submitted to Github and I'll give it a test on my test data. |
Hi Chris, I have an written a small and quick update to the interpolation function to let it expand its interpolation window based on whether there are also misaligned peaks next to it. Here are the current changes:
The first being a simple method of using the two previous points for interpolation rather than one before and one after. This prevents misaligned peaks from being in the calculation and the method is inspired by the link you have previously sent. The second is a bit more "complex", but it basically reuses the old method of using the peak before and after the actual misaligned peak and interpolating between them. But, now it will look for the first peak before and after that were not misaligned and interpolates between them linearly. This one I am also currently not sure how to deal with boundary issues, so for now I have just implemented an easy fix. Both methods will create a straight line if there are multiple misaligned peaks in a row due to the linear nature of the correction. I would like your feedback whether this method is suitable for your needs, or if you have a different idea to handle the misaligned data. Feel free to see the changes here: https://github.com/DerAndereJohannes/NeuroKit/tree/signal_fix . The "complex" fix is currently active, but feel free to play around with the code yourself. ExampleHere is an example on your before data, the red spots were the misaligned peaks: Overall ResultCorrection using simple method:Correction using "complex" method: |
Hi,
I am using the "Kubios" option for artefact handling in NeuroKit 2 signal_fixpeaks( ) function for HRV deartefacting on my project. I am experiencing problem with some of the very basic artefacts with RR interval data coming from a Polar H10 ECG device. The artefacts are not totally removed from the data. I have included graphs from Kubios HRV from before and after the Kubios artefact correction in NeuroKit 2. You can see that a point has been added to the data and that the RR inetrval values of the artfact data has been reduced, but not enough. I have also included the plots provided by the NeuroKit 2 Kubios artefact handling. I also tried using the "NeuroKit" artefact handling option in the signal_fixpeaks( ) function and that doens't change the RR interval data at all.
If I am doing something wrong then that would be great, but it looks to me that the signal_fixpeaks( ) function doesn't work as expected. Let me know if someone who understands the signal_fixpeaks( ) code wants the RR interval text files I have generated for this. Any help would be appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: