2013-07-10 43 views

回答

7

综观scipy/interpolate/interpolate.py源, slinear是为了1

if kind in ['zero', 'slinear', 'quadratic', 'cubic']: 
    order = {'nearest': 0, 'zero': 0,'slinear': 1, 
      'quadratic': 2, 'cubic': 3}[kind] 
    kind = 'spline' 

一个spline ...

if kind in ('linear', 'nearest'): 
    # Make a "view" of the y array that is rotated to the interpolation 
    # axis. 
    minval = 2 
    if kind == 'linear': 
     self._call = self._call_linear 
    elif kind == 'nearest': 
     self.x_bds = (x[1:] + x[:-1])/2.0 
     self._call = self._call_nearest 
else: 
    minval = order + 1 
    self._call = self._call_spline 
    self._spline = splmake(x, y, order=order) 

由于文档为splmake状态:

def splmake(xk, yk, order=3, kind='smoothest', conds=None): 
    """ 
    Return a representation of a spline given data-points at internal knots 
    ... 
+0

你打败了我。我想出了相同的结论。 –

+3

@NilsWerner尽管如果我们两个都不得不求助于源代码,但这是文档不完整的一个很好的指示。 – Hooked

+4

什么时候可以选择'线性'超线性'?一个非常简短的测试显示'线性'更快,并返回相同的结果。 –