1

I'm using interp1d in python. I need to interpolate data and I use this code:

fup = interp1d(up_x, up, 'cubic')  
up = fup(x)

where up_x, up have a lenght of 36, x lenght is 240. But I receive this error:

File "D:\Documents\LaserInn\NN_py_algoritmo\envelope.py", line 116, in envelope
up = fup(x)

File "C:\Program Files\Anaconda3\lib\site-packages\scipy\interpolate\polyint.py", line 79, in __call__
y = self._evaluate(x)

File "C:\Program Files\Anaconda3\lib\site-packages\scipy\interpolate\interpolate.py", line 477, in _evaluate
out_of_bounds = self._check_bounds(x_new)

File "C:\Program Files\Anaconda3\lib\site-packages\scipy\interpolate\interpolate.py", line 504, in _check_bounds
raise ValueError("A value in x_new is below the interpolation "

ValueError: A value in x_new is below the interpolation range.

What mean this error? I think the different lenght of up and up_x with x is not a problem.

Giuseppe Ricci
  • 317
  • 8
  • 20
  • See this question: http://stackoverflow.com/questions/11851770/spline-interpolation-with-python – Andrey Sobolev Sep 11 '15 at 11:01
  • `interp1d` will only allow you to *inter*polate, not to *extra*polate. Hence, all values of `x` must be in the interval `[min(up_x), max(up_x)]`. – Daniel Lenz Sep 11 '15 at 11:36

0 Answers0