This may be a tall order, but here's what I need to be able to do...I will be given some scattered data in three dimensions (x,y,z). The end goal is to be able to have f(x,y) functions for each point on the surface. For example, given a coordinate (x,y) contained within the convex hull of the data, I would like the program to spit out f(x,y) = ax^3 + bx^2 + cx + dy^3 + ey^2 +fy + g, a bicubic function that fits the interpolated data at that point. This lead me to explore bicubic B-splines and splines in general.
I have been using SmoothBivariateSpline in the spicy.interpolate library to get the interpolated data, but I do not know where to go from here. I would like to throw out the end step all together and go straight to the intermediate step where the spline interpolation fits functions to each interval. So...I would write a program that, given a coordinate, finds out which interval it is contained in and returns a function, f(x,y), which describes the surface in that interval. Is this possible?
Cheers!
My first point is that you actually have scattered data (z) on two dimensions (x and y), if I understand you correctly.
Yes, of course!
You could simply do the maths yourself (the bivariate spline might not be the most beautiful interpolation with respect to formula, but it's still somewhat manageable), or you could just get a list of coefficients, by calling
get_coeffs()
on theSmoothBivarianteSpline
you've created. That will give you a surface-describing set of coefficients. I think the easiest way to understand the meaning of those is pointing you at the source code, so here you go; important artx
,ty
andc
.