[Numpy-discussion] Here's what I've done to numpy.fft

Jochen Schröder cycomanic at gmail.com
Mon Jul 12 22:08:56 EDT 2010


On 13/07/10 08:47, David Goldsmith wrote:
> In light of my various questions and the responses thereto, here's what
> I've done (but not yet committed) to numpy.fft.
>
> There are many ways to define the DFT, varying in the sign of the
> exponent, normalization, etc.  In this implementation, the DFT is defined
> as
>
> .. math::
>     A_k =  \sum_{m=0}^{n-1} a_m \exp\left\{-2\pi i{mk \over n}\right\}
>     \qquad k = 0,\ldots,n-1
>
> where `n` is the number of input points.  In general, the DFT is defined
> for complex inputs and outputs, and a single-frequency component at linear
> frequency :math:`f` is represented by a complex exponential
> :math:`a_m = \exp\{2\pi i\,f m\Delta t\}`, where
> :math:`\Delta t` is the *sampling interval*.
>
> Note that, due to the periodicity of the exponential function, formally
> :math:`A_{n-1} = A_{-1}, A_{n-2} = A_{-2}`, etc.  That said, the values in
> the result are in the so-called "standard" order: if ``A = fft(a,n)``,
> then ``A[0]`` contains the zero-frequency term (the sum of the data),
> which is always purely real for real inputs.  Then ``A[1:n/2]`` contains
> the positive-frequency terms, and ``A[n/2+1:]`` contains the
> negative-frequency (in the sense described above) terms, from least (most
> negative) to largest (closest to zero).  In particular, for `n` even,
> ``A[n/2]`` represents both the positive and the negative Nyquist
> frequencies, and is also purely real for real input.  For `n` odd,
> ``A[(n-1)/2]`` contains the largest positive frequency, while
> ``A[(n+1)/2]`` contains the largest (in absolute value) negative
> frequency.  In both cases, i.e., `n` even or odd, ``A[n-1]`` contains the
> negative frequency closest to zero.
>
> Feedback welcome.
>
> DG
>
Hi David,

great work. I agree with Travis leave the sampling out. This make things 
more confusing. I'd also suggest pointing to fftshift for converting the 
"standard" order to order "min frequency to max frequency"

Cheers
Jochen
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list