I'm trying to resample a 1-D signal using an FFT method (basically, the one from scipy.signal). However, the code is taking forever to run, even though my input signal is a power of two in length. After looking at profiling, I found the root of the problem.
Basically, this method takes an FFT, then removes part of the fourier spectrum, then takes an IFFT to bring it back to the time domain at a lower sampling rate.
The problem is that that the IFFT is taking far longer to run than the FFT:
ncalls tottime percall cumtime percall filename:lineno(function)
1 6263.996 6263.996 6263.996 6263.996 basic.py:272(ifft)
1 1.076 1.076 1.076 1.076 basic.py:169(fft)
I assume that this has something to do with the amount of fourier points remaining after the cutoff. That said, this is an incredible slowdown so I want to make sure that:
A. This behavior is semi-reasonable and isn't definitely a bug. B. What could I do to avoid this problem and still downsample effectively.
Right now I can pad my input signal to a power of two in order to make the FFT run really quickly, but not sure how to do the same kind of thing for the reverse operation. I didn't even realize that this was an issue for IFFTs :P