-
-
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
[Feature] R-R intervals and associated timestamps as input to HRV functions #710
[Feature] R-R intervals and associated timestamps as input to HRV functions #710
Conversation
Codecov ReportBase: 52.65% // Head: 52.77% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev #710 +/- ##
==========================================
+ Coverage 52.65% 52.77% +0.12%
==========================================
Files 277 278 +1
Lines 12588 12619 +31
==========================================
+ Hits 6628 6660 +32
+ Misses 5960 5959 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
also added some comments
since intervals are meant to be more general (can be breath-to-breath)
I think I fixed it now! Since there's a bit of repetition in the way the intervals are cleaned across functions ( |
mmh a subpackage might be overkill, but we could put all these functions in separate files within the hrv module, since HRV is the one that predominantly deals with intervals?
Or perhaps just putting these in separate files in the |
What about merging intervals_successive with intervals_sanitize()? Or do you think there would be some usecase for intervals_successive() outside of intervals sanitization? |
I use it to adapt some hrv functions for missing data (e.g. only using truly successive differences in rmssd), so I would keep it as a separate function |
If I understand you use it through (my thinking is that if a function is mostly used by us or rather than by users in their analysis, it can be good to make it an internal to prevent feature creep and avoid bloating the documentation - that's why I was asking for potential other use cases that users my have with this) |
Yes, but I also plan to use My current implementation is here: https://github.com/danibene/NeuroKit/blob/feature/adjust_for_missing_intervals/neurokit2/hrv/hrv_time.py#L168-L173 I can still make it an internal function though - should I move it to |
okay cool
let's do that for now (we can leave all the examples and descriptions), and down the road we can always make it user-facing if need be |
Description
This PR aims at adding the ability to directly pass R-R intervals to the HRV functions. See also #684
Proposed Changes
Instead of separately sanitizing the input and converting to R-R intervals, I added a function
_hrv_format_input()
that can accept a dictionary with the keysRRI
andRRI_Time
and always returns the same format (either peaks or intervals depending on the HRV function) regardless of whether peaks or intervals are passed.Checklist
Here are some things to check before creating the PR. If you encounter any issues, do let us know :)