Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Euclidean Coordinates #27

Open
0xJustin opened this issue Feb 28, 2024 · 0 comments
Open

Using Euclidean Coordinates #27

0xJustin opened this issue Feb 28, 2024 · 0 comments

Comments

@0xJustin
Copy link

Hi- your interpolation library is one of the fastest around with the C++ implementation. I was hoping to use some of these functions for a project where I have a large shape=(1540, 1049, 521) array with scattered data of 3D vectors (~10,000 scattered points). Your functions work very quickly, but the casting to spherical coordinates is throwing off my results! Is there a manual way around this? I see the system parameter for Rtree, but I'm having a hard time figuring out what the valid options are.
Thanks for your time!

Here is my code snippet- force_locations is an mx3 array, where m is the number of scattered data

import pyinterp
field = np.zeros((vessel_seg.shape[0], vessel_seg.shape[1], vessel_seg.shape[2], 3))
n, p, q = vessel_seg.shape

print("Interpolating IDW")
mesh_x = pyinterp.RTree()

mesh_x.packing(force_locations[:], force_displacements[:, 0])

mx, my, mz = np.meshgrid(np.arange(n),
np.arange(p),
np.arange(q))
# indexing='ij')

coords = np.vstack((mx.ravel(), my.ravel(), mz.ravel())).T

rbf_x, neighbors = mesh_x.radial_basis_function(
coords,
within=False,
k=19,
rbf='cubic',
# smooth=1e-4,
num_threads=0)
field[coords[:, 0], coords[:, 1], coords[:, 2], 0] = rbf_x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant