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:
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" \