[SciPy-dev] FFT docstrings (was: Scipy Tutorial (and updating it))

Tom Grydeland tom.grydeland at gmail.com
Thu Dec 18 08:52:47 EST 2008


On Tue, Dec 16, 2008 at 6:05 PM,  <jh at physics.ucf.edu> wrote:

> I added the helper routines and defined the time and frequency domains
> near the top (and took out similar text near the bottom), fixed some
> commas, etc.

A comment was dropped on the `ifft` routine re the semantics of the
zero padding done when `n > len(a)`.  I wrote a note in the
documentation to address the issue, but at the same time I thought
that perhaps we could add a helper routine (I suggest the name
`ifftpad`) to implement the padding that the commenter would like to
see, e.g.,

ifftpad(a, m) -> _r[a[:n/2], zeros((m-n)/2), a[n/2:], zeros((m-n)/2) ]

where `n == len(a)` and care must be taken to get even and odd `m` and
`n` correct, etc.
It might also be capable of truncating only high-frequency components
if `m < len(a)`, e.g.

ifftpad(a, m) -> _r[ a[:m/2], a[n/2:(n+m)/2 ]

in this way, the resampling approach suggested for `irfft` would work
also for complex ffts, thus:

ifft(ifftpad(fft(a), m))


> --jh--

-- 
Tom Grydeland
  <Tom.Grydeland@(gmail.com)>



More information about the SciPy-Dev mailing list