|
a |
|
b/2-Generating Synthetic ECG Data/parameters.py |
|
|
1 |
import numpy as np |
|
|
2 |
|
|
|
3 |
|
|
|
4 |
##Sampling Rate and Duration |
|
|
5 |
sampling_rate = 250 #Hz |
|
|
6 |
duration = 10 #seconds |
|
|
7 |
|
|
|
8 |
leads = ['I', 'II', 'III', 'aVR', 'aVL', 'aVF', 'V1', 'V2', 'V3', 'V4', 'V5', 'V6'] |
|
|
9 |
|
|
|
10 |
## Gamma, a (12,5) matrix to modify the five waves' amplitudes of 12 leads (P, Q, R, S, T) |
|
|
11 |
gamma = np.array([[1, 0.1, 1, 1.2, 1], |
|
|
12 |
[2, 0.2, 0.2, 0.2, 3], |
|
|
13 |
[1, -0.1, -0.8, -1.1, 2.5], |
|
|
14 |
[-1, -0.05, -0.8, -0.5, -1.2], |
|
|
15 |
[0.05, 0.05, 1, 1, 1], |
|
|
16 |
[1, -0.05, -0.1, -0.1, 3], |
|
|
17 |
[-0.5, 0.05, 0.2, 0.5, 1], |
|
|
18 |
[0.05, 0.05, 1.3, 2.5, 2], |
|
|
19 |
[1, 0.05, 1, 2, 1], |
|
|
20 |
[1.2, 0.05, 1, 2, 2], |
|
|
21 |
[1.5, 0.1, 0.8, 1, 2], |
|
|
22 |
[1.8, 0.05, 0.5, 0.1, 2]]) |
|
|
23 |
|
|
|
24 |
## Normal ECG Parameters |
|
|
25 |
Anoise = 0.01 |
|
|
26 |
|
|
|
27 |
#heart rate |
|
|
28 |
mu_hr_1 = 60 # mean of the heart rate |
|
|
29 |
sigma_hr_1 = 7 # variance of the heart rate |
|
|
30 |
|
|
|
31 |
#noise |
|
|
32 |
min_noise_1 = 0.01 |
|
|
33 |
max_noise_1 = 0.1 |
|
|
34 |
|
|
|
35 |
#For PQRST five spikes |
|
|
36 |
# t, the starting position along the circle of each interval in radius |
|
|
37 |
mu_t_1 = np.array((-70, -15, 0, 15, 100)) |
|
|
38 |
sigma_t_1 = np.ones(5)*3 |
|
|
39 |
|
|
|
40 |
# a, the amplitude of each spike; b, the width of each spike |
|
|
41 |
mu_a_1 = np.array((1.2, -5, 30, -7.5, 0.75)) |
|
|
42 |
mu_b_1 = np.array((0.25, 0.1, 0.1, 0.1, 0.4)) |
|
|
43 |
sigma_a_1 = np.abs(mu_a_1/5) |
|
|
44 |
sigma_b_1 = np.abs(mu_b_1/5) |
|
|
45 |
|
|
|
46 |
## Abnormal ECG Parameters |
|
|
47 |
#heart rate |
|
|
48 |
mu_hr_2 = 60 # mean of the heart rate |
|
|
49 |
sigma_hr_2 = 7 # variance of the heart rate |
|
|
50 |
|
|
|
51 |
#noise |
|
|
52 |
min_noise_2 = 0.01 |
|
|
53 |
max_noise_2 = 0.1 |
|
|
54 |
|
|
|
55 |
#t, a, b |
|
|
56 |
mu_t_2 = np.array((-70, -15, 0, 15, 100)) |
|
|
57 |
mu_a_2 = np.array((1.2, -4, 25, -6.5, 0.75)) |
|
|
58 |
mu_b_2 = np.array((0.25, 0.1, 0.1, 0.1, 0.4)) |
|
|
59 |
sigma_t_2 = np.ones(5)*3 |
|
|
60 |
sigma_a_2 = np.abs(mu_a_1/5) |
|
|
61 |
sigma_b_2 = np.abs(mu_b_1/5) |
|
|
62 |
|