Upper plot is the original data's plot, and the bottom plot is Fourier transformed data. For the bottom plot, x-axis is the frequency and y-axis is the amplitude. I don't understand the weird behavior towards the right side of the Fourier transformed data - frequency is very sparsely distributed and they seem to soar up.
My peers said that this has to do with some minimum frequency, and Nyquist frequency, and that amplitudes not shown up beyond the right limit of the Fourier transformed data are squashed up into the last data point.
He said that our data is sampled every 1 minute, making Nyquest frequency -> 1/60/2 ~ 0.00833, making data points beyond 0.008 meaningless.
Can anyone explain this behavior?
++ the data is sampled every 1 minute, or 2 minutes. Sampling rate switches between 1 min or 2 min quite often
My original time data is in timestamps, and the sampling rate switches between 1 min and 2 min quite often.
t_delta = [(t[i + 1] - t[i]).total_seconds() for i in range(len(t) - 1)] t_sec = np.cumsum(t_delta) f = 1 / t_sec >>> t_sec [60, 180, 300, 360, 420, 540 ...] # fourier transform n = len(t) inj_fft = np.fft.fft(inj) * (2 / n) # multiply by 2 to get single side spectrum # divide by N to normalize # backtransform inj_orig = np.fft.fft(inj_fft) / 2 inj_orig = np.flip(inj_orig) # plotting fig, ax = plt.subplots(figsize=(8, 2)) ax.plot(f[1: np.int(n / 2)], abs(inj_fft[1: np.int(n / 2)])) # remove imaginary with abs() fig,ax = plt.subplots(figsize=(8, 2)) ax.plot(t, inj) ax.set_title('original data') fig,ax = plt.subplots(figsize=(8, 2)) ax.plot(t, inj_orig, 'r') ax.set_title('backtransformed')
I believe that my codes are correct, because when I backtransform the Fourier transformed data to reconstruct the original signal, they look exactly the same