OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Replacement for legacy scipy.interpolate.interp1d for piecewise linear interpolation with extrapolation

  • Thread starter Thread starter schtandard
  • Start date Start date
S

schtandard

Guest
The documentation for scipy.interpolate.interp1d tells me

This class is considered legacy and will no longer receive updates. This could also mean it will be removed in future SciPy versions. For a guide to the intended replacements for interp1d see 1-D interpolation.

The linked page basically tells me to use numpy.interp for piecewise linear interpolation. However, as far as I can tell, that function does not support linear extrapolation beyond the data range (only constant extrapolation). This makes it an inadequate replacement where linear extrapolation is desired.

What is the recommended replacement for interp1d in those cases, now that it is no longer recommended for new code?
<p>The documentation for <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html" rel="nofollow noreferrer"><code>scipy.interpolate.interp1d</code></a> tells me</p>
<blockquote>
<p>This class is considered legacy and will no longer receive updates. This could also mean it will be removed in future SciPy versions. For a guide to the intended replacements for <a href="https://docs.scipy.org/doc/scipy/re...late.interp1d.html#scipy.interpolate.interp1d" rel="nofollow noreferrer"><code>interp1d</code></a> see <a href="https://docs.scipy.org/doc/scipy/tutorial/interpolate/1D.html#tutorial-interpolate-1dsection" rel="nofollow noreferrer">1-D interpolation</a>.</p>
</blockquote>
<p>The linked page basically tells me to use <a href="https://numpy.org/devdocs/reference/generated/numpy.interp.html" rel="nofollow noreferrer"><code>numpy.interp</code></a> for piecewise linear interpolation. However, as far as I can tell, that function does not support linear extrapolation beyond the data range (only constant extrapolation). This makes it an inadequate replacement where linear extrapolation is desired.</p>
<p>What is the recommended replacement for <code>interp1d</code> in those cases, now that it is no longer recommended for new code?</p>
 

Latest posts

Top