2013-07-10 45 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

什麼時候可以選擇'線性'超線性'?一個非常簡短的測試顯示'線性'更快,並返回相同的結果。 –