eelbrain.NDVar.smooth¶

NDVar.
smooth
(self, dim, window_size=None, window='hamming', mode='center', window_samples=None, fix_edges=False, name=None)¶ Smooth data by convolving it with a window
Parameters:  dim : str
Dimension along which to smooth.
 window_size : scalar
Size of the window (in dimension units, i.e., for time in seconds). For finite windows this is the full size of the window, for a gaussian window it is the standard deviation.
 window : str  tuple
Window type, input to
scipy.signal.get_window()
. For example ‘boxcar’, ‘triang’, ‘hamming’ (default). For dimensions with irregular spacing, such asSourceSpace
, onlygaussian
is implemented. mode : ‘left’  ‘center’  ‘right’  ‘full’
Alignment of the output to the input relative to the window:
left
: sample in the output corresponds to the left edge of the window.center
: sample in the output corresponds to the center of the window.right
: sample in the output corresponds to the right edge of the window.full
: return the full convolution. This is only implemented for smoothing time axis.
 window_samples : scalar
Size of the window in samples (this parameter is used to specify window size in array elements rather than in units of the dimension; it is mutually exclusive with
window_size
). fix_edges : bool
Standard convolution smears values around the edges resulting in some data loss. The
fix_edges
option renormalizes the smoothing window when it overlaps an edge to make sure thatx.smooth('time').sum('time') == x.sum('time')
. Only implemented formode='center'
). name : str
Name for the smoothed NDVar.
Returns:  smoothed_ndvar : NDVar
NDVar with identical dimensions containing the smoothed data.
Notes
To perform Gaussian smoothing with a given full width at half maximum, the standard deviation can be calculated with the following conversion:
>>> std = fwhm / (2 * (sqrt(2 * log(2))))