-
Notifications
You must be signed in to change notification settings - Fork 21
Add RVT algorithm (Birn et al. 2006) #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4015a14
made base rvt code
rzlim08 dc04b0e
add lags to rvt
rzlim08 5973bfa
added comments
rzlim08 a1fa407
switched to fake data
rzlim08 e8ea08b
changed name of RVT function
rzlim08 35f6e56
fix docstring linting issues
rzlim08 2c109c3
change docstring to 'imperative style' as linter was complaining
rzlim08 46a4964
try imperative style again
rzlim08 e1c667b
addressed comments
rzlim08 7a7bc2f
added whitespace
rzlim08 d4fd563
extracted fake phys
rzlim08 8da6f7a
Merge branch 'master' into rvt
kristinazvolanek b502770
Update chest_belt.py
kristinazvolanek 1c87730
Merge branch 'master' into rvt
kristinazvolanek 24515ca
Add back peakdet
smoia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import numpy as np | ||
| import pytest | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module") | ||
| def fake_phys(): | ||
| f = 0.3 | ||
| fs = 62.5 # sampling rate | ||
| t = 300 | ||
| samples = np.arange(t * fs) / fs | ||
| noise = np.random.normal(0, 0.5, len(samples)) | ||
| fake_phys = 10 * np.sin(2 * np.pi * f * samples) + noise | ||
| return fake_phys | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import peakdet | ||
rzlim08 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from phys2denoise.metrics.chest_belt import rvt | ||
|
|
||
|
|
||
| def test_peakdet(fake_phys): | ||
| phys = peakdet.Physio(fake_phys, fs=62.5) | ||
| phys = peakdet.operations.filter_physio(phys, cutoffs=3, method="lowpass") | ||
| phys = peakdet.operations.peakfind_physio(phys) | ||
| assert phys.troughs is not None | ||
| assert phys.peaks is not None | ||
|
|
||
|
|
||
| def test_rvt(fake_phys): | ||
| phys = peakdet.Physio(fake_phys, fs=62.5) | ||
| phys = peakdet.operations.filter_physio(phys, cutoffs=3, method="lowpass") | ||
| phys = peakdet.operations.peakfind_physio(phys) | ||
| r = rvt(phys.data, phys.peaks, phys.troughs, samplerate=phys.fs) | ||
| assert r is not None | ||
| assert len(r) == 18750 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,7 @@ test = | |
| %(style)s | ||
| pytest >=5.3 | ||
| pytest-cov | ||
| peakdet | ||
| coverage | ||
| devtools = | ||
| pre-commit | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.