csaps
CSAPS – Cubic Spline Approximation (Smoothing)
Overview
csaps is a package for univariate, multivariate and nd-gridded data approximation using cubic smoothing splines.
The package provides functionality for computing and evaluating splines and can be useful
in practical engineering tasks for data approximation and smoothing.
Here is an example of the univariate data smoothing:
1import numpy as np
2from csaps import csaps
3
4x = np.linspace(0., 2*np.pi, 25)
5y = np.sin(x) + np.random.randn(25) * 0.3
6xi = np.linspace(x[0], x[-1], 151)
7
8yi = csaps(x, y, xi, smooth=0.8)
Installing
You can install and update csaps using pip:
The module depends only on NumPy and SciPy.
Python 3.6 or above is supported.