Model description¶
From a given set of d-dimensional (d=1-3) data points, a cubic spline representation is calculated with 4^d coefficients per d-dimensional data interval. The spline model function will take exactly the value of the data points and the end condition is that 1st and 2nd derivative of the spline model function is zero at the end points (and outside the spline will be extrapolated by constant values, i.e. the nearest data values). As reference the Wolfram Mathworld page on Cubic splines as well as the Python implementation of cubic splines by the ZhuangLab were used.
The cubic spline representation uses the logical spacing of the data (i.e. the interval lengths are all one) with indexing starting at 0. Please take care to translate the spline interval coordinates to your real x,y,z coordinates yourself. In the following the spline model functions for d=1-3 dimensions is given explicitly. The spline model is fully characterized by the set of spline coefficients \(S_{..}\).
1D Spline model¶
The 1D spline model with coefficients \(S_{i, m}\) with \(i\) specifying the spline interval and \(m\) (=0-3) specifying the polynomial order is given by:
Each interval is represented by 4 coefficients \(S_{i,:}\). The positions \(t_i\) specify the left borders of the spline interval \(i\) and \(\Delta t_i\) is its size. Here \(t_i\) goes from 0 to N-1 for N data points and \(\Delta t_i\) equals 1.
2D Spline model¶
The 2D spline model with coefficients \(S_{i, j, m, n}\) with \((i,j)\) specifying the spline interval in 2D and \((m, n)\) (=0-3) specifying the polynomial orders in x and y is given by
Each interval is represented by 16 coefficients \(S_{i,j,:,:}\). The positions \((t_i, u_j)\) specify the left borders of the spline interval \((i, j)\) and \((\Delta t_i, \Delta u_j)\) is its size in x and y. Here \((t_i, u_j)\) goes from (0,0) to (N-1, M-1) for NxM data points and \((\Delta t_i, \Delta u_j)\) equals (1,1).
3D Spline model¶
The 3D spline model with coefficients \(S_{i, j, k, m, n, o}\) with \((i, j, k)\) specifying the spline interval in 3D and \((m, n, o)\) (=0-3) specifying the polynomial orders in x, y and z is given by
Each interval is represented by 64 coefficients \(S_{i,j,k,:,:,:}\). The positions \((t_i, u_j, v_k)\) specify the left borders of the spline interval \((i, j, k)\) and \((\Delta t_i, \Delta u_j, \Delta v_k)\) is its size in x, y and z. Here \((t_i, u_j, v_k)\) goes from (0,0,0) to (N-1, M-1, K-1) for NxMxK data points and \((\Delta t_i, \Delta u_j, \Delta v_k)\) equals (1,1,1).