coords.Coords.interpolate#
- Coords.interpolate(X, div)#
Create linear interpolations between two
Coords.A linear interpolation of two equally shaped Coords X and Y at parameter value t is a Coords with the same shape as X and Y and with coordinates given by
X * (1.0-t) + Y * t.Parameters#
- X: Coords object
A Coords object with same shape as self.
- div: seed
This parameter is sent through the
arraytools.smartSeed()to generate a list of parameter values for which to compute the interpolation. Usually, they are in the range 0.0 (self) to 1.0 (X). Values outside the range can be used however and result in linear extrapolations.
Returns#
- Coords
A Coords object with an extra (first) axis, containing the concatenation of the interpolations of self and X at all parameter values in div. Its shape is (n,) + self.shape, where n is the number of values in div.
Examples#
>>> X = Coords([0]) >>> Y = Coords([1]) >>> X.interpolate(Y,4) Coords([[0. , 0. , 0. ], [0.25, 0. , 0. ], [0.5 , 0. , 0. ], [0.75, 0. , 0. ], [1. , 0. , 0. ]]) >>> X.interpolate(Y,[-0.1, 0.5, 1.25]) Coords([[-0.1 , 0. , 0. ], [ 0.5 , 0. , 0. ], [ 1.25, 0. , 0. ]]) >>> X.interpolate(Y,(4,0.3,0.2)) Coords([[0. , 0. , 0. ], [0.2077, 0. , 0. ], [0.4747, 0. , 0. ], [0.7533, 0. , 0. ], [1. , 0. , 0. ]])