just a note to mention that it seems that the docstring on interp1d is not quite correct: it states that NaN is returned if bounds_error=0. this is not quite true, as you can set fill_value (not mentioned in docstring but evident in code). if x and y are both int arrays, it does not seem to return NaN...
import scipy.interpolate import numpy as N
x=N.arange(20) f=scipy.interpolate.interp1d(x,x,bounds_error=0, fill_value=0.) print f(30) [0]
g=scipy.interpolate.interp1d(x,x,bounds_error=0) print g(30), N.isnan(g(30)) [-2147483648] [False]
X=N.arange(0,20.) h=scipy.interpolate.interp1d(X,X,bounds_error=0) print h(30) [ nan]
X=N.arange(0,20.) i=scipy.interpolate.interp1d(X,x,bounds_error=0) print i(30) [ nan]
X=N.arange(0,20.) j=scipy.interpolate.interp1d(x,X,bounds_error=0) print j(30) [ nan]
-- ------------------------------------------------------------------------ I'm part of the Team in Training: please support our efforts for the Leukemia and Lymphoma Society! http://www.active.com/donate/tntsvmb/tntsvmbJTaylor GO TEAM !!! ------------------------------------------------------------------------ Jonathan Taylor Tel: 650.723.9230 Dept. of Statistics Fax: 650.725.8977 Sequoia Hall, 137 www-stat.stanford.edu/~jtaylo 390 Serra Mall Stanford, CA 94305
participants (1)
-
Jonathan Taylor