Open shusheer opened 3 years ago
Commented in the scipy issue. Basically, CubicSpline only guarantees the value of derivatives at the boundary, and its extrapolation mode may be not very useful. However it provides all the info for a user to do the extrapolation, and it needs to be taken care of by the user.
csaps.CubicSmoothingSpline purports to perform extrapolation using the "natural" boundary condition.
From https://github.com/espdev/csaps/blob/master/docs/formulation.rst: "csaps spline is cubic only and it has natural boundary condition type."
This means the first derivative should be constant outside the range of observations provided to the smoother. This is not currently the behaviour.
Note that the scipy.interpolate.CubicSpline also exhibits the same behaviour, even when we explicitly specify bc_type='natural'
Example code to test:
I believe this issue is a superset of Issue #46 (periodic functions) wherein csaps.CubicSmoothingSpline._make_spline does not take account of boundary condition.