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__(topography[, inplace])

Applies the filter to a Surface or Profile object.

apply(topography[, inplace])

Applies the filter to a Surface or Profile 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(topography, inplace=False)

Applies the filter to a Surface or Profile object.

Parameters:
topographySurface | Profile

The surface or profile object on which to apply the filter.

inplacebool, default False

If False, create and return new object with processed data. If True, changes data inplace and return self.

Returns:
filtered_topographySurface | Profile
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.