You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying out the tricubic interpolator, but I have trouble getting it to work. I have constructed the following example:
import numpy as np
import ARBTools
from ARBTools.ARBInterp import tricubic
Nx = 3
Ny = 5
Nz = 7
xc = np.linspace(-1, 1, Nx) # x coordinates
yc = np.linspace(-1, 1, Ny) # y coordinates
zc = np.linspace(-1, 1, Nz) # z coordinates
interpolator_array = np.zeros((Nx*Ny*Nz, 4))
ind = 0
for i in range(Nx):
for j in range(Ny):
for k in range(Nz):
interpolator_array[ind,0] = xc[i]
interpolator_array[ind,1] = yc[j]
interpolator_array[ind,2] = zc[k]
interpolator_array[ind,3] = 1.0 # All input values are 1.0
ind += 1
f = tricubic(interpolator_array)
coords = np.zeros(3)
# Returned interpolated value is 0.0
f.Query(coords)[0]
Here, I pass in a value of 1.0 at all points, but the returned intepolated value at the point (0,0,0) is 0.0, not 1.0.
The text was updated successfully, but these errors were encountered:
Since yesterday, I have been reminded that 3 points isn't enough to create a cubic spline, so of course each dimension has to have at least 4 points. With this change, it works as expected. I suppose a warning about invalid input would be handy.
Hi, I'm extremely sorry that I did not respond to this issue, I didn't get a notification about it - I've only seen it now because I logged in to upload a slightly updated file.
I'm glad you were able to get things working. I'll look into what you report, the interpolator is designed to return "NaN" if you try to query a point outside the valid region. As you say, you need a minimum number of points to make a spline, in the case of the tricubic interpolator this means that we cannot interpolate any value within the outer layer of cuboid volume elements. I'll reproduce your problem and try and incorporate a warning.
Thank you for the bug report!
I'm trying out the tricubic interpolator, but I have trouble getting it to work. I have constructed the following example:
Here, I pass in a value of 1.0 at all points, but the returned intepolated value at the point (0,0,0) is 0.0, not 1.0.
The text was updated successfully, but these errors were encountered: