def plotFFT(df):
# Number of samplepoints
N = len(df)
# sample spacing
T = BINSIZE*60.0
x = np.linspace(0.0, N*T, N)
y = df.values #np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)
yf = fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N/2)
fig, ax = plt.subplots()
ax.plot(xf, 2.0/N * np.abs(yf[:N//2]))
plt.savefig(FIG_DIR+'fft.png', bbox_inches='tight')
评论列表
文章目录