# scipy.ndimage.maximum_filter1d¶

scipy.ndimage.maximum_filter1d(input, size, axis=-1, output=None, mode='reflect', cval=0.0, origin=0)[source]

Calculate a one-dimensional maximum filter along the given axis.

The lines of the array along the given axis are filtered with a maximum filter of given size.

Parameters: input : array_like Input array to filter. size : int Length along which to calculate the 1-D maximum. axis : int, optional The axis of input along which to calculate. Default is -1. output : array, optional The output parameter passes an array in which to store the filter output. Output array should have different name as compared to input array to avoid aliasing errors. 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.0. maximum1d : ndarray, None Maximum-filtered array with same shape as input. None if output is not None

Notes

This function implements the MAXLIST algorithm [R181], as described by Richard Harter [R182], and has a guaranteed O(n) performance, n being the input length, regardless of filter size.

References

Examples

>>> from scipy.ndimage import maximum_filter1d
>>> maximum_filter1d([2, 8, 0, 4, 1, 9, 9, 0], size=3)
array([8, 8, 8, 4, 9, 9, 9, 9])


#### Previous topic

scipy.ndimage.maximum_filter

#### Next topic

scipy.ndimage.median_filter