gaussian_smooth#

UniformGrid.gaussian_smooth(radius_factor=1.5, std_dev=2.0, scalars=None, progress_bar=False)#

Smooth the data with a Gaussian kernel.

Parameters
radius_factorfloat or iterable, optional

Unitless factor to limit the extent of the kernel.

std_devfloat or iterable, optional

Standard deviation of the kernel in pixel units.

scalarsstr, optional

Name of scalars to process. Defaults to currently active scalars.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.UniformGrid

Uniform grid with smoothed scalars.

Notes

This filter only supports point data. Consider converting any cell data to point data using the DataSet.cell_data_to_point_data() filter to convert any cell data to point data.

Examples

First, create sample data to smooth. Here, we use pyvista.perlin_noise() to create meaningful data.

>>> import numpy as np
>>> import pyvista
>>> noise = pyvista.perlin_noise(0.1, (2, 5, 8), (0, 0, 0))
>>> grid = pyvista.sample_function(noise, [0, 1, 0, 1, 0, 1], dim=(20, 20, 20))
>>> grid.plot(show_scalar_bar=False)
../../../_images/pyvista-UniformGrid-gaussian_smooth-1_00_00.png

Next, smooth the sample data.

>>> smoothed = grid.gaussian_smooth()
>>> smoothed.plot(show_scalar_bar=False)
../../../_images/pyvista-UniformGrid-gaussian_smooth-1_01_00.png

See Gaussian Smoothing for a full example using this filter.