参考论文:The study of c0 complexity on epileptic absence seizure
def C0_complexity(single):
'''
计算C0复杂度
'''
x = fft(single)
N = x.shape[0]
avgx = np.average(x) # 计算幅度谱的平均值
new_x = []
for i in x:
if abs(i) > avgx:
new_x.append(i)
else:
new_x.append(0)
new_x = np.array(new_x)
new_s = ifft(new_x)
c0_cplx = 0
for i in range(single.shape[0]):
c0_cplx += abs(single[i]-new_s[i]) / abs(single[i])
return c0_cplx