Interpolating in three dimensions
Fabian Gittins via SciPy-Dev <[email protected]> Wed, 05 Jul 2023 18:28:35 -0000
| Newsgroups | gmane.comp.python.scientific.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear all, Recently in my work, I needed to interpolate some data in three dimensions. In principle, I could have used the existing feature "scipy.interpolate.interpn" for this. However, I had quite specific needs, such as requiring the first partial derivatives of the resultant interpolated function. I came across this paper (http://www.cds.caltech.edu/~marsden/bib/2005/08-LeMa2005/LeMa2005.pdf), which describes (local) tricubic interpolation in three dimensions that is continuous in the function and its first derivatives. The basic idea is as follows. Suppose I want to evaluate a function f at a position (x, y, z). The interpolator then finds the cube element in the provided grid where this position sits. This cube has 8 corners where f is known from the provided data. Using this information (and finite differences for derivatives), one obtains the coefficients (64 in total) of an assumed (tricubic) polynomial function. I have put together a Python implementation of this scheme, which only relies on the NumPy library (https://github.com/fgittins/tricubic). Being a long(ish)-term user of SciPy, I thought I would reach out to see if such a interpolator would be of use to others. Feel free to share your thoughts and let me know if such a feature would be useful. Fabian _______________________________________________ SciPy-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/scipy-dev.python.org/ Member address: [email protected]