Filters

class surfalize.filter.GaussianFilter(cutoff, filter_type, endeffect_mode='reflect')

Bases: object

Constructs a Gaussian filter that can be applied on a topography using filter.apply or the __call__ syntax.

Parameters:
cutofffloat

Cutoff wavelength.

filter_type{‘lowpass’, ‘highpass’}

Type of filter to apply. For highpass, simply subtracts the lowpass filtered data from the original data.

endeffect_mode{reflect, constant, nearest, mirror, wrap}, default reflect

The parameter determines how the endeffects of the filter at the boundaries of the data are managed. For details, see the documentation of scipy.ndimage.gaussian_filter. https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.gaussian_filter.html

Methods

__call__(surface[, inplace])

Applied the filter to a Surface object

apply(surface[, inplace])

Applied the filter to a Surface object.

sigma(cutoff)

Calculates the standard deviation of the Gaussian kernel from the cutoff value, considering that the cutoff wavelength should specify the wavelength where the amplitude transmission is reduced to 50%.

Examples

>>> lowpass_filter = GaussianFilter(1, 'lowpass')
>>> filtered_surface = lowpass_filter(original_surface)
apply(surface, inplace=False)

Applied the filter to a Surface object.

Parameters:
surfaceSurface

The surface object on which to apply the filter.

inplacebool, default False

If False, create and return new Surface object with processed data. If True, changes data inplace and return self. Inplace operation is not compatible with mode=’both’ argument, since two surfalize.Surface objects will be returned.

Returns:
filtered_surfaceSurface
static sigma(cutoff)

Calculates the standard deviation of the Gaussian kernel from the cutoff value, considering that the cutoff wavelength should specify the wavelength where the amplitude transmission is reduced to 50%.

Parameters:
cutofffloat

Cutoff wavelength.

Returns:
sigmafloat

Notes

This equation results from solving for the standard deviation when setting the generic Gaussian kernel to the Gaussian kernel defined in the norm.