# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""Wrap Numpy's fft module to reduce clutter.
+"""Wrap Numpy's :py:mod:`~numpy.fft` module to reduce clutter.
Provides a unitary discrete FFT and a windowed version based on
-:func:`numpy.fft.rfft`.
+:py:func:`numpy.fft.rfft`.
Main entry functions:
-* :func:`unitary_rfft`
-* :func:`power_spectrum`
-* :func:`unitary_power_spectrum`
-* :func:`avg_power_spectrum`
-* :func:`unitary_avg_power_spectrum`
+* :py:func:`unitary_rfft`
+* :py:func:`power_spectrum`
+* :py:func:`unitary_power_spectrum`
+* :py:func:`avg_power_spectrum`
+* :py:func:`unitary_avg_power_spectrum`
"""
import logging as _logging
.. math:: X_k = \sum_{m=0}^{n-1} x_m \exp^{-2\pi imk/n}
- .. [#dft] See the *Background information* section of :mod:`numpy.fft`.
+ .. [#dft] See the *Background information* section of
+ :py:mod:`numpy.fft`.
"""
def run_rfft(self, xs, Xs):
i = _numpy.complex(0, 1)
timeSum, n, freqSum))
def test_rfft(self):
- "Test NumPy's builtin :func:`numpy.fft.rfft`"
+ "Test NumPy's builtin :py:func:`numpy.fft.rfft`"
xs = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]
self.run_rfft(xs, _numpy.fft.rfft(xs))
class TestUnitaryRFFT (_unittest.TestCase):
- """Verify `unitary_rfft`.
+ """Verify :py:func:`unitary_rfft`.
"""
def run_parsevals(self, xs, freq, freqs, Xs):
"""Check the discretized integral form of Parseval's theorem
\rect(t) = \begin{cases}
1& \text{if $|t| < 0.5$}, \\
0& \text{if $|t| \ge 0.5$}.
- \end{cases}
+ \end{cases}
"""
if _numpy.abs(t) < 0.5:
return 1
return 0
def run_rect(self, a=1.0, time_shift=5.0, samp_freq=25.6, samples=256):
- r"""Test `unitary_rttf` on known function `rect(at)`.
+ r"""Test :py:func:`unitary_rfft` on known function :py:meth:`rect`.
Notes
-----
return _numpy.exp(-a * t**2)
def run_gaussian(self, a=1.0, time_shift=5.0, samp_freq=25.6, samples=256):
- r"""Test `unitary_rttf` on known function `gaussian(a,t)`.
+ r"""Test :py:func:`unitary_rttf` on known function :py:meth:`gaussian`.
Notes
-----
.. math::
- \rfft(\gaussian(a,t)) = \sqrt{\pi/a} \cdot \gaussian(1/a,\pi f)
+ \rfft(\gaussian(a,t))
+ = \sqrt{\pi/a} \cdot \gaussian(1/a,\pi f)
"""
samp_freq = _numpy.float(samp_freq)
a = _numpy.float(a)