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

Paul Anton Letnes paul.anton.letnes at gmail.com
Tue Dec 6 13:45:23 EST 2011

On 6. des. 2011, at 17:32, Roger Binns wrote:

> Hash: SHA1
> On 06/12/11 01:58, Pauli Virtanen wrote:
>> I think this cannot be helped --- it does not make sense to explain 
>> basic Numpy concepts in every docstring, especially `axis` and `shape` 
>> are very common.
> They don't need to be explained on the page, but instead link to a page
> that does explain them.  The test is that an experienced Python programmer
> should be able to understand what is going on from the fft doc page and
> every page it links to.  Note that searching doesn't help:

First google hit, "numpy axis":

Under "Basics", third and forth sentences:
NumPy's main object is the homogeneous multidimensional array. It is a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers. In Numpy dimensions are called axes. The number of axes is rank.
Searching is useful indeed, just use google instead. You can do the "several column FFT" easily using the axes keyword. Have a look at that link.

If you are using numpy functions like FFT, you are indeed converting to arrays. Python lists are poorly performing for numerical work and do not map well onto the C and Fortran based codes that give numpy and scipy their good performance. Hence, numpy will convert to arrays for you, and if you are treating the returned array as a list, you are probably (among other things) indexing it in an inefficient way.

It would seem to me that if your obsession over the FFT must be misplaced. If you are passing multidimensional lists here and there, you must have a lot of overhead memory use. Since the FFT is so efficient, O(n log (n)), I'm guessing that it's not your bottleneck (as others have suggested). Try using the cProfile module (python stdlib) to profile your code, and verify where your bottlenecks are. Come back to this list for more advice when you have evidence for where your bottleneck actually is.

As a side note: since the built-in search isn't really all that good, would it be possible to put a customized google search box there instead?

Good luck

More information about the NumPy-Discussion mailing list