[Numpy-discussion] What does fftn take as parameters?

David Cournapeau cournape at gmail.com
Mon Dec 5 17:19:28 EST 2011


On Mon, Dec 5, 2011 at 4:28 PM, Roger Binns <rogerb at rogerbinns.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> (Note I'm a programmer type, not a math type and am doing coding directed
> by a matlab user.)
>
> I'm trying to do an fft on multiple columns of data at once (ultimately
> feeding into a correlation calculation).  I can use fft() to work on one
> column:
>
>  data=[23, 43, 53, 54, 0, 10]
>  powtwo=8 # nearest power of two size
>  numpy.fft.fft(data, powtwo)

I am not I understand what you are trying to do ? numpy.fft.fft will
compute fft on every *row*, or every column if you say pass axis=0
argument:

numpy.fft.fft(data, 8, axis=0)
# conceptually equivalent to the following
for i in range(data.shape[1]):
    numpy.fft.fft(data[:, i], 8) # apply fft to each column separately

fftn is for multi-dimensional fft, which is something else than doing
a fft on every column, but this is true in matlab as well.

cheers,

David



More information about the NumPy-Discussion mailing list