dcmri.interp#

dcmri.interp(y, x, pos=False, floor=False) ndarray[source]#

Interpolate uniformly sampled data.

This function is a convenience wrapper for standard interpolation, used in dcmri for instance to parametrize non-stationat models.

Parameters:
  • y (array-like) – List of values to interpolate. These are assumed to be uniformly distributed over x.

  • x (array-like) – Interpolate y at these locations.

  • pos (bool, optional) – return only positive values. Defaults to False.

  • floor (bool, optional) – Return only results higher than the lowest value in y. Defaults to False.

Returns:

array of the same length as x, containing the values of y interpolated on x.

Return type:

np.ndarray

Notes

The function uses linear interpolate when y has length 2, quadratic when y has length 3, and cubic spline interpolation otherwise.

Example

>>> import dcmri as dc
>>> dc.interp([1,3,2], np.arange(10))
array([1.        , 1.68888889, 2.23333333, 2.63333333, 2.88888889,
       3.        , 2.96666667, 2.78888889, 2.46666667, 2.        ])