forked from PIA-Group/BioSPPy
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathexample.py
More file actions
32 lines (24 loc) · 827 Bytes
/
example.py
File metadata and controls
32 lines (24 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import sys
from biosppy import storage
import warnings
from biosppy.signals import ecg
from biosppy.signals.acc import acc
warnings.simplefilter(action="ignore", category=FutureWarning)
# load raw ECG and ACC signals
ecg_signal, _ = storage.load_txt("./examples/ecg.txt")
acc_signal, _ = storage.load_txt("./examples/acc.txt")
# Setting current path
current_dir = os.path.dirname(sys.argv[0])
ecg_plot_path = os.path.join(current_dir, "ecg.png")
acc_plot_path = os.path.join(current_dir, "acc.png")
# Process it and plot. Set interactive=True to display an interactive window
out_ecg = ecg.ecg(
signal=ecg_signal,
sampling_rate=1000.0,
path=ecg_plot_path,
segmenter="pan-tompkins",
interactive=False,
Pth=5,
)
out_acc = acc(signal=acc_signal, sampling_rate=1000.0, path=acc_plot_path)