From: W. Trevor King Date: Tue, 18 May 2010 14:44:29 +0000 (-0400) Subject: Add Numpy crossreferences to hooke.util.fft X-Git-Tag: 0.5~10^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e92fae2417cb1e9f7a7148918723b81647969b7f;p=FFT-tools.git Add Numpy crossreferences to hooke.util.fft --- diff --git a/FFT_tools.py b/FFT_tools.py index 107c216..cd8d587 100644 --- a/FFT_tools.py +++ b/FFT_tools.py @@ -37,7 +37,7 @@ """ Define some FFT wrappers to reduce clutter. Provides a unitary discrete FFT and a windowed version. -Based on numpy.fft.rfft. +Based on :func:`numpy.fft.rfft`. Main entry functions: @@ -352,18 +352,18 @@ class TestRFFT (unittest.TestCase): Notes ----- - The expected return values are [#numpybook]_: + The expected return values are [#dft]_: - .. math:: X_k = \sum_{m=0}^{n-1} x_m \exp^{-j 2\pi k_m/n} + .. math:: X_k = \sum_{m=0}^{n-1} x_m \exp^{-2\pi imk/n} - .. [#numpybook] http://www.tramy.us/numpybook.pdf + .. [#dft] See the *Background information* section of :mod:`numpy.fft`. """ def run_rfft(self, xs, Xs): - j = complex(0,1) + i = complex(0,1) n = len(xs) Xa = [] for k in range(n): - Xa.append(sum([x*exp(-j*2*pi*k*m/n) for x,m in zip(xs,range(n))])) + Xa.append(sum([x*exp(-2*pi*i*m*k/n) for x,m in zip(xs,range(n))])) if k < len(Xs): assert (Xs[k]-Xa[k])/abs(Xa[k]) < 1e-6, \ "rfft mismatch on element %d: %g != %g, relative error %g" \