-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,30 +1,19 @@ | ||
import peakdet | ||
import numpy as np | ||
import pytest | ||
from phys2denoise.metrics.chest_belt import rvt | ||
|
||
|
||
@pytest.fixture | ||
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 | ||
def test_peakdet(fake_phys): | ||
phys = peakdet.Physio(fake_phys, fs=62.5) | ||
phys = peakdet.operations.filter_physio(phys, cutoffs=3, method="lowpass") | ||
return phys | ||
|
||
|
||
def test_peakdet(fake_phys): | ||
phys = peakdet.operations.peakfind_physio(fake_phys) | ||
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.operations.peakfind_physio(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 |