[SciPy-dev] Patch: Add 'insert' method to fitpack.py (in scipy.interpolate)

Zachary Pincus zpincus at stanford.edu
Tue Jan 30 03:02:47 CST 2007


In the fortran fitpack library (aka ddierckx) that underlies  
scipy.interpolate, an insert.f function is provided to insert new  
knots into a given spline.

Attached is a patch which exposes this function to python via the low- 
level fitpack.py interface. This patch properly handles both regular  
and parametric splines, and allows a 'knot multiplicity' to be  
specified so that a given knot can be inserted multiple times (which  
can be handled more efficiently in the c-level code than in python- 
level code).

The inclusion of this function will make it easy to, among other  
things, convert a b-spline into a Bezier curve (useful for plotting  
purposes). (This can be accomplished by inserting new knots at the  
current knot points until each knot has a multiplicity equal to the  
spline degree.)

I hope the patch will prove useful,

Zach Pincus

Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: insert.patch
Type: application/octet-stream
Size: 5891 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20070130/439633c6/attachment.obj 

More information about the Scipy-dev mailing list