- nearestNeighbour
- nearest neighbour
- linear
- linear
- cubic
- cubic
- spline
- cubic spline
Interpolation can be done using the following methods:
The abscissa must be a simple type (scalar value) that can be ordered. ie. an uInt, Int, Float or Double (not Complex). The ordinate can be an Array of any data type that has addition, and subtraction defined as well as multiplication by a scalar of the abcissa type. So the ordinate can be complex numbers, where the interpolation is done separately on the real and imaginary components. Use of Arrays as the the Range type is discouraged, operations will be very slow, it would be better to construct a single higher dimensional array that contains all the data.
Note: this class (and these docs) are heavily based on the Interpolate1D class in aips/Functionals. That class proved to be too slow for interpolation of large data volumes (i.e. spectral line visibility datasets) mainly due to the interface which forced the creation of large numbers of temporary Vectors and Arrays. This class is 5-10 times faster than Interpolate1D in cases where large amounts of data are to be interpolated.
Vector<Float> xin(4); indgen(xin); Vector<Double> yin(4); indgen(yin); yin = yin*yin*yin; Vector<Float> xout(20); for (Int i=0; i<20; i++) xout(i) = 1 + i*0.1; Vector<Double> yout; InterpolateArray1D<Float, Double>::interpolate(yout, xout, xin, yin, InterpolateArray1D<Float,Double>::cubic);
deprecated version of previous function using Blocks - no longer needed now that Vector has a fast index operator [].
Interpolate in the last dimension of array yin whose x coordinates along this dimension are given by xin. Output array yout has interpolated values for x coordinates xout. This version handles flagged data in a simple way: all outputs depending on a flagged input are flagged. If goodIsTrue==True, then that means a good data point has a flag value of True (usually for visibilities, good is False and for images good is True) If extrapolate==False, then xout points outside the range of xin will always be marked as flagged. TODO: implement flags for cubic and spline (presently input flags are copied to output).
deprecated version of previous function using Blocks - no longer needed now that Vector has a fast index operator [].
Interpolate the y-vectors of length ny from x values xin to xout. Take flagging into account
Interpolate the y-vectors of length ny from x values xin to xout using polynomial interpolation with specified order.