[Scipy-svn] r6408 - trunk/scipy/fftpack

scipy-svn at scipy.org scipy-svn at scipy.org
Mon May 24 09:11:41 EDT 2010


Author: rgommers
Date: 2010-05-24 08:11:41 -0500 (Mon, 24 May 2010)
New Revision: 6408

Modified:
   trunk/scipy/fftpack/basic.py
   trunk/scipy/fftpack/pseudo_diffs.py
   trunk/scipy/fftpack/realtransforms.py
Log:
DOC: merge wiki edits - fftpack module.

Modified: trunk/scipy/fftpack/basic.py
===================================================================
--- trunk/scipy/fftpack/basic.py	2010-05-24 13:11:26 UTC (rev 6407)
+++ trunk/scipy/fftpack/basic.py	2010-05-24 13:11:41 UTC (rev 6408)
@@ -408,19 +408,23 @@
 
 
 def ifftn(x, shape=None, axes=None, overwrite_x=0):
-    """ ifftn(x, s=None, axes=None, overwrite_x=0) -> y
-
+    """
     Return inverse multi-dimensional discrete Fourier transform of
     arbitrary type sequence x.
 
-    The returned array contains
+    The returned array contains::
 
       y[j_1,..,j_d] = 1/p * sum[k_1=0..n_1-1, ..., k_d=0..n_d-1]
          x[k_1,..,k_d] * prod[i=1..d] exp(sqrt(-1)*2*pi/n_i * j_i * k_i)
 
-    where d = len(x.shape), n = x.shape, and p = prod[i=1..d] n_i.
+    where ``d = len(x.shape)``, ``n = x.shape``, and ``p = prod[i=1..d] n_i``.
 
-    Optional input: see fftn.__doc__
+    For description of parameters see `fftn`.
+
+    See Also
+    --------
+    fftn : for detailed information.
+
     """
     return _raw_fftn_dispatch(x, shape, axes, overwrite_x, -1)
 

Modified: trunk/scipy/fftpack/pseudo_diffs.py
===================================================================
--- trunk/scipy/fftpack/pseudo_diffs.py	2010-05-24 13:11:26 UTC (rev 6407)
+++ trunk/scipy/fftpack/pseudo_diffs.py	2010-05-24 13:11:41 UTC (rev 6408)
@@ -252,26 +252,30 @@
 _cache = {}
 def sc_diff(x, a, b, period=None,
             _cache = _cache):
-    """ sc_diff(x, a, b, period=2*pi) -> y
-
+    """
     Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x.
 
     If x_j and y_j are Fourier coefficients of periodic functions x
-    and y, respectively, then
+    and y, respectively, then::
 
       y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j
       y_0 = 0
 
-    Input:
-      a,b
+    Parameters
+    ----------
+    x : array_like
+        Input array.
+    a,b : float
         Defines the parameters of the sinh/cosh pseudo-differential
         operator.
-      period
+    period : float, optional
         The period of the sequence x. Default is 2*pi.
 
-    Notes:
-      sc_diff(cs_diff(x,a,b),b,a) == x
-      For even len(x), the Nyquist mode of x is taken zero.
+    Notes
+    -----
+    ``sc_diff(cs_diff(x,a,b),b,a) == x``
+    For even ``len(x)``, the Nyquist mode of x is taken as zero.
+
     """
     tmp = asarray(x)
     if iscomplexobj(tmp):

Modified: trunk/scipy/fftpack/realtransforms.py
===================================================================
--- trunk/scipy/fftpack/realtransforms.py	2010-05-24 13:11:26 UTC (rev 6407)
+++ trunk/scipy/fftpack/realtransforms.py	2010-05-24 13:11:41 UTC (rev 6408)
@@ -20,20 +20,25 @@
     Parameters
     ----------
     x : array-like
-        input array.
-    type : {1, 2, 3}
-        type of the DCT (see Notes).
+        The input array.
+    type : {1, 2, 3}, optional
+        Type of the DCT (see Notes). Default type is 2.
     n : int, optional
         Length of the transform.
     axis : int, optional
-        axis over which to compute the transform.
-    norm : {None, 'ortho'}
-        normalization mode (see Notes).
+        Axis over which to compute the transform.
+    norm : {None, 'ortho'}, optional
+        Normalization mode (see Notes). Default is None.
 
     Returns
     -------
-    y : real ndarray
+    y : ndarray of real
+        The transformed input array.
 
+    See Also
+    --------
+    idct
+
     Notes
     -----
     For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to
