From bab4cfed357919260e83c2eef0941ee649ae34fd Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 19 Nov 2012 03:47:05 -0500 Subject: [PATCH] FFT_tools: update docstrings for Sphinx 1.3 --- FFT_tools.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/FFT_tools.py b/FFT_tools.py index 95b9981..f70f573 100644 --- a/FFT_tools.py +++ b/FFT_tools.py @@ -12,18 +12,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -"""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 @@ -360,7 +360,8 @@ class TestRFFT (_unittest.TestCase): .. 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) @@ -387,13 +388,13 @@ class TestRFFT (_unittest.TestCase): 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 @@ -437,7 +438,7 @@ class TestUnitaryRFFT (_unittest.TestCase): \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 @@ -445,7 +446,7 @@ class TestUnitaryRFFT (_unittest.TestCase): 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 ----- @@ -510,7 +511,7 @@ class TestUnitaryRFFT (_unittest.TestCase): 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 ----- @@ -518,7 +519,8 @@ class TestUnitaryRFFT (_unittest.TestCase): .. 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) -- 2.26.2