[SciPy-User] Question regarding UnivariateSpline and splrep

Marcus Boumans m.boumans@gmx....
Mon Jul 2 14:41:32 CDT 2012


Hello,

I want to calculate the derivates of a spline by using the features of 
scipy.interpolate

I have found 2 possible ways:

The one with the oo approach
s_long = UnivariateSpline(distance, 
gtaTrack_Container.reftrack.longitude, w=None, bbox=[None, None], k=2, s=0)
long_der=s_long.derivatives(dist_spline)

The other one with the procedural approach
tck_long = splrep(distance, gtaTrack_Container.reftrack.longitude)
long_der = spalde(dist_spline, tck_long)

My questions:
When using the oo approach with dist_spline is an array I get back an 
array with only 3 elements.
I assume those values are the first to  nth derivatives of element 
dist_spline[0]!?
I this correct?

Using the procedural approach with dist_spline is an array I get back an 
array with 3 colums and len(dist_spline) rows.
I assume those values are the first to nth derivate of each element of 
dist_spline[0]!? That is what I would need.
I this correct?

Can anybody give a comment on that different behavior.
Am I to use a for loop to get the derivatives of all elements of 
dist_spline with the oo approach?
I think it is worth to give a little more details in the help to the 
derivates method of UnivariateSpline.

Regs
Marcus





More information about the SciPy-User mailing list