frites.utils.savgol_filter#

frites.utils.savgol_filter(x, h_freq, axis=None, sfreq=None, polyorder=5, verbose=None)[source]#

Filter the data using Savitzky-Golay polynomial method.

This function is an adaptation of the mne-python one for xarray.DataArray.

Parameters
xnumpy:array_like

Multidimensional array or DataArray

h_freqpython:float

Approximate high cut-off frequency in Hz. Note that this is not an exact cutoff, since Savitzky-Golay filtering is done using polynomial fits instead of FIR/IIR filtering. This parameter is thus used to determine the length of the window

axispython:int, python:str | python:None

Position of the time axis. Can either be an integer when x is a NumPy array or a string (e.g ‘times’) when using a DataArray

polyorderpython:int | 5

Polynomial order

Returns
x_filtnumpy:array_like

Filtered data

See also

kernel_smoothing

Notes

For Savitzky-Golay low-pass approximation, see:

https://gist.github.com/larsoner/bbac101d50176611136b