NeuroKit
NeuroKit copied to clipboard
[Fix] use signal_filter() in ecg_clean() so that certain methods do not fail with low sampling rate
Description
Since the ecgzeemod2012
method was failing with a low sampling rate, this PR aims at refactoring several ECG cleaning methods so that they use signal_filter
rather than scipy directly. See https://github.com/neuropsychology/NeuroKit/issues/685
Proposed Changes
I changed the signal_filter()
function so that it includes a method butterworth_zi
calling scipy.signal.sosfilt
rather than scipy.signal.sosfiltfilt
, and called this method in ecg_clean()
so that the output does not change from the existing implementation. Let me know if you think we should do otherwise (I'm not actually sure what the original papers used as filters but I thought that's a separate issue...)
Checklist
Here are some things to check before creating the PR. If you encounter any issues, do let us know :)
- [x] I have read the CONTRIBUTING file.
- [x] My PR is targetted at the dev branch (and not towards the master branch).
- [x] I ran the CODE CHECKS on the files I added or modified and fixed the errors.
- [ ] I have added the newly added features to News.rst (if applicable)
Codecov Report
Base: 52.65% // Head: 52.64% // Decreases project coverage by -0.01%
:warning:
Coverage data is based on head (
632eb1e
) compared to base (262cc00
). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## dev #709 +/- ##
==========================================
- Coverage 52.65% 52.64% -0.02%
==========================================
Files 277 277
Lines 12588 12583 -5
==========================================
- Hits 6628 6624 -4
+ Misses 5960 5959 -1
Impacted Files | Coverage Δ | |
---|---|---|
neurokit2/ecg/ecg_clean.py | 91.93% <100.00%> (-1.40%) |
:arrow_down: |
neurokit2/signal/signal_filter.py | 68.62% <100.00%> (+2.67%) |
:arrow_up: |
neurokit2/rsp/rsp_simulate.py | 98.21% <0.00%> (-0.90%) |
:arrow_down: |
neurokit2/signal/signal_fixpeaks.py | 73.76% <0.00%> (+0.76%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.