TSpline problems

In need of rough and ready interpolation for a small data set, I tried
to use TSpline3 and/or TSpine5 to accomplish my goals.

The results were disappointing. Both classes fail on one (the most
important, of course) one my data sets—though both work well on my
smoother data.

This data exhibits some narrow (a few bins wide) peaks, so I initially
preferred TSpline3 to avoid the wild fluctuation I expected (and got)
from TSpine5, but the cubic spline is computing all coefficients as
NaN. TSpline5 works, but the interpolation takes on values far outside
the domain of the data (like a high degree polynomial fit), so the
result is not acceptable.

I’m not in a strong position for diagnosing the problem myself because
the documentation is very poor: what little there is is full of
copy-n-paste derived anachronisms.

There is no indication of the “opt” parameter in the constructors
does. I assume it controls how the boundary values are interpreted,
but I can only guess as to how.

I am forced to assume that these classes exist to support the drawing
of smooth curves, rather than being intended as part of the
user-facing API, but I would have found them useful in this instance.

Any advice that any has would be appreciated.

In the mean time I’ll look for another implementation that I can weld


Could you show the simplest possible system that we can use to reproduce the problem?
No way to provide help otherwise.


[quote]Could you show the simplest possible system that we can use to reproduce the problem?
No way to provide help otherwise. [/quote]

An abstracted source file is http://bama.ua.edu/~dmckee/demo.C which will run in the interperter, but includes the scaffold I was using to run it cimpiled.

The misbehaving data file is http://bama.ua.edu/~dmckee/Sekharan.data.

On running it you will note that you get no curve in the plot, and that the coefficient in spline_code.C (generated) are set to NaN.

Using TSpline5 generates a poorly behaved spline.


After posting my sample code, I looked carefully at the offending data file and found a number of annomalies: places where a single abssisa appears twice (of even three times). Seperating these by hand caused the NaNs to disapear from the TSpline3 computation, and the TSpline5 to behave more staidly.

But that leaves the question: why was the higher degree spline more robust to that type of bad data?