@@ -46,12 +51,11 @@
     type I
     ~~~~~~
     There are several definitions of the DCT-I; we use the following
-    (for ``norm=None``):
+    (for ``norm=None``)::
 
-    .. math::
-        y_k = x_0 + (-1)^k x_{N-1} + 2\\sum_{n=1}^{N-2} x_n
-        \\cos\\left({\\pi nk\\over N-1}\\right),
-        \\qquad 0 \\le k < N.
+                                         N-2
+      y[k] = x[0] + (-1)**k x[N-1] + 2 * sum x[n]*cos(pi*k*n/(N-1))
+                                         n=1
 
     Only None is supported as normalization mode for DCT-I. Note also that the
     DCT-I is only supported for input size > 1
@@ -59,43 +63,40 @@
     type II
     ~~~~~~~
     There are several definitions of the DCT-II; we use the following
-    (for ``norm=None``):
+    (for ``norm=None``)::
 
-    .. math::
-        y_k = 2 \\sum_{n=0}^{N-1} x_n
-        \\cos\\left({\\pi(2n+1)k\\over 2N}\\right)
-        \\qquad 0 \\le k < N.
 
-    If ``norm='ortho'``, :math:`y_k` is multiplied by a scaling factor `f`:
+                N-1
+      y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N.
+                n=0
 
-    .. math::
-        f = \\begin{cases} \\sqrt{1/(4N)}, & \\text{if $k = 0$} \\\\
-    \t\t\\sqrt{1/(2N)}, & \\text{otherwise} \\end{cases}
+    If ``norm='ortho'``, ``y[k]`` is multiplied by a scaling factor `f`::
 
+      f = sqrt(1/(4*N)) if k = 0,
+      f = sqrt(1/(2*N)) otherwise.
+
     Which makes the corresponding matrix of coefficients orthonormal
-    (`OO' = Id`).
+    (``OO' = Id``).
 
     type III
     ~~~~~~~~
 
     There are several definitions, we use the following
-    (for ``norm=None``):
+    (for ``norm=None``)::
 
-    .. math::
-        y_k = x_0 + 2 \\sum_{n=1}^{N-1} x_n
-        \\cos\\left({\\pi n(2k+1) \\over 2N}\\right)
-        \\qquad 0 \\le k < N,
+                        N-1
+      y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N.
+                        n=1
 
-    or, for ``norm='ortho'``:
+    or, for ``norm='ortho'`` and 0 <= k < N::
 
-    .. math::
-        y_k = {x_0\\over\\sqrt{N}} + {1\\over\\sqrt{N}} \\sum_{n=1}^{N-1}
-        x_n \\cos\\left({\\pi n(2k+1) \\over 2N}\\right)
-        \\qquad 0 \\le k < N.
+                                          N-1
+      y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N)
+                                          n=1
 
     The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up
-    to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of the
-    orthonormalized DCT-II.
+    to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of
+    the orthonormalized DCT-II.
 
     References
     ----------
@@ -119,33 +120,36 @@
     Parameters
     ----------
     x : array-like
-        input array.
-    type : {1, 2, 3}
-        type of the IDCT (see Notes).
+        The input array.
+    type : {1, 2, 3}, optional
+        Type of the DCT (see Notes). Default type is 2.
     n : int, optional
         Length of the transform.
     axis : int, optional
-        axis over which to compute the transform.
-    norm : {None, 'ortho'}
-        normalization mode (see Notes).
+        Axis over which to compute the transform.
+    norm : {None, 'ortho'}, optional
+        Normalization mode (see Notes). Default is None.
 
     Returns
     -------
-    y : real ndarray
+    y : ndarray of real
+        The transformed input array.
 
+    See Also
+    --------
+    dct
+
     Notes
     -----
-    For a single dimension array x, idct(x, norm='ortho') is equal to matlab
-    idct(x)
+    For a single dimension array `x`, ``idct(x, norm='ortho')`` is equal to
+    matlab ``idct(x)``.
 
     'The' IDCT is the IDCT of type 2, which is the same as DCT of type 3.
 
     IDCT of type 1 is the DCT of type 1, IDCT of type 2 is the DCT of type 3,
-    and IDCT of type 3 is the DCT of type 2.
+    and IDCT of type 3 is the DCT of type 2. For the definition of these types,
+    see `dct`.
 
-    See Also
-    --------
-    dct
     """
     if type == 1 and norm is not None:
         raise NotImplementedError(




More information about the Scipy-svn mailing list