|
a |
|
b/python/mit_db.py |
|
|
1 |
#!/usr/bin/env python |
|
|
2 |
|
|
|
3 |
""" |
|
|
4 |
mit_db.py |
|
|
5 |
|
|
|
6 |
Description: |
|
|
7 |
Contains the classes for store the MITBIH database and some utils |
|
|
8 |
|
|
|
9 |
VARPA, University of Coruna |
|
|
10 |
Mondejar Guerra, Victor M. |
|
|
11 |
24 Oct 2017 |
|
|
12 |
""" |
|
|
13 |
|
|
|
14 |
import matplotlib.pyplot as plt |
|
|
15 |
import numpy as np |
|
|
16 |
|
|
|
17 |
# Show a 2D plot with the data in beat |
|
|
18 |
def display_signal(beat): |
|
|
19 |
plt.plot(beat) |
|
|
20 |
plt.ylabel('Signal') |
|
|
21 |
plt.show() |
|
|
22 |
|
|
|
23 |
# Class for RR intervals features |
|
|
24 |
class RR_intervals: |
|
|
25 |
def __init__(self): |
|
|
26 |
# Instance atributes |
|
|
27 |
self.pre_R = np.array([]) |
|
|
28 |
self.post_R = np.array([]) |
|
|
29 |
self.local_R = np.array([]) |
|
|
30 |
self.global_R = np.array([]) |
|
|
31 |
|
|
|
32 |
class mit_db: |
|
|
33 |
def __init__(self): |
|
|
34 |
# Instance atributes |
|
|
35 |
self.filename = [] |
|
|
36 |
self.raw_signal = [] |
|
|
37 |
self.beat = np.empty([]) # record, beat, lead |
|
|
38 |
self.class_ID = [] |
|
|
39 |
self.valid_R = [] |
|
|
40 |
self.R_pos = [] |
|
|
41 |
self.orig_R_pos = [] |