If your sequence is not meant to be periodic (i.e., if after one minute 
there is no reason why the signal should start back at the beginning 
right away), then you should do zero-padding. And while you zero-pad, 
you can zero-pad to a sequence that is a power of two, thus preventing 
awkward factorizations.

from numpy.fft import fft
from numpy.random import rand
from math import log, ceil

seq_A = rand(2649674)
seq_B = rand(2646070)
fft_A = fft(seq_A) #Long
fft_B = fft(seq_B)

zeropadded_fft_A = fft(seq_A, n=2**(ceil(log(len(seq_A),2))+1))
zeropadded_fft_B = fft(seq_B, n=2**(ceil(log(len(seq_B),2))+1))

You could remove the "+1" above to get faster results, but then that may 
lead to unwanted frequencies (coming from the fact that fft assumes 
periodic signals, read online about zero-padding).

Have a nice day,

Pierre-André

On 08/28/2015 12:03 PM, Stefan van der Walt wrote:
>
> On 2015-08-28 11:51:47, Joseph Codadeen <[email protected]> wrote:
>> my_1_minute_noise_with_gaps_truncated - Array len is 
>> 2646070my_1_minute_noise_with_gaps - Array len is 2649674
>
> In [6]: from sympy import factorint  In [7]: max(factorint(2646070)) 
> Out[7]: 367  In [8]: max(factorint(2649674)) Out[8]: 1324837
> Those numbers give you some indication of how long the FFT will take 
> to compute.
>
> Stéfan
>

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to