# [SciPy-User] how can I create B-splines of mutidimensional values?

Zachary Pincus zachary.pincus@yale....
Mon Nov 28 07:30:17 CST 2011

```>> scipy.ndimage.map_coordinates() performs b-spline
>> interpolation of regularly-spaced data
>
> my data are pairs of numbers, like complex numbers.
> I can't see a way of processing them.

The traditional way of interpolating moltivariate data is to do multiple univariate interpolations, as far as I can tell. (E.g. the "thin plate spline" and related literature for defining/manipulating image deformations deals in sparse transforms of (x_old, y_old) -> (x_new, y_new), not unlike what you describe. But all the operations are defined separately for (x_old, y_old) -> x_new and (x_old, y_old) -> y_new, simplifying matters.)

Are you thinking that doing the operations "together" (getting spline coefficients simultaneously for the x and y mapping) would/should somehow yield different coefficients than doing them separately? I've certainly never seen anything like that, but I'm far from an expert on the matter. But, as above, from everything I've seen, you can just do the interpolations separately for x and y, and then knit the results together at the end.

Zach

>> (spline
>> order 0-5, with several options for boundary conditions).
>> The syntax can seem a bit tricky at first, and
>> you need to watch out for ringing artifacts at sharp
>> transitions (as these are interpolating splines),
>> but it should do the trick.
>>
>> Zach
>
> Thanks, Zach, but I tried all the routines in interpolate,
> ndimage and signal, and all of these only seem to use use
> one-dimensional values. Using the routines in ndimage, I
> can easily have a 3D array of floats and interpolate at
> arbitrary 3D coordinates, but this is not what I want.
> I want multidimensional values, not coordinates. My
> coordinates are plain 2D x,y coordinates, but the values
> defined over them are pairs of numbers.
>
> My data would look something like:
>
> (V1,V2) (V1,V2) .... (V1,V2)
> (V1,V2) (V1,V2) .... (V1,V2)
> ...
> (V1,V2) (V1,V2) .... (V1,V2)
>
> (a 2D matrix of pairs)
>
> I'd expect a spline coefficient matrix of the same shape
>
> (C1,C2) (C1,C2) ... (C1,C2)
> (C1,C2) (C1,C2) ... (C1,C2)
> ...
> (C1,C2) (C1,C2) ... (C1,C2)
>
> and, when interpolating at (x,y) I'd like a result
>
> (I0,I1)
>
> (a single pair)
>
> Kay
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

```