Scipy: BivariateSpline errors with kx=ky=1 (Trac #1642)

Created on 25 Apr 2013  路  5Comments  路  Source: scipy/scipy

_Original ticket http://projects.scipy.org/scipy/ticket/1642 on 2012-04-14 by @rgommers, assigned to unknown._

This warning was showing up by default for a long time. The cause seems to be that the optional nxest/nyest parameters to surfit, which are determined in fitpack.pyf, are too small if kx=ky=1.

    >>> x = [1,1,1,2,2,2,4,4,4]
    >>> y = [1,2,3,1,2,3,1,2,3]
    >>> z = array([0,7,8,3,4,7,1,3,4])
    >>> lut = SmoothBivariateSpline(x, y, z, kx=1, ky=1, s=0)
/Users/rgommers/Code/scipy/scipy/interpolate/fitpack2.py:613: UserWarning: 
The required storage space exceeds the available storage space: nxest
or nyest too small, or s too small.
The weighted least-squares spline corresponds to the current set of
knots.
  warnings.warn(message)

This needs some investigation. I'll filter out the warning for now.

A likely related problem:

In [3]: %paste
        x = [1,1,1,2,2,2,3,3,3]
        y = [1,2,3,1,2,3,1,2,3]
        z = [0,7,8,3,4,7,1,3,4]
        s = 0.1
        tx = [1+s,3-s]
        ty = [1+s,3-s]
        lut = LSQBivariateSpline(x,y,z,tx,ty,kx=1,ky=1)
## -- End pasted text --
/Users/rgommers/Code/scipy/scipy/interpolate/fitpack2.py:684: UserWarning: 
The coefficients of the spline returned have been computed as the
minimal norm least-squares solution of a (numerically) rank deficient
system (deficiency=7). If deficiency is large, the results may be
inaccurate. Deficiency may strongly depend on the value of eps.
  warnings.warn(message)
Migrated from Trac defect prio-normal scipy.interpolate

Most helpful comment

All 5 comments

I ran into this error in bisplrep as well. It went away when I correctly set parameter task=-1 to use knots of my choosing. I can try to reproduce if it would be helpful.

Sure, a failing code snippet would help whoever is going to inverstigate (and fix) this.

Duplicate issue with a self-contained example: gh-4138

Is there a solution to this issue by now, which I did not find? If so, might it be possible to link? I ran into trouble when using interp2d with linear interpolation and it seems to be the same issue. I considered the bug as servere, since wrong values are returned, which might not be obvious in all cases.

Was this page helpful?
0 / 5 - 0 ratings