numpy.fftpack: axis=None ?
Folks, I was playing around the numpy.fftpack when I ran into the problem below: it seems that axis=None is not valid with fft. Is there a reason for that ? I was assuming a behavior similar to other functions, where axis=None translates to "use a flat array".

N.fft.fft(N.arange(100).reshape(10,10),128,None)
/usr/lib64/python2.4/sitepackages/numpy/fft/fftpack.py in fft(a, n, axis) 85 different n's.""" 86 > 87 return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftf, _fft_cache) 88 89
/usr/lib64/python2.4/sitepackages/numpy/fft/fftpack.py in _raw_fft(a, n, axis, init_function, work_function, fft_cache) 44 fft_cache[n] = wsave 45 > 46 if a.shape[axis] != n: 47 s = list(a.shape) 48 if s[axis] > n:
TypeError: tuple indices must be integers 
PGM wrote:
Folks, I was playing around the numpy.fftpack when I ran into the problem below: it seems that axis=None is not valid with fft. Is there a reason for that ?
Not really, other than history and the fact that subpackages of NumPy will often define their own behavior.
Perhaps we could implement it, but would this create more confusion as usually when axis=None is accepted then it is the default.
Travis
participants (2)

PGM

Travis Oliphant