From e92fae2417cb1e9f7a7148918723b81647969b7f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 18 May 2010 10:44:29 -0400 Subject: [PATCH] Add Numpy crossreferences to hooke.util.fft --- FFT_tools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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" \ -- 2.26.2