[SciPy-User] spline interpolators silently failing on NaNs

Ralf Gommers ralf.gommers@gmail....
Fri Dec 21 15:33:57 CST 2012


On Thu, Dec 20, 2012 at 3:52 AM, Michael Aye <michael.aye@ucla.edu> wrote:

> Hi,
>
> I was just bitten by something nasty.
> I am fitting some data from pandas, and as pandas deals so
> fantastically with NaNs, I forgot to check myself before handing the
> data over to InterpolatedUnivariateSpline.
> To my surprise and after 2 hours of 'practising' all kinds of
> interpolations, I realised my overlook.
> To my next surprise the creation of the interpolator function did not
> complain a single bit (pun not intented). Just the application of the
> interpolator to the new x-data returned only NaNs.
>
> It is also notable, that griddata had no such problem, but I cannot use
> it because I need extrapolation as well.
>
> Should / Could the spline interpolators maybe check for NaNs and
> complain at their existence?
>

Yes, a check in functions in fitpack2.py for NaNs as well as duplicate
points and monotonicity where applicable would be quite useful.

If anyone would like to have a go at it, that would be great. It wouldn't
be too hard to implement - would be a nice problem to get started with
contributing to scipy perhaps.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20121221/61245c72/attachment-0001.html 


More information about the SciPy-User mailing list