[SciPy-User] Bivariate Spline Surface Fitting
Fri Nov 27 08:08:01 CST 2009
On Fri, Nov 27, 2009 at 5:42 AM, Peter Combs <firstname.lastname@example.org> wrote:
> On Nov 26, 2009, at 4:30 PM, David Baddeley wrote:
>> Hi Peter,
>> would that be localization microscopy data by any chance? Which method are you using?
> Indeed it is! The lab I'm working in does a lot of FIONA (Fluorescence Imaging with One Nanometer Accuracy), although the data I'm using is a couple steps removed from the usual assays that are done.
> On Nov 26, 2009, at 8:03 PM, email@example.com wrote:
>> knots should only specify the point of x and y not all grid points, I
>> added an s to play with the border values following the example in the
>> tests. most of it just trial and error, since I don't have a good
>> example of what I should get as a result
> Thanks, that pretty much did it, I think. I'm still playing with the number of knots to see what gives reasonable results. Taking it up to 75 brings my error down to under 4 nm, which is starting to get to the limit of what we could do in one channel anyways.
>> with the following knots, it finishes without warning and errors, and
>> I get some numbers back that might be reasonable.
> Now I'm getting this warning, but given that the results are very usable, I'm not too worried:
> The coefficients of the spline returned have been computed as the
> minimal norm least-squares solution of a (numerically) rank deficient
> system (deficiency=92). If deficiency is large, the results may be
> inaccurate. Deficiency may strongly depend on the value of eps.
> I think it's saying that there are some grid squares that don't have enough points to calculate a fit, is that right? I'm pretty sure these are at the edge of the mesh, and shouldn't be a big problem.
In a example from the tests, I got this message when the third
variable z didn't have any variation. I guess for interpolation this
might not have a strong effect.
>> s = 1.1
>> yknots = np.linspace(ymin+s,ymax-s,10)
>> xknots = np.linspace(xmin+s,xmax-s,10)
>> Some good examples for the use of the different options in the spline
>> classes would be nice.
> Yeah. I think once I get things mostly figured out I'll try and condense what I have into an example or two. My problem is that I still don't *really* understand the difference between all these different kinds of splines, so I'll probably want someone to make sure I'm not going totally off the deep end.
>From what I figured out so far, the main difference between
SmoothBivariateSpline and LSQBivariateSpline is that in the first case
the approximation is controlled by s and the knot points are adjusted,
in the second case the knot points are fixed and will imply some s.
(For the univariate splines, we had the discussion on the mailing list
that the class names are not very descriptive and misleading)
Controlling s (small positive number) looks easier to adjust, than
choosing knots. One possibility might be to try out different values
of s and see how the chosen knot points (get_knots()) compare to the
ones that you are using now.
I started to convert a scipy.tutorial example that uses the old
wrapper to using spline classes to see the difference in the required
arguments, but didn't get very far yet. Having a good (graphical)
summary of the spline results, helps a lot to quickly see what the
different "smoothing parameters" are doing.
> Peter Combs
> SciPy-User mailing list
More information about the SciPy-User