Exemplo n.º 1
0
def test_decorator():
    # with unindentation of parameters
    decorator = doccer.filldoc(doc_dict, True)

    @decorator
    def func():
        """ Docstring
        %(strtest3)s
        """
    assert_equal(func.__doc__, """ Docstring
        Another test
           with some indent
        """)

    # without unindentation of parameters
    decorator = doccer.filldoc(doc_dict, False)

    @decorator
    def func():
        """ Docstring
        %(strtest3)s
        """
    assert_equal(func.__doc__, """ Docstring
            Another test
               with some indent
        """)
Exemplo n.º 2
0
def test_decorator():
    with suppress_warnings() as sup:
        sup.filter(category=DeprecationWarning)
        # with unindentation of parameters
        decorator = doccer.filldoc(doc_dict, True)

        @decorator
        def func():
            """ Docstring
            %(strtest3)s
            """

        assert_equal(
            func.__doc__, """ Docstring
            Another test
               with some indent
            """)

        # without unindentation of parameters
        decorator = doccer.filldoc(doc_dict, False)

        @decorator
        def func():
            """ Docstring
            %(strtest3)s
            """

        assert_equal(
            func.__doc__, """ Docstring
                Another test
                   with some indent
            """)
def test_decorator():
    # with unindentation of parameters
    decorator = doccer.filldoc(doc_dict, True)

    @decorator
    def func():
        """ Docstring
        %(strtest3)s
        """

    assert_equal(
        func.__doc__, """ Docstring
        Another test
           with some indent
        """)

    # without unindentation of parameters
    decorator = doccer.filldoc(doc_dict, False)

    @decorator
    def func():
        """ Docstring
        %(strtest3)s
        """

    assert_equal(
        func.__doc__, """ Docstring
            Another test
               with some indent
        """)
Exemplo n.º 4
0
"""extra_keywords : dict, optional
    dict of extra keyword arguments to pass to passed function"""

docdict = {
    'input': _input_doc,
    'axis': _axis_doc,
    'output': _output_doc,
    'size_foot': _size_foot_doc,
    'mode': _mode_doc,
    'cval': _cval_doc,
    'origin': _origin_doc,
    'extra_arguments': _extra_arguments_doc,
    'extra_keywords': _extra_keywords_doc,
    }

docfiller = doccer.filldoc(docdict)


@docfiller
def correlate1d(input, weights, axis=-1, output=None, mode="reflect",
                cval=0.0, origin=0):
    """Calculate a one-dimensional correlation along the given axis.

    The lines of the array along the given axis are correlated with the
    given weights.

    Parameters
    ----------
    %(input)s
    weights : array
        One-dimensional sequence of numbers.
Exemplo n.º 5
0
   * False - maximum field name length in a structure is 31 characters
     which is the documented maximum length. This is the default.
   * True - maximum field name length in a structure is 63 characters
     which works for Matlab 7.6''',
     'do_compression':
         '''do_compression : bool, optional
   Whether to compress matrices on write. Default is False.''',
     'oned_as':
         '''oned_as : {'column', 'row'}, optional
   If 'column', write 1-D numpy arrays as column vectors.
   If 'row', write 1D numpy arrays as row vectors.''',
     'unicode_strings':
         '''unicode_strings : bool, optional
   If True, write strings as Unicode, else matlab usual encoding.'''}

docfiller = doccer.filldoc(doc_dict)
'''

 Note on architecture
======================

There are three sets of parameters relevant for reading files.  The
first are *file read parameters* - containing options that are common
for reading the whole file, and therefore every variable within that
file. At the moment these are:

* mat_stream
* dtypes (derived from byte code)
* byte_order
* chars_as_strings
* squeeze_me
Exemplo n.º 6
0
import math
import numpy
import warnings

from . import _ni_support
from . import _nd_image
from ._ni_docstrings import docdict
from scipy.misc import doccer

# Change the default 'reflect' to 'constant' via modifying a copy of docdict
docdict_copy = docdict.copy()
del docdict
docdict_copy['mode'] = docdict_copy['mode'].replace("Default is 'reflect'",
                                                    "Default is 'constant'")

docfiller = doccer.filldoc(docdict_copy)

__all__ = ['spline_filter1d', 'spline_filter', 'geometric_transform',
           'map_coordinates', 'affine_transform', 'shift', 'zoom', 'rotate']


@docfiller
def spline_filter1d(input, order=3, axis=-1, output=numpy.float64,
                    mode='mirror'):
    """
    Calculate a one-dimensional spline filter along the given axis.

    The lines of the array along the given axis are filtered by a
    spline filter. The order of the spline must be >= 2 and <= 5.

    Parameters
Exemplo n.º 7
0
import math
import numpy
import warnings

from . import _ni_support
from . import _nd_image
from ._ni_docstrings import docdict
from scipy.misc import doccer

# Change the default 'reflect' to 'constant' via modifying a copy of docdict
docdict_copy = docdict.copy()
del docdict
docdict_copy['mode'] = docdict_copy['mode'].replace("Default is 'reflect'",
                                                    "Default is 'constant'")

docfiller = doccer.filldoc(docdict_copy)

__all__ = ['spline_filter1d', 'spline_filter', 'geometric_transform',
           'map_coordinates', 'affine_transform', 'shift', 'zoom', 'rotate']


@docfiller
def spline_filter1d(input, order=3, axis=-1, output=numpy.float64):
    """
    Calculate a one-dimensional spline filter along the given axis.

    The lines of the array along the given axis are filtered by a
    spline filter. The order of the spline must be >= 2 and <= 5.

    Parameters
    ----------
Exemplo n.º 8
0

docdict = {
    'shape' :
"""shape : pair
    The shape of the LinearOperator (if it were a matrix).""",

    ## The see also section.
    'zeros' : "zeros : Matrix free version of the zeros matrix.",
    'ones' : "ones : Matrix free version of the ones matrix.",
    'eye' : "eye : Matrix free version of the eye matrix.",
    'diag' : "diag : Convert a 1D array to matrix free diagonal matrix.",
    'select' : "select : Select certain rows out of a matrix."
    }

docfill = doccer.filldoc(docdict)

@docfill
def zeros(shape):
    ''' PyOp version of zeros array function (only 2D).

    Returns a new LinearOperator that emulates a matrix filled with zeros.

    Parameters
    ----------
    %(shape)s

    Returns
    -------
    LinearOperator
        A functional version of numpy.zeros()