[Numpy-discussion] rfft different in numpy vs scipy

Andrew Jaffe a.h.jaffe at gmail.com
Thu Sep 7 17:46:15 CDT 2006

Hi all,

It seems that scipy and numpy define rfft differently.

numpy returns n/2+1 complex numbers (so the first and last numbers are 
actually real) with the frequencies equivalent to the positive part of 
the fftfreq, whereas scipy returns n real numbers with the frequencies 
as in rfftfreq (i.e., two real numbers at the same frequency, except for 
the highest and lowest) [All of the above for even n; but the difference 
between numpy and scipy remains for odd n.]

I think the numpy behavior makes more sense, as it doesn't require any 
unpacking after the fact, at the expense of a tiny amount of wasted 
space. But would this in fact require scipy doing extra work from 
whatever the 'native' real_fft (fftw, I assume) produces?

Anyone else have an opinion?


More information about the Numpy-discussion mailing list