pyrtid.utils.spatial_filters.GaussianFilter#

class pyrtid.utils.spatial_filters.GaussianFilter(sigmas: Union[float, Sequence[Union[float, Sequence[float]]]], order: int = 0, mode: Literal['reflect', 'constant', 'nearest', 'mirror', 'wrap'] = 'reflect', cval: float = 0, truncate: float = 4.0)[source]#

Bases: Filter

Apply gaussian filter filtering.

See https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.filters.gaussian_filter.html

Attributes
  • sigmas (float, sequence of scalar or sequence of scalars) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes. If a float is provided, the value is taken for each filtering. If a list is provided, then the values are taken in the list depending on the iteration index (see filter method).

  • order ({0, 1, 2, 3} or sequence from same set, optional) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. An order of 1, 2, or 3 corresponds to convolution with the first, second or third derivatives of a Gaussian. Higher order derivatives are not implemented. The default is 0.0.

  • 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

  • truncate (float) – Truncate the filter at this many standard deviations. Default is 4.0.

__init__(sigmas: Union[float, Sequence[Union[float, Sequence[float]]]], order: int = 0, mode: Literal['reflect', 'constant', 'nearest', 'mirror', 'wrap'] = 'reflect', cval: float = 0, truncate: float = 4.0) None#

Methods definition

filter(param: ndarray[Any, dtype[float64]], iteration: int) ndarray[Any, dtype[float64]][source]#

Apply a gaussian smoothing to the given values.

Parameters
  • param (NDArrayFloat) – Values to filter.

  • iteration (int) – Iteration number knowing that iterations start at 1 (and not at zero).

Returns

Filtered values.

Return type

NDArrayFloat