

If fitting is not an option, you can directly use some form of interpolation to interpolate data to a uniform sampling: There are several tutorials and functions to choose from: In case of non-uniform sampling, please use a function for fitting the data. uniform sampling in time, like what you have shown above). The important thing about fft is that it can only be applied to data in which the timestamp is uniform ( i.e. Y = pandas.read_csv('', skiprows=2, header=None).values X = pandas.read_csv('', skiprows=2, header=None).values You should always inspect the data that you feed into any algorithm to make sure that it's appropriate. The problem here is that you don't have periodic data. So what's the issue? In response to the raw data and comments being posted It's been longer than I care to admit since I was in engineering school thinking about signal processing, but spikes at 50 and 80 are exactly what I would expect. I get what I believe to be very reasonable output. So I run a functionally equivalent form of your code in an IPython notebook: %matplotlib inline Spacing is just equal to xInterp-xInterp. Plt.plot(fftFreq, 10*np.log10(signalPSD)) # Get frequencies corresponding to signal PSDįftFreq = fftfreq(len(signalPSD), spacing)

Here is my code: # Perform FFT with SciPy When I use fft() on the whole thing it just has a huge spike at zero and nothing else. Here is a pastebin of the data I am attempting to FFT Y = np.sin(50.0 * 2.0*np.pi*x) + 0.5*np.sin(80.0 * 2.0*np.pi*x)īut when I change the argument of fft to my data set and plot it, I get extremely odd results, and it appears the scaling for the frequency may be off.

I have tried the following example: from scipy.fftpack import fft and don't really show how to do it with just a set of data and the corresponding timestamps. I have looked up examples, but they all rely on creating a set of fake data with some certain number of data points, and frequency, etc. What is the simplest way to feed these lists into a SciPy or NumPy method and plot the resulting FFT? I have two lists, one that is y values and the other is timestamps for those y values. I have access to NumPy and SciPy and want to create a simple FFT of a data set.
