def amp_freq(timeSeries):
freq = spfft.rfftfreq(len(timeSeries),1)
fft = spfft.rfft(timeSeries)
amp = np.abs(fft)
indmax = np.where(amp==np.max(amp))[0][0]
oi = (np.sum(amp[indmax-1:indmax+1]))/np.sum(amp)
indmax = np.where(amp==np.max(amp))[0][0]
dfreq = freq[indmax]*1000 # Sampling frequency = 1/1ms = 1/0.001= 1000
return oi,dfreq
评论列表
文章目录