DEV Community

virt12
virt12

Posted on

Counting max values peaks of signals EEG

Hello,

I am facing problem. I want to count how many peaks are reached during one second of each EEG signals, I am using data from .edf file. I have written count function but not working well.

def count(self,data):
# Count max values of each signal and displat it into dialog
total_point = 2000
total_time = 20
max_value_peak = total_point / total_time
self.data = data
max_point = 100 #plots 100 points in one sec. So find max of every batch of 100 points
point = 0
k_point = 0
max_peak_counter = 0
while point <= total_point:
if len(data)>max_point:
if point == max_point:
print('data length', len(data))
print('k_point', 'max_point', k_point, max_point)
print("Max Points in Signal are....",np.max(data[k_point:max_point]))
max_peak_counter += 1
k_point = k_point + 100
max_point = max_point + 100
point+=1
else:
break

    self.total_peak = QtWidgets.QLabel('Total Peak: %s' % max_peak_counter)
    self.total_peak.resize(50,32)
    grid.addWidget(self.total_peak,3, 1)

Top comments (0)