[SciPy-User] Newbie Question :: Natural Cubic Spline
Wed Oct 21 15:48:19 CDT 2009
I am new to Python and the SciPy libraries and I was wondering if someone could help me with the following.
Given the following x and y : values
x_list = [33, 56, 56.00000000002, 147, 238, 329, 420, 511, 602, 693, 791]
y_list = [0.99974, 0.99949, 0.99949, 0.99816,0.99631,0.99383,0.99043,0.98610,0.98078,0.97460,0.96704]
I want to use a Natural Cubic Spline in order to determine the points at the following values:
interp_x_points = [31,62,92,123,153,184,215,243,274,304,335,365,396,427,457,488,518,549,580,608,639,669,700]
I have looked through the documentation and have had a tough time determining the correct syntax or which function to use.
I was wondering what would be the SciPy syntax for the following:
Also, does scipy have the ability to extrapolate if a give X value is outside a specified range?
In this example, please notice interp_x_poiints has a value (31) which is outside of the x_list range.
my_spline_object = NaturalCubicSpline(x_list, y_list)
for interp_x_value in interp_x_points:
interp_y_value = my_spline_object(interp_x_value) # return a floating value
Hotmail: Free, trusted and rich email service.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User