I was trying to calculate the curvature of a surface given by array of points (x,y,z). Initially I was trying to fit a polynomial equation z=a + bx + cx^2 + dy + exy + fy^2)
BSD-licensed Python source code for surface fits can be found at
https://github.com/zunzun/pyeq2
(I'm the author).