2014-11-24 122 views
0

我正在使用scipy的interpolate包。在splprep函數的文檔中,它表示在返回值中,還有包含樣條擬合殘差的變量「fp」。 http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.splprep.html從scipy.interpolate.splprep()獲取樣條擬合殘差()

我不知道如何檢索fp值,因爲我無法用多於兩個返回變量調用該函數。

下面是一些示例代碼,我使用:

from scipy import interpolate 
[tck_poly, u] = interpolate.splprep([[1.,2.,3.,4.,5.]]) 

有誰知道如何得到這個殘留或者其他簡單的方法來確定合適的質量?

回答

2

指定full_output=True

(tck, u), fp, ier, msg = interpolate.splprep([[1.,2.,3.,4.,5.]], full_output=True) 
+0

感謝這個簡單的辦法。下次我更仔細地閱讀文檔;) – user1984653 2014-11-24 15:42:39