[Numpy-discussion] Bug or surprising undocumented behaviour in irfft

Charles R Harris charlesr.harris@gmail....
Wed Aug 29 18:08:08 CDT 2007


Anne,

On 8/29/07, Anne Archibald <peridot.faceted@gmail.com> wrote:
>
> Hi,
>
> numpy's Fourier transforms have the handy feature of being able to
> upsample and downsample signals; for example the documentation cites
> irfft(rfft(A),16*len(A)) as a way to get a Fourier interpolation of A.
> However, there is a peculiarity with the way numpy handles the
> highest-frequency coefficient.


<snip>

The upshot is, if I correctly understand what is going on, that the
> last coefficient needs to be treated somewhat differently from the
> others; when one pads with zeros in order to upsample the signal, one
> should multiply the last coefficient by  0.5. Should this be done in
> numpy's upsampling code? Should it at least be documented?


What is going on is that the coefficient at the Nyquist  frequency appears
once in the unextended array, but twice when the array is extended with
zeros because of the Hermitean symmetry. That should probably be fixed in
the upsampling code.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070829/c54c4318/attachment.html 


More information about the Numpy-discussion mailing list