Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""Docstring components common to several ndimage functions.""" 

2from scipy._lib import doccer 

3 

4__all__ = ['docfiller'] 

5 

6 

7_input_doc = ( 

8"""input : array_like 

9 The input array.""") 

10_axis_doc = ( 

11"""axis : int, optional 

12 The axis of `input` along which to calculate. Default is -1.""") 

13_output_doc = ( 

14"""output : array or dtype, optional 

15 The array in which to place the output, or the dtype of the 

16 returned array. By default an array of the same dtype as input 

17 will be created.""") 

18_size_foot_doc = ( 

19"""size : scalar or tuple, optional 

20 See footprint, below. Ignored if footprint is given. 

21footprint : array, optional 

22 Either `size` or `footprint` must be defined. `size` gives 

23 the shape that is taken from the input array, at every element 

24 position, to define the input to the filter function. 

25 `footprint` is a boolean array that specifies (implicitly) a 

26 shape, but also which of the elements within this shape will get 

27 passed to the filter function. Thus ``size=(n,m)`` is equivalent 

28 to ``footprint=np.ones((n,m))``. We adjust `size` to the number 

29 of dimensions of the input array, so that, if the input array is 

30 shape (10,10,10), and `size` is 2, then the actual size used is 

31 (2,2,2). When `footprint` is given, `size` is ignored.""") 

32_mode_doc = ( 

33"""mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional 

34 The `mode` parameter determines how the input array is extended 

35 beyond its boundaries. Default is 'reflect'. Behavior for each valid 

36 value is as follows: 

37 

38 'reflect' (`d c b a | a b c d | d c b a`) 

39 The input is extended by reflecting about the edge of the last 

40 pixel. 

41 

42 'constant' (`k k k k | a b c d | k k k k`) 

43 The input is extended by filling all values beyond the edge with 

44 the same constant value, defined by the `cval` parameter. 

45 

46 'nearest' (`a a a a | a b c d | d d d d`) 

47 The input is extended by replicating the last pixel. 

48 

49 'mirror' (`d c b | a b c d | c b a`) 

50 The input is extended by reflecting about the center of the last 

51 pixel. 

52 

53 'wrap' (`a b c d | a b c d | a b c d`) 

54 The input is extended by wrapping around to the opposite edge.""") 

55_mode_multiple_doc = ( 

56"""mode : str or sequence, optional 

57 The `mode` parameter determines how the input array is extended 

58 when the filter overlaps a border. By passing a sequence of modes 

59 with length equal to the number of dimensions of the input array, 

60 different modes can be specified along each axis. Default value is 

61 'reflect'. The valid values and their behavior is as follows: 

62 

63 'reflect' (`d c b a | a b c d | d c b a`) 

64 The input is extended by reflecting about the edge of the last 

65 pixel. 

66 

67 'constant' (`k k k k | a b c d | k k k k`) 

68 The input is extended by filling all values beyond the edge with 

69 the same constant value, defined by the `cval` parameter. 

70 

71 'nearest' (`a a a a | a b c d | d d d d`) 

72 The input is extended by replicating the last pixel. 

73 

74 'mirror' (`d c b | a b c d | c b a`) 

75 The input is extended by reflecting about the center of the last 

76 pixel. 

77 

78 'wrap' (`a b c d | a b c d | a b c d`) 

79 The input is extended by wrapping around to the opposite edge.""") 

80_cval_doc = ( 

81"""cval : scalar, optional 

82 Value to fill past edges of input if `mode` is 'constant'. Default 

83 is 0.0.""") 

84_origin_doc = ( 

85"""origin : int, optional 

86 Controls the placement of the filter on the input array's pixels. 

87 A value of 0 (the default) centers the filter over the pixel, with 

88 positive values shifting the filter to the left, and negative ones 

89 to the right.""") 

90_origin_multiple_doc = ( 

91"""origin : int or sequence, optional 

92 Controls the placement of the filter on the input array's pixels. 

93 A value of 0 (the default) centers the filter over the pixel, with 

94 positive values shifting the filter to the left, and negative ones 

95 to the right. By passing a sequence of origins with length equal to 

96 the number of dimensions of the input array, different shifts can 

97 be specified along each axis.""") 

98_extra_arguments_doc = ( 

99"""extra_arguments : sequence, optional 

100 Sequence of extra positional arguments to pass to passed function.""") 

101_extra_keywords_doc = ( 

102"""extra_keywords : dict, optional 

103 dict of extra keyword arguments to pass to passed function.""") 

104_prefilter_doc = ( 

105"""prefilter : bool, optional 

106 Determines if the input array is prefiltered with `spline_filter` 

107 before interpolation. The default is True, which will create a 

108 temporary `float64` array of filtered values if `order > 1`. If 

109 setting this to False, the output will be slightly blurred if 

110 `order > 1`, unless the input is prefiltered, i.e. it is the result 

111 of calling `spline_filter` on the original input.""") 

112 

113docdict = { 

114 'input': _input_doc, 

115 'axis': _axis_doc, 

116 'output': _output_doc, 

117 'size_foot': _size_foot_doc, 

118 'mode': _mode_doc, 

119 'mode_multiple': _mode_multiple_doc, 

120 'cval': _cval_doc, 

121 'origin': _origin_doc, 

122 'origin_multiple': _origin_multiple_doc, 

123 'extra_arguments': _extra_arguments_doc, 

124 'extra_keywords': _extra_keywords_doc, 

125 'prefilter': _prefilter_doc 

126 } 

127 

128docfiller = doccer.filldoc(docdict)