forked from slama0077/DataTrain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyasa_plot.py
More file actions
34 lines (24 loc) · 1.03 KB
/
yasa_plot.py
File metadata and controls
34 lines (24 loc) · 1.03 KB
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
import numpy as np
from utils import LoadData as ld
from utils import Welchh
from yasa import topoplot
import pandas
import matplotlib.pyplot as plt
def calculateBandPowerEachChannel(raw_data):
'''Calculate Beta Bandpower of each channel and returns the list of the beta bandpower'''
bandpower_list = []
for i in range(raw_data.shape[1]):
channel_list= []
for j in range(raw_data.shape[0]):
channel_list.append(raw_data[j][i])
bandpower = Welchh.bandpower_multitaper(np.array(channel_list), sf, [4,30])
bandpower_list.append(bandpower)
return bandpower_list
raw_data = ld.loadData()
sf = 250
bandpower_list = calculateBandPowerEachChannel(raw_data)
ch_names = ["FP1", "FP2", "F7", "F8", "F3", "F4", "FZ", "T3", "T4", "C3", "C4", "CZ", "P3", "P4", "PZ", "T5", "T6", "O1", "O2", "A1", "A2"]
pandaArray = pandas.Series(bandpower_list[0:21], index = ch_names)
fig = topoplot(pandaArray, n_colors = 200, title = "Beta Bandpower Imagining Left hand movement")
plt.figure(fig)
plt.show()