DFT for timeseries data

Jan 3 2018

DFT for Timeseries Data is a Jupyter Notebook I developed for a presentation on applying the DFT to timeseries data for seasonality detection. The notebook attempts to build understanding one step at a time from a direct mathematical implementation and explanation of the DFT, to implementing frequency magnitude detection and approximate resynthesis.

Note: Being that this was designed to go along with a presentation, I would not recommend it as a first introduction to the DFT since it's really mostly code with some images for visual explanation. Armed with some knowledge of the DFT already, I think it should help clarify some behaviors visually and could serve an implementation reference for some algorithms. I'm going to be digging into Julius O. Smith's Mathematics of the Discrete Fourier Transform soon, so there should be more DFT-related notebooks to come!

Here are some of the animations built up in this notebook:

  • Increasing the number of DFT points results in better reconstruction of the original series:

    Animation varying the number of DFT points
  • The effects of windowing a pure sinusoid when the window is not an exact multiple of the period:

    Animation of windowing's affect on the DFT with pure sinusoids
  • The effect of window size on frequency magnitude accuracy:

    Animation of the effect of window size on frequency magnitude accuracy