spline¶
- sofia_redux.toolkit.interpolate.interpolate.spline(x, y, xout, sigma=1.0)[source]¶
Perform cubic spline (tensioned) interpolation
Replicates IDL spline function. There are no standard Python Libraries that do this. This function fits the input points exactly allowing flexibility between the points where the “tension” of the fit is determined by sigma.
- Parameters:
- xarray_like of float (N,)
Independent values. Values MUST be monotonically increasing
- yarray_like of float (N,)
Dependent values.
- xoutfloat or array_like of float (M,)
New Independent values
- sigmafloat, optional
The amount of “tension” that is applied to the curve. The default value is 1.0. If sigma is close to 0, (e.g., 0.01), then effectively there is a cubic spline fit. If sigma is large, (e.g., greater than 10), then the fit will be like a polynomial interpolation
- Returns:
- youtfloat or numpy.ndarray of float (M,)
y
interpolated atxout
.
Notes
Author: Walter W. Jones, Naval Research Laboratory, Sept 26, 1976. Reviewer: Sidney Prahl, Texas Instruments. Adapted for IDL: DMS, March, 1983. CT, RSI, July 2003: Added double precision support and DOUBLE keyword, use vector math to speed up the loops. CT, RSI, August 2003: Must have at least 3 points. Adapted for Python: Dan Perera (USRA), April, 2019