[SciPy-user] scipy.interpolate.Rbf() MemoryError for more than 4000 (x, y) pairs ?

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Apr 3 12:22:26 EDT 2009


On Fri, Apr 3, 2009 at 11:40 AM, Jim Vickroy <Jim.Vickroy at noaa.gov> wrote:
> Hello Group,
>
> I'm a radial basis functions novice so I may be making a mistake; however,
> it seems that scipy.interpolate.Rbf() can handle a maximum of ~4000 (x,y)
> points.  Is that correct?
>
> Here is a sample output from the attached script (rbf-demo.py) for 5000
> (x,y) points:
>
> <output>
> DOS>rbf-demo.py
> Python version: 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
> (Intel)]
> numpy version:  1.2.1
> scipy version:  0.7.0
> multiquadric         in-painting required 200 seconds for 5000 points
> Traceback (most recent call last):
> File "rbf-demo.py", line 28, in <module>
>  rbf   = scipy.interpolate.Rbf(x, y, z, function=function)
> File "C:\Python25\lib\site-packages\scipy\interpolate\rbf.py", line 132, in
> __init__
>  r = self._call_norm(self.xi, self.xi)
> File "C:\Python25\lib\site-packages\scipy\interpolate\rbf.py", line 147, in
> _call_norm
>  return self.norm(x1, x2)
> File "C:\Python25\lib\site-packages\scipy\interpolate\rbf.py", line 100, in
> _euclidean_norm
>  return sqrt( ((x1 - x2)**2).sum(axis=0) )
> MemoryError
>
> DOS>
> </output>
>
> Thanks,
> -- jv
>
> P.S.
> I'm considering using Rbf to replace a horizontal band of bad-pixel values
> in 512x512 images obtained from a damaged detector.
>


Besides the memory error, I don't think rbf can do this, rbf uses all
points to do the interpolation, the kernel is number of observation
squared. In some examples, that I tried, if the number of points is to
large, then you don't get a smooth solution, the interpolation has too
much variation (like fitting a very high order polynomial).

>From my experimentation with rbf, it only works well with a small
number of points, so the best is to run rbf on a local neighborhood of
the missing points.

For 1d, I have the script somewhere but I never tried the 2d version.

Josef



More information about the SciPy-User mailing list