_ni_docstrings.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. """Docstring components common to several ndimage functions."""
  2. from __future__ import division, print_function, absolute_import
  3. from scipy.misc import doccer
  4. __all__ = ['docfiller']
  5. _input_doc = (
  6. """input : array_like
  7. The input array.""")
  8. _axis_doc = (
  9. """axis : int, optional
  10. The axis of `input` along which to calculate. Default is -1.""")
  11. _output_doc = (
  12. """output : array or dtype, optional
  13. The array in which to place the output, or the dtype of the
  14. returned array. By default an array of the same dtype as input
  15. will be created.""")
  16. _size_foot_doc = (
  17. """size : scalar or tuple, optional
  18. See footprint, below. Ignored if footprint is given.
  19. footprint : array, optional
  20. Either `size` or `footprint` must be defined. `size` gives
  21. the shape that is taken from the input array, at every element
  22. position, to define the input to the filter function.
  23. `footprint` is a boolean array that specifies (implicitly) a
  24. shape, but also which of the elements within this shape will get
  25. passed to the filter function. Thus ``size=(n,m)`` is equivalent
  26. to ``footprint=np.ones((n,m))``. We adjust `size` to the number
  27. of dimensions of the input array, so that, if the input array is
  28. shape (10,10,10), and `size` is 2, then the actual size used is
  29. (2,2,2). When `footprint` is given, `size` is ignored.""")
  30. _mode_doc = (
  31. """mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
  32. The `mode` parameter determines how the input array is extended
  33. beyond its boundaries. Default is 'reflect'. Behavior for each valid
  34. value is as follows:
  35. 'reflect' (`d c b a | a b c d | d c b a`)
  36. The input is extended by reflecting about the edge of the last
  37. pixel.
  38. 'constant' (`k k k k | a b c d | k k k k`)
  39. The input is extended by filling all values beyond the edge with
  40. the same constant value, defined by the `cval` parameter.
  41. 'nearest' (`a a a a | a b c d | d d d d`)
  42. The input is extended by replicating the last pixel.
  43. 'mirror' (`d c b | a b c d | c b a`)
  44. The input is extended by reflecting about the center of the last
  45. pixel.
  46. 'wrap' (`a b c d | a b c d | a b c d`)
  47. The input is extended by wrapping around to the opposite edge.""")
  48. _mode_multiple_doc = (
  49. """mode : str or sequence, optional
  50. The `mode` parameter determines how the input array is extended
  51. when the filter overlaps a border. By passing a sequence of modes
  52. with length equal to the number of dimensions of the input array,
  53. different modes can be specified along each axis. Default value is
  54. 'reflect'. The valid values and their behavior is as follows:
  55. 'reflect' (`d c b a | a b c d | d c b a`)
  56. The input is extended by reflecting about the edge of the last
  57. pixel.
  58. 'constant' (`k k k k | a b c d | k k k k`)
  59. The input is extended by filling all values beyond the edge with
  60. the same constant value, defined by the `cval` parameter.
  61. 'nearest' (`a a a a | a b c d | d d d d`)
  62. The input is extended by replicating the last pixel.
  63. 'mirror' (`d c b | a b c d | c b a`)
  64. The input is extended by reflecting about the center of the last
  65. pixel.
  66. 'wrap' (`a b c d | a b c d | a b c d`)
  67. The input is extended by wrapping around to the opposite edge.""")
  68. _cval_doc = (
  69. """cval : scalar, optional
  70. Value to fill past edges of input if `mode` is 'constant'. Default
  71. is 0.0.""")
  72. _origin_doc = (
  73. """origin : int, optional
  74. Controls the placement of the filter on the input array's pixels.
  75. A value of 0 (the default) centers the filter over the pixel, with
  76. positive values shifting the filter to the left, and negative ones
  77. to the right.""")
  78. _origin_multiple_doc = (
  79. """origin : int or sequence, optional
  80. Controls the placement of the filter on the input array's pixels.
  81. A value of 0 (the default) centers the filter over the pixel, with
  82. positive values shifting the filter to the left, and negative ones
  83. to the right. By passing a sequence of origins with length equal to
  84. the number of dimensions of the input array, different shifts can
  85. be specified along each axis.""")
  86. _extra_arguments_doc = (
  87. """extra_arguments : sequence, optional
  88. Sequence of extra positional arguments to pass to passed function.""")
  89. _extra_keywords_doc = (
  90. """extra_keywords : dict, optional
  91. dict of extra keyword arguments to pass to passed function.""")
  92. _prefilter_doc = (
  93. """prefilter : bool, optional
  94. Determines if the input array is prefiltered with `spline_filter`
  95. before interpolation. The default is True, which will create a
  96. temporary `float64` array of filtered values if `order > 1`. If
  97. setting this to False, the output will be slightly blurred if
  98. `order > 1`, unless the input is prefiltered, i.e. it is the result
  99. of calling `spline_filter` on the original input.""")
  100. docdict = {
  101. 'input': _input_doc,
  102. 'axis': _axis_doc,
  103. 'output': _output_doc,
  104. 'size_foot': _size_foot_doc,
  105. 'mode': _mode_doc,
  106. 'mode_multiple': _mode_multiple_doc,
  107. 'cval': _cval_doc,
  108. 'origin': _origin_doc,
  109. 'origin_multiple': _origin_multiple_doc,
  110. 'extra_arguments': _extra_arguments_doc,
  111. 'extra_keywords': _extra_keywords_doc,
  112. 'prefilter': _prefilter_doc
  113. }
  114. docfiller = doccer.filldoc(docdict)