From: W. Trevor King Date: Tue, 18 May 2010 14:44:29 +0000 (-0400) Subject: Add Numpy crossreferences to hooke.util.fft X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c76325c24ec36ce5a2deb67aef3c14ad8c90139e;p=hooke.git Add Numpy crossreferences to hooke.util.fft --- diff --git a/hooke/util/fft.py b/hooke/util/fft.py index 0c72469..04fab7d 100644 --- a/hooke/util/fft.py +++ b/hooke/util/fft.py @@ -20,7 +20,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: @@ -335,18 +335,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" \