spiketools.utils.data.smooth_data¶
- spiketools.utils.data.smooth_data(data, sigma)[source]¶
Smooth an array of data, using a gaussian kernel.
- Parameters:
- datandarray
Data to smooth.
- sigmafloat
Standard deviation of the gaussian kernel to apply for smoothing.
- Returns:
- data2d array
The smoothed data.
Notes
This function is applied on a copy of the data (to not change the original). Any NaN values will be set as 0 for smoothing purposes.
Examples
Smooth a 1d data array using a gaussian kernel:
>>> data = np.array([1, 3, 5, 7, 9]) >>> smooth_data(data, sigma=0.8) array([1, 3, 5, 6, 8])