TimeSignals.py 文件源码

python
阅读 51 收藏 0 点赞 0 评论 0

项目:droppy 作者: BV-DR 项目源码 文件源码
def fftDf( df , part = "abs") :
   #Handle series or DataFrame
   if type(df) == pd.Series :
      df = pd.DataFrame(df)
      ise = True
   else :
      ise = False
   res = pd.DataFrame( index = np.fft.rfftfreq( df.index.size, d = dx( df ) ) )
   for col in df.columns :
      if part == "abs" :
         res["FFT_"+col] = np.abs( np.fft.rfft(df[col]) )  / (0.5*df.index.size)
      elif part == "real" :
         res["FFT_"+col] = np.real( np.fft.rfft(df[col]) ) / (0.5*df.index.size)
      elif part == "imag" :
         res["FFT_"+col] = np.imag( np.fft.rfft(df[col]) ) / (0.5*df.index.size)
   if ise :
      return res.iloc[:,0]
   else :
      return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号