-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathintegration.py
68 lines (43 loc) · 1.22 KB
/
integration.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
import emggao
import numpy as np
from Data_prepare import load_gdffile
def get_data():
emgdata, emglabel = emggao.get_dataset(1)
print(emgdata.shape)
print(emglabel.shape)
eegdata, eeglabel = load_gdffile.load_gdffile()
eegdata = eegdata.transpose(0,2,1)
print(eegdata.shape)
print(eeglabel.shape)
print(eeglabel)
emg_data_class1 = []
emg_data_class2 = []
eeg_data_class1 = []
eeg_data_class2 = []
for i in range(400):
if emglabel[i] == 0:
emg_data_class1.append(emgdata[i])
else:
emg_data_class2.append(emgdata[i])
for i in range(143):
if eeglabel[i] == 1:
eeg_data_class1.append(eegdata[i])
else:
eeg_data_class2.append(eegdata[i])
len1 = len(eeg_data_class1)
len2 = len(eeg_data_class2)
all_data = []
all_label = []
for i in range(40):
all_data.append(np.concatenate((eeg_data_class1[i], emg_data_class1[i]), axis=1))
all_label.append(0)
for i in range(40):
all_data.append(np.concatenate((eeg_data_class2[i], emg_data_class2[i]), axis=1))
all_label.append(1)
all_data = np.array(all_data)
all_label = np.array(all_label)
print(all_data.shape)
print(all_label.shape)
return all_data, all_label
#data, label = get_data()