Python Forum
numpy.interp - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: numpy.interp (/thread-8979.html)



numpy.interp - silverfish - Mar-15-2018

Hi :)
I'd like to know if someone knows how to translate these linecodes from scilab into Python:

Var1=splin(x,y)
Var2=interp(p,x,y,Var1);

Because I think we can't interpolate "Var1" which is already an interpolation..

Thank you Smile


RE: numpy.interp - Larz60+ - Mar-15-2018

The = sign is an operator that tells the interpreter to execute the statements on the right and use the result store (or use) computed on the left. Note that once the value is passed to the left, the method of how it got there can be discarded. There is still data in the python call stack that saves some of the information. If you have further interest in how this works, see: https://python-forum.io/Thread-Walking-the-python-call-stack-without-leaks?highlight=call+stack
Also, please note that once the statement on the left has taken control, the data in the call stack on the right is eligible for garbage collection and may not be there for long. It is safe to use for non important processes (like error traceback operations) if used immediately) .