Fix HRV frequency PSD scale and Systole heart_rate API#1
Open
ZahraRezazadeh wants to merge 1 commit into
Open
Conversation
ZahraRezazadeh
commented
May 6, 2026
- hrv_analysis.ipynb (load_rr_data): RRI_Time was previously cumsum'd in milliseconds while NeuroKit2's hrv_frequency() expects it in seconds. The mismatched time scale collapsed all band powers by ~6+ orders of magnitude (ULF dominating, VLF/LF/HF/VHF invisible on the linear PSD plot). Now divides by 1000 so timestamps are in seconds and matches the function's docstring.
- hrv_analysis.ipynb (hrv_window_crop): drop the matching *1000 from the window-bounds comparison now that RRI_Time is in seconds.
- hrv_analysis.ipynb (hrv_frequency_domain): pass ulf=(0, 0) so the ULF band is excluded for short recordings, which otherwise returns spurious large values (BBSIG known-issue note on the website).
- ecg_preproc.ipynb (save_hr_interpol): rename keyword argument unit='bpm' to output_unit='bpm' to match Systole's heart_rate() API (the kwarg was renamed upstream and the old name now raises TypeError).
* hrv_analysis.ipynb (load_rr_data): RRI_Time was previously cumsum'd in milliseconds while NeuroKit2's hrv_frequency() expects it in seconds. The mismatched time scale collapsed all band powers by ~6+ orders of magnitude (ULF dominating, VLF/LF/HF/VHF invisible on the linear PSD plot). Now divides by 1000 so timestamps are in seconds and matches the function's docstring. * hrv_analysis.ipynb (hrv_window_crop): drop the matching *1000 from the window-bounds comparison now that RRI_Time is in seconds. * hrv_analysis.ipynb (hrv_frequency_domain): pass ulf=(0, 0) so the ULF band is excluded for short recordings, which otherwise returns spurious large values (BBSIG known-issue note on the website). * ecg_preproc.ipynb (save_hr_interpol): rename keyword argument unit='bpm' to output_unit='bpm' to match Systole's heart_rate() API (the kwarg was renamed upstream and the old name now raises TypeError).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.