I'm looking for a way to create a "functor" for linear interpolation of time,value pairs using SciPy (or NumPy) but according to the SciPy tutorial there is none! (Kind of the opposite of Trying to understand scipy and numpy interpolation)
The natural method would be interp1d but that has a warning:
Legacy This class is considered legacy and will no longer receive updates. […] For a guide to the intended replacements for interp1d see 1-D interpolation.
Following the link takes me to a page that tells me:
If all you need is a linear (a.k.a. broken line) interpolation, you can use the numpy.interp routine.
The problem is, these are not at all equivalent. numpy.interp requires me to know the points beforehand, and does not return a function that can be used to look up the interpolated values.
Meanwhile, SciPy has a number of other interpolation methods that all return a function (or a function object) such as CubicSpline or PchipInterpolator.
What's the easy way to construct a function or object similar to what PchipInterpolator returns, but for simple linear interpolation now that interp1d is deprecated?
You can use
scipy.interpolate.make_interp_splinewithk=1for linear interpolation.