Search code examples
pythonscipytime-seriesfilteringsmoothing

Some doubts about the parameters of the savgol_filter function from scipy.signal


I was reading the documentation of scipy.signal.savgol_filter from

https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.signal.savgol_filter.html

and I have doubts with the parameters deriv and delta defined in the extract below:

deriv : int, optional

The order of the derivative to compute. This must be a nonnegative integer. The default is 0, which means to filter the data without differentiating.

delta : float, optional

The spacing of the samples to which the filter will be applied. This is only used if deriv > 0. Default is 1.0.

Regarding the parameter deriv=0: Does it mean that when deriv=0 the function provides a smooth version of the original data and when deriv=1 the function provides a smooth version of the first derivative of the original data?

Regarding the parameter delta: Does it mean that the function scipy.signal.savgol_filter only works for evenly sampled data?


Solution

  • As the author of that code, I can definitively say: yes and yes.