-
Notifications
You must be signed in to change notification settings - Fork 58
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
threshold_filter can generate negative RR values #23
Comments
No worries about the delay and thanks for looking into them. Let me know if you need any more info. |
Hi @noah10, I dug into the code and figured out that the CubicSpline function is generating the negative values. I've tried other interpolation methods, but they also produce negative values. I think because the value that needs to be interpolated is in the edge of the signal (last value), the interpolation method is not able to properly identify a reasonable surrogate for it. I am still thinking about the best solution for this situation. I am considering creating a class I've noticed that removing the last value of Any thoughts? Cheers, |
Yes, I had noticed that when I first found this issue. I did a little bit of digging to learn about positive-only interpolation and came up with the following techniques: Monotone cubic interpolation Unfortunately I don't have enough signal processing experience to really know the pros and cons of each of these approaches in the context of HRV analysis. I don't think that allowing negative RRi values is a good approach, though. They're fundamentally wrong - nobody can have -32 ms between heartbeats. And suggesting that people massage their data in order to work around a problem created by trying to massage their data also doesn't seem right. :-) (Removing the last value isn't a universal fix, of course.) In the absence of any other solution I'd suggest picking one of the algorithms above and using that. |
The cubic spline interpolation used in the threshold_filter function can generate negative values. These then cause the interpolated data set to fail validation. Here's some sample code:
And here's the stack trace that it generates:
The text was updated successfully, but these errors were encountered: