[Scipy-svn] r5459 - in trunk/scipy: ndimage special

scipy-svn@scip... scipy-svn@scip...
Tue Jan 13 02:25:01 CST 2009


Author: stefan
Date: 2009-01-13 02:24:40 -0600 (Tue, 13 Jan 2009)
New Revision: 5459

Modified:
   trunk/scipy/ndimage/filters.py
   trunk/scipy/special/orthogonal.py
Log:
Apply documentation patch.

Modified: trunk/scipy/ndimage/filters.py
===================================================================
--- trunk/scipy/ndimage/filters.py	2009-01-13 08:12:45 UTC (rev 5458)
+++ trunk/scipy/ndimage/filters.py	2009-01-13 08:24:40 UTC (rev 5459)
@@ -520,19 +520,31 @@
 @docfiller
 def convolve(input, weights, output = None, mode = 'reflect', cval = 0.0,
              origin = 0):
-    """Multi-dimensional convolution.
+    """
+    Multi-dimensional convolution.
 
     The array is convolved with the given kernel.
 
     Parameters
     ----------
-    %(input)s
+    input : array-like
+        input array to filter
     weights : ndarray
         array of weights, same number of dimensions as input
-    %(output)s
-    %(mode)s
-    %(cval)s
-    %(origin)s
+    output : array, optional
+        The ``output`` parameter passes an array in which to store the
+        filter output.
+    mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional
+        The ``mode`` parameter determines how the array borders are
+        handled, where ``cval`` is the value when mode is equal to
+        'constant'. Default is 'reflect'
+    cval : scalar, optional
+        Value to fill past edges of input if ``mode`` is 'constant'. Default
+        is 0.0
+    origin : scalar, optional
+        The ``origin`` parameter controls the placement of the filter.
+        Default 0
+
     """
     return _correlate_or_convolve(input, weights, output, mode, cval,
                                   origin, True)
@@ -859,16 +871,40 @@
 @docfiller
 def median_filter(input, size = None, footprint = None, output = None,
       mode = "reflect", cval = 0.0, origin = 0):
-    """Calculates a multi-dimensional median filter.
+    """
+    Calculates a multi-dimensional median filter.
 
     Parameters
     ----------
-    %(input)s
-    %(size_foot)s
-    %(output)s
-    %(mode)s
-    %(cval)s
-    %(origin)s
+    input : array-like
+        input array to filter
+    size : scalar or tuple, optional
+        See footprint, below
+    footprint : array, optional
+        Either ``size`` or ``footprint`` must be defined.  ``size`` gives
+        the shape that is taken from the input array, at every element
+        position, to define the input to the filter function.
+        ``footprint`` is a boolean array that specifies (implicitly) a
+        shape, but also which of the elements within this shape will get
+        passed to the filter function.  Thus ``size=(n,m)`` is equivalent
+        to ``footprint=np.ones((n,m))``.  We adjust ``size`` to the number
+        of dimensions of the input array, so that, if the input array is
+        shape (10,10,10), and ``size`` is 2, then the actual size used is
+        (2,2,2).
+    output : array, optional
+        The ``output`` parameter passes an array in which to store the
+        filter output.
+    mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional
+        The ``mode`` parameter determines how the array borders are
+        handled, where ``cval`` is the value when mode is equal to
+        'constant'. Default is 'reflect'
+    cval : scalar, optional
+        Value to fill past edges of input if ``mode`` is 'constant'. Default
+        is 0.0
+    origin : scalar, optional
+        The ``origin`` parameter controls the placement of the filter.
+        Default 0
+
     """
     return _rank_filter(input, 0, size, footprint, output, mode, cval,
                         origin, 'median')

Modified: trunk/scipy/special/orthogonal.py
===================================================================
--- trunk/scipy/special/orthogonal.py	2009-01-13 08:12:45 UTC (rev 5458)
+++ trunk/scipy/special/orthogonal.py	2009-01-13 08:24:40 UTC (rev 5459)
@@ -1,8 +1,3 @@
-#!/usr/bin/env python
-#
-# Author:  Travis Oliphant 2000
-# Updated Sep. 2003 (fixed bugs --- tested to be accurate)
-
 """
 A collection of functions to find the weights and abscissas for
 Gaussian Quadrature.
@@ -14,30 +9,44 @@
 
 Many recursion relations for orthogonal polynomials are given:
 
-a1n f_n+1 (x) = (a2n + a3n x ) f_n (x) - a4n f_n-1 (x)
+.. math::
 
+    a1n f_{n+1} (x) = (a2n + a3n x ) f_n (x) - a4n f_{n-1} (x)
+
 The recursion relation of interest is
 
-P_n+1 (x) = (x - A_n) P_n (x) - B_n P_n-1 (x)
+.. math::
 
-where P has a different normalization than f.
+    P_{n+1} (x) = (x - A_n) P_n (x) - B_n P_{n-1} (x)
 
+where :math:`P` has a different normalization than :math:`f`.
+
 The coefficients can be found as:
 
-A_n = -a2n / a3n
+.. math::
 
-B_n = ( a4n / a3n sqrt(h_n-1 / h_n))**2
+    A_n = -a2n / a3n
+    \\qquad
+    B_n = ( a4n / a3n \\sqrt{h_n-1 / h_n})^2
 
-     where
-             h_n = int_a^b w(x) f_n(x)^2
+where
+
+.. math::
+
+    h_n = \\int_a^b w(x) f_n(x)^2
+
 assume:
-P_0(x) = 1
-P_-1(x) == 0
 
+.. math::
+
+    P_0 (x) = 1
+    \\qquad
+    P_{-1} (x) == 0
+
 For the mathematical background, see [golub.welsch-1969-mathcomp]_ and
 [abramowitz.stegun-1965]_.
 
-Functions:
+Functions::
 
   gen_roots_and_weights  -- Generic roots and weights.
   j_roots                -- Jacobi
@@ -66,7 +75,11 @@
    Mathematical Functions: with Formulas, Graphs, and Mathematical
    Tables*. Gaithersburg, MD: National Bureau of Standards.
    http://www.math.sfu.ca/~cbm/aands/
+
 """
+#
+# Author:  Travis Oliphant 2000
+# Updated Sep. 2003 (fixed bugs --- tested to be accurate)
 
 # Scipy imports.
 import numpy as np



More information about the Scipy-svn mailing list