SciPy

scipy.ndimage.filters.generic_filter1d

scipy.ndimage.filters.generic_filter1d(input, function, filter_size, axis=-1, output=None, mode='reflect', cval=0.0, origin=0, extra_arguments=(), extra_keywords=None)[source]

Calculate a one-dimensional filter along the given axis.

generic_filter1d iterates over the lines of the array, calling the given function at each line. The arguments of the line are the input line, and the output line. The input and output lines are 1D double arrays. The input line is extended appropriately according to the filter size and origin. The output line must be modified in-place with the result.

Parameters:

input : array_like

Input array to filter.

function : callable

Function to apply along given axis.

filter_size : scalar

Length of the filter.

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.

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.

extra_arguments : sequence, optional

Sequence of extra positional arguments to pass to passed function

extra_keywords : dict, optional

dict of extra keyword arguments to pass to passed function