incline.SavitzkyGolay

class incline.SavitzkyGolay(window_length=15, polyorder=3)[source]

Savitzky-Golay filter: local polynomial least squares on a fixed window.

A fixed convolution, so the derivative operator is available in closed form as well as by probing – the two agree to 1e-15, which makes this the natural cross-check on the probe machinery.

Variables:
  • window_length (int) – Number of points in the window; forced odd.

  • polyorder (int) – Degree of the local polynomial.

Parameters:
  • window_length (int)

  • polyorder (int)

__init__(window_length=15, polyorder=3)
Parameters:
  • window_length (int)

  • polyorder (int)

Return type:

None

Methods

__init__([window_length, polyorder])

analytic_operators(axis, order)

State the smoothing and derivative operators directly, if known.

closed_form_se(axis, order, sigma)

Interior standard error from the filter coefficients directly.

evaluate(axis, y, order)

Filter the series and differentiate.

fit(axis, y[, order, se, noise, ...])

Estimate the trend and, optionally, its uncertainty.

native_posterior(axis, y, order, ...)

Uncertainty from the smoother's own probability model.

operators(axis, order)

The smoothing and derivative operators for this configuration.

params()

Report the window and polynomial order.

scale_of(axis)

Window length as a fraction of the sample.

with_scale(scale, axis)

Set the window to scale of the sample.

Attributes

has_native_posterior

is_linear

Whether the derivative is a fixed linear map of the data.

linear

name

polyorder

requires_regular_grid

supported_orders

window_length

name: ClassVar[str] = 'sgolay'
linear: ClassVar[bool] = True
supported_orders: ClassVar[frozenset[int]] = frozenset({0, 1, 2, 3})
requires_regular_grid: ClassVar[bool] = True
window_length: int = 15
polyorder: int = 3
evaluate(axis, y, order)[source]

Filter the series and differentiate.

Parameters:
  • axis (TimeAxis)

  • y (npt.NDArray[np.float64])

  • order (int)

Return type:

Evaluation

closed_form_se(axis, order, sigma)[source]

Interior standard error from the filter coefficients directly.

Parameters:
  • axis (TimeAxis) – The time axis.

  • order (int) – Derivative order.

  • sigma (float) – Noise standard deviation.

Returns:

The constant interior standard error, broadcast over the series.

Return type:

npt.NDArray[np.float64]

with_scale(scale, axis)[source]

Set the window to scale of the sample.

Parameters:
Return type:

Self

scale_of(axis)[source]

Window length as a fraction of the sample.

Parameters:

axis (TimeAxis)

Return type:

float

params()[source]

Report the window and polynomial order.

Return type:

dict[str, Any]