[SciPy-User] interp1d and out of bounds values

denis denis-bz-gg@t-online...
Thu Jan 28 06:04:50 CST 2010



On Jan 22, 6:17 pm, Thomas Robitaille <thomas.robitai...@gmail.com>
wrote:
> Hello,
>
> I've been using scipy.interpolate.interp1d to interpolate values in a number of different projects. However, something I often need is the following: if the interpolating function is defined as f(x) from xmin to xmax, if I specify an x value smaller than xmin, I would like the value set to f(xmin), and if the value is above xmax, I would like the value set to xmax.

Thomas,
  interp1d( np.clip(x, xmin, xmax), y )  ?
cheers
  -- denis



More information about the SciPy-User mailing list