The faster way of doing this: def fourier_transform(signal, period, tt): """ See http://en.wikipedia.org/wiki/Fourier_transform How come Numpy and Scipy don't implement this ??? """ f = lambda func : (signal*func(2*pi*tt/period)).sum() return f(cos)+ 1j*f(sin) is using the FFT. What you want is the power spectral density in the discrete case, called the power spectrum. It can be calculated by multiplying the discrete…
If someone knows a way to use the FFT to get non-integer periods (apart from oversampling the signal) I'll gladly change the code.