[Scipy-svn] r4939 - trunk/scipy/interpolate

scipy-svn@scip... scipy-svn@scip...
Sun Nov 2 19:43:00 CST 2008


Author: ptvirtan
Date: 2008-11-02 19:42:49 -0600 (Sun, 02 Nov 2008)
New Revision: 4939

Modified:
   trunk/scipy/interpolate/fitpack.py
Log:
scipy.interpolate: more friendly error message from bisplrep when there are too many data points

Modified: trunk/scipy/interpolate/fitpack.py
===================================================================
--- trunk/scipy/interpolate/fitpack.py	2008-11-03 01:42:26 UTC (rev 4938)
+++ trunk/scipy/interpolate/fitpack.py	2008-11-03 01:42:49 UTC (rev 4939)
@@ -754,8 +754,11 @@
     bx,by=kx*v+ky+1,ky*u+kx+1
     b1,b2=bx,bx+v-ky
     if bx>by: b1,b2=by,by+u-kx
-    lwrk1=u*v*(2+b1+b2)+2*(u+v+km*(m+ne)+ne-kx-ky)+b2+1
-    lwrk2=u*v*(b2+1)+b2
+    try:
+        lwrk1=int32(u*v*(2+b1+b2)+2*(u+v+km*(m+ne)+ne-kx-ky)+b2+1)
+        lwrk2=int32(u*v*(b2+1)+b2)
+    except OverflowError:
+        raise OverflowError("Too many data points to interpolate")
     tx,ty,c,o = _fitpack._surfit(x,y,z,w,xb,xe,yb,ye,kx,ky,task,s,eps,
                                    tx,ty,nxest,nyest,wrk,lwrk1,lwrk2)
     _curfit_cache['tx']=tx



More information about the Scipy-svn mailing list