# Scipy Function as Node (sverchok addon)

I am trying to use the scipy.interpolate.interpn function within blender. I assumed the only way to do this is to utilize the sverchok addon, so my first attempt at using this function is with the sverchok addon, but let me know if there is a better way to do this.

Although I have some basic knowledge of python, I think I am a bit out of my depth here. Nonetheless, I tried writing a script to use with the Scripted Node Lite node in sverchok:

"""
in in_points v
in values s
in xi v
out out_values s
"""

import numpy as np
import sys

from sverchok.utils.logging import exception, info
from sverchok.data_structure import zip_long_repeat

try:
import scipy
from scipy.interpolate import interpn
except ImportError as e:
info("SciPy module is not available. Please refer to https://github.com/nortikin/sverchok/wiki/Non-standard-Python-modules-installation for how to install it.")
raise e

out_values = []

for everypoint in xi:
new_values = interpn(points, values, xi, method='linear', bounds_error=True, fill_value=0)

out_values.append(new_values)


Here is what I get when I try to use the script as a scripted node in blender:

error screenshot

here are the files I am working with: https://drive.google.com/file/d/1a2a0l3rghzAbP91JEAb-mZXQZYpiLEsG/view?usp=sharing

If anyone could help me utilize this function in blender, or have any improvements for the script above, I would greatly appreciate it! Thanks,

• NameError: name 'points' is not defined. You can use simply Blender text editor for creating and executing your script. I don't see why it should be done in Sverchok. Mar 30 '21 at 4:32

use the value slider on the LERP node to Linearly Interpolate between the lists of coordinates. Feel free to ask questions about this, but I don't think this requires SNLite unless you really want to use code.
set up your points, point and values as numpy arrays, and ignore SNLite until you can make it work purely from the TextEditor evaluation/execution. Once you know what python to write, converting the script to something that can be loaded into SNLite is trivial.