I am working with simulations of populations of neurons, and would like to extract the dominant frequency from their local field potential. This takes the form of just a single vector of values, which I have plotted here. Clearly, there is some oscillatory activity happening, and I am interested in what frequency the large scale oscillations are occurring at.
I am not very familiar with Fourier transforms outside of the general idea of them, but I believe they are the tool needed here? The sampling distance in this simulation was 0.00006 seconds or the sampling rate is 1/0.00006 Hz. I tried using the numpy.fft.fft function, but I am a little unsure about how to interpret the results. I expected a large peak around 1, corresponding to what appears like 1 Hz oscillations. Here is the code I ran, and the resulting plot.
raw = np.loadtxt(r"./file.txt")#calculate the frequencies associated with our signalfreqs = fft.rfftfreq(len(raw),0.0006)sp = fft.rfft(raw)plt.plot(freqs, sp.real, freqs, sp.imag)
I believe the high sampling rate is causing the calculation of such high frequencies, and I know I am just interested in those from ~0-4 Hz so I can plot those as:
Or to make it easier to visualize, just ~1-4 Hz:
Note, I am not calculating the FFTs any differently, just plotting different regions of the results. My issue is I am unclear about how to interpret the results or also how to realize if I am making an error somewhere in my code. I can see some spikes in the results, but they are not where I expected them to be, nor am I sure on how to determine when they are significant.
Any help with this is appreciated. :^